AEM DEV MCP Server

AEM DEV MCP Server

Enables AI agents to manage Adobe Experience Manager instances, including OSGi bundle and component operations, configuration CRUD, health monitoring, log analysis, and Groovy script execution.

Category
访问服务器

README

AEM DEV MCP Server

A TypeScript-based Model Context Protocol (MCP) server that provides connectivity tools for Adobe Experience Manager (AEM) instances. This server enables AI agents to interact with AEM systems, manage OSGi bundles and configurations, monitor health, and troubleshoot common issues.

Features

  • Multi-Instance Management: Connect to multiple AEM instances simultaneously with alias-based grouping
  • OSGi Bundle Operations: List, start, stop, refresh, restart, and uninstall bundles
  • Component Management: Enable, disable, and inspect OSGi components
  • Configuration CRUD: Create, read, update, and delete OSGi configurations
  • Health Monitoring: Comprehensive system health checks across instances
  • Log Analysis: Search and analyze AEM logs with regex patterns and pagination
  • Groovy Script Execution: Run custom Groovy scripts for advanced operations
  • Parallel Execution: Perform operations across multiple instances concurrently (up to 20)

Installation

Prerequisites

  • Node.js >= 18.0.0
  • npm
  • Access to AEM instance(s)

Setup

From npm (Recommended)

  1. Install the package globally:
npm install -g aem-dev-mcp-server
  1. During installation, an example configuration file will be automatically created at ~/aem-instances.yaml if it doesn't already exist

  2. Configure your AEM instances in ~/aem-instances.yaml with your actual server details (see configuration example below, or check examples/aem-instances.example.yaml in the installed package)

From sources

  1. Clone the repository:
git clone https://github.com/arkadiusz-rosiak/aem-dev-mcp.git
cd aem-dev-mcp
  1. Install dependencies:
npm install
  1. During installation, an example configuration file will be automatically created at ~/aem-instances.yaml if it doesn't already exist

  2. Build the project:

npm run build
  1. Configure your AEM instances in ~/aem-instances.yaml with your actual server details (you can also check examples/aem-instances.example.yaml for reference):

# Instance groups for different environments
local:
  - url: "http://localhost:4502"
    username: "admin"
    password: "admin"
  - url: "http://localhost:4503"
    username: "admin"
    password: "admin"

dev:
  - url: https://dev-author.example.com
    username: admin
    password: secretpass
  - url: https://dev-publish.example.com
    username: admin
    password: secretpass

prod:
  - url: https://prod-author.example.com
    username: admin
    password: prodpass
  - url: https://prod-publish.example.com
    username: admin
    password: prodpass

First-Run Setup

When you install the AEM MCP Server (either via npm or from sources), a postinstall script automatically runs to improve your setup experience:

  • Automatic Configuration: If ~/aem-instances.yaml doesn't exist, the script automatically copies the example configuration from examples/aem-instances.example.yaml
  • Safe Setup: Existing configurations are never overwritten - your settings are always preserved
  • Clear Feedback: The script provides clear console output about what actions were taken
  • Ready to Use: After installation, you can immediately start using the server by updating the configuration with your AEM credentials

Example output during fresh installation:

🔧 AEM MCP Server - First-run setup...
✓ Created default configuration at ~/aem-instances.yaml
  Please update it with your AEM instance credentials.

📖 Next steps:
  1. Edit ~/aem-instances.yaml with your AEM server details
  2. Replace "changeme" passwords with actual credentials
  3. Remove or comment out environments you don't need

Usage

Configuring AI Agents

Claude Code Configuration

For Claude Code users, you can configure this MCP server using these commands:

Using npm installation (Recommended):

# Add the AEM MCP server to Claude Code
claude mcp add aem-dev-mcp npx aem-dev-mcp-server

# Set environment variable for configuration file location
claude mcp env aem-dev-mcp AEM_INSTANCES_CONFIG_PATH=/path/to/aem-instances.yaml

Using local build:

# Add the AEM MCP server to Claude Code
claude mcp add aem-dev-mcp node /path/to/aem-dev-mcp/dist/server.js

# Set environment variable for configuration file location
claude mcp env aem-dev-mcp AEM_INSTANCES_CONFIG_PATH=/path/to/aem-instances.yaml

Common commands:

# List configured MCP servers
claude mcp list

# Remove the server if needed
claude mcp remove aem-dev-mcp

Claude Desktop Configuration

To use with Claude Desktop or other MCP-compatible AI assistants, add the server to your MCP configuration:

Using npm installation (Recommended):

{
  "mcpServers": {
    "aem-dev-mcp": {
      "command": "npx",
      "args": ["aem-dev-mcp-server"],
      "env": {
        "AEM_INSTANCES_CONFIG_PATH": "/path/to/aem-instances.yaml"
      }
    }
  }
}

Using local build:

{
  "mcpServers": {
    "aem-dev-mcp": {
      "command": "node",
      "args": ["/path/to/aem-dev-mcp/dist/server.js"],
      "env": {
        "AEM_INSTANCES_CONFIG_PATH": "/path/to/aem-instances.yaml"
      }
    }
  }
}

Warp Terminal Configuration

For Warp terminal users, you can configure the MCP server through the Warp settings:

  1. Open Warp terminal
  2. Press Cmd/Ctrl + , to open settings
  3. Navigate to "Features" → "AI Assistant"
  4. Add MCP server configuration:

Using npm installation (Recommended):

{
  "mcpServers": {
    "aem-dev-mcp": {
      "command": "npx",
      "args": ["aem-dev-mcp-server"],
      "env": {
        "AEM_INSTANCES_CONFIG_PATH": "/absolute/path/to/aem-instances.yaml"
      }
    }
  }
}

Using local build:

{
  "mcpServers": {
    "aem-dev-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/aem-dev-mcp/dist/server.js"],
      "env": {
        "AEM_INSTANCES_CONFIG_PATH": "/absolute/path/to/aem-instances.yaml"
      }
    }
  }
}

Note: Make sure to use absolute paths in Warp configuration.

Security & Privacy

Credential Handling

Important for developers: Understanding credential visibility in this MCP server:

  • Direct Instances: When you provide instance configuration directly in tool calls (with URL, username, password), the LLM CAN SEE these credentials as they are part of the tool call parameters
  • Aliases (Recommended): When using aliases from your configuration file, the LLM only sees alias names (e.g., "local", "dev") - actual credentials are read directly by the MCP server from your local configuration file, keeping them invisible to the LLM
  • Local Storage: All credentials are stored locally in your ~/aem-instances.yaml file and never transmitted to external services
  • Secure Communication: The MCP server runs locally and communicates directly with your AEM instances using HTTPS

Security Recommendations:

  • Always use aliases instead of direct instance configuration to keep credentials invisible to the LLM
  • Store configuration file outside of version control
  • Use service accounts with minimal required permissions
  • Regularly rotate passwords for AEM service accounts

Configuration

Automatic Setup

The AEM MCP Server includes automatic first-run setup:

  • Example configuration is automatically copied to ~/aem-instances.yaml during installation
  • No manual file creation needed - just install and configure your credentials
  • Example configuration template available at examples/aem-instances.example.yaml

Environment Variables

  • AEM_INSTANCES_CONFIG_PATH - Path to AEM instances configuration file (default: ~/aem-instances.yaml)

Instance Configuration

The configuration file supports:

  • Direct instance definitions with URL, username, and password
  • Instance groups (aliases) for managing multiple instances
  • Environment-based grouping (dev, staging, prod)

Available MCP Tools

System & Monitoring

  • aem_health_check - Comprehensive system health monitoring
  • aem_logs_search - Search and analyze AEM logs with regex patterns
  • aem_groovy_execute - Execute Groovy scripts for advanced operations

OSGi Bundle Management

  • aem_bundle_list - List all OSGi bundles with filtering
  • aem_bundle_start - Start stopped bundles
  • aem_bundle_stop - Stop running bundles
  • aem_bundle_refresh - Refresh bundle packages
  • aem_bundle_restart - Restart bundles
  • aem_bundle_uninstall - Uninstall bundles
  • aem_bundle_details - Get detailed bundle information

OSGi Component Management

  • aem_component_list - List all OSGi components
  • aem_component_enable - Enable disabled components
  • aem_component_disable - Disable active components
  • aem_component_details - Get detailed component information

OSGi Configuration Management

  • aem_configuration_list - List all OSGi configurations
  • aem_configuration_get - Retrieve specific configuration
  • aem_configuration_create - Create new configurations
  • aem_configuration_update - Update existing configurations
  • aem_configuration_delete - Delete configurations
  • aem_configuration_unbind - Unbind factory configurations

Development

Commands

  • npm run dev - Start development server with hot reload
  • npm run build - Build TypeScript with path aliases
  • npm run typecheck - Type check without building
  • npm run lint - Run ESLint
  • npm run test - Run Jest tests
  • npm run test:coverage - Run tests with coverage report

Architecture

The project follows a layered architecture:

  • Handlers: MCP tool entry points (src/handlers/)
  • Services: Business logic and AEM API communication (src/services/)
  • Types: TypeScript definitions with factory functions (src/types/)
  • Schemas: Zod validation schemas (src/schemas/)
  • Utils: Shared utilities (src/utils/)

Real-World Examples

Example 1: Troubleshooting Inactive OSGi Bundles

Problem: After deployment, several OSGi bundles remain in "Installed" or "Resolved" state instead of "Active", causing features to be unavailable.

AI Agent Interaction:

User: "Several bundles are not active on my AEM author instance. Can you investigate?"

AI: "I'll check the bundle status and identify any issues. Let me start by listing all non-active bundles."
[Uses aem_bundle_list with status filter]

AI: "Found 5 bundles in 'Installed' state. Let me check their details for missing dependencies."
[Uses aem_bundle_details for each problematic bundle]

AI: "The com.company.core bundle has unsatisfied dependencies on com.adobe.cq.social.commons. Let me try to start the dependency first."
[Uses aem_bundle_start on dependency bundle]

AI: "Dependency started successfully. Now attempting to start your core bundle."
[Uses aem_bundle_start on the main bundle]

AI: "All bundles are now active. The issue was a missing dependency that needed to be started first."

Example 2: Memory Issues and Code Fix for Unclosed JCR Sessions

Problem: AEM instance is experiencing memory issues and slowdowns, logs show "CacheManager: resizeAll" warnings.

AI Agent Interaction:

User: "My AEM instance is running slowly and I'm seeing memory warnings in the logs."

AI: "Let me analyze your logs for memory-related issues and check system health."
[Uses aem_logs_search with pattern "CacheManager|OutOfMemory|heap"]

AI: "I see multiple 'CacheManager: resizeAll' entries indicating unclosed JCR sessions. Let me check the system health."
[Uses aem_health_check]

AI: "Memory usage is at 89%. Let me search for the components that might be leaking sessions."
[Uses aem_groovy_execute with a script to find unclosed sessions]

AI: "Found that the custom SearchService component has 1,247 unclosed sessions. Let me examine the code to identify the root cause."
[Reads the SearchService.java file]

AI: "I found the problem in your SearchService code. Here are the issues:

**Issues Found:**
1. Line 34: JCR Session opened but never closed in finally block
2. Line 52: ResourceResolver not properly closed
3. Line 78: Exception handling doesn't close sessions on error

Let me fix these issues:

// BEFORE (problematic code):
public void searchContent(String query) {
    Session session = repository.loginService("searchservice", null);
    ResourceResolver resolver = resolverFactory.getResourceResolver(authInfo);
    
    // Search logic here...
    QueryManager qm = session.getWorkspace().getQueryManager();
    Query q = qm.createQuery(query, Query.XPATH);
    // Sessions never closed - MEMORY LEAK!
}

// AFTER (fixed code):
public void searchContent(String query) {
    Session session = null;
    ResourceResolver resolver = null;
    
    try {
        session = repository.loginService("searchservice", null);
        resolver = resolverFactory.getResourceResolver(authInfo);
        
        // Search logic here...
        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q = qm.createQuery(query, Query.JCR_SQL2); // Also improved query type
        
    } catch (Exception e) {
        log.error("Search failed", e);
    } finally {
        if (resolver != null && resolver.isLive()) {
            resolver.close();
        }
        if (session != null && session.isLive()) {
            session.logout();
        }
    }
}


Now let me restart the component to apply these changes and clear existing leaked sessions."
[Uses aem_component_disable then aem_component_enable]

AI: "Component restarted successfully. Let me monitor the system to confirm the fix worked."
[Uses aem_health_check and aem_logs_search to verify improvements]

AI: "Excellent! Memory usage dropped from 89% to 42%. No more 'CacheManager: resizeAll' warnings appearing. Your SearchService now properly manages JCR resources and won't leak memory."

Example 3: Bulk Operations Across Multiple Instances

Problem: Need to disable a problematic component across all environments quickly to prevent service disruption.

AI Agent Interaction:

User: "The NewsletterService component is causing issues. Can you disable it on all our instances immediately?"

AI: "I'll disable the NewsletterService component across all configured instances in parallel."
[Uses aem_component_disable with alias "all" for parallel execution]

AI: "Component disabled on all 6 instances:
- dev-author: Success
- dev-publish: Success  
- staging-author: Success
- staging-publish: Success
- prod-author: Success
- prod-publish: Success

All instances processed in 2.3 seconds. The problematic component is now safely disabled across your entire infrastructure."

License

MIT

Author

Arkadiusz Rosiak

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选