aem-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +7 -0
- package/.nvmrc +1 -0
- package/LICENSE +22 -0
- package/NOTICE.md +7 -0
- package/README.md +194 -0
- package/dist/aem/aem.config.js +49 -0
- package/dist/aem/aem.connector.js +858 -0
- package/dist/aem/aem.errors.js +133 -0
- package/dist/config.js +11 -0
- package/dist/explorer/api.explorer.js +25 -0
- package/dist/explorer/api.spec.js +79 -0
- package/dist/index.js +3 -0
- package/dist/mcp/mcp.aem-handler.js +152 -0
- package/dist/mcp/mcp.server-handler.js +71 -0
- package/dist/mcp/mcp.server.js +44 -0
- package/dist/mcp/mcp.tools.js +388 -0
- package/dist/mcp/mcp.transports.js +1 -0
- package/dist/server/app.auth.js +28 -0
- package/dist/server/app.server.js +82 -0
- package/package.json +51 -0
- package/src/aem/aem.config.ts +79 -0
- package/src/aem/aem.connector.ts +902 -0
- package/src/aem/aem.errors.ts +152 -0
- package/src/config.ts +12 -0
- package/src/explorer/api.explorer.ts +30 -0
- package/src/explorer/api.spec.ts +79 -0
- package/src/index.ts +4 -0
- package/src/mcp/mcp.aem-handler.ts +158 -0
- package/src/mcp/mcp.server-handler.ts +73 -0
- package/src/mcp/mcp.server.ts +51 -0
- package/src/mcp/mcp.tools.ts +397 -0
- package/src/mcp/mcp.transports.ts +5 -0
- package/src/server/app.auth.ts +32 -0
- package/src/server/app.server.ts +94 -0
- package/tsconfig.json +15 -0
package/.env.example
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22.16.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Venkatesh
|
|
4
|
+
Copyright (c) 2025 Indra
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
This project, AEM MCP Server (aem-mcp-server), is a derivative work based on code originally developed by Venkatesh (c) 2024, licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
Modifications, enhancements, and new code copyright (c) 2025 Indra.
|
|
6
|
+
|
|
7
|
+
See LICENSE for the full MIT license text.
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# AEM MCP Server (aem-mcp-server)
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://www.adobe.com/marketing-cloud/experience-manager.html)
|
|
6
|
+
|
|
7
|
+
AEM MCP Server is a full-featured, extensible Model Context Protocol (MCP) server for Adobe Experience Manager (AEM).
|
|
8
|
+
It provides a robust REST/JSON-RPC API for content, component, and asset management, with advanced integrations for AI, chatbots, and automation.
|
|
9
|
+
This project is designed for AEM developers, content teams, and automation engineers who want to manage AEM programmatically or via natural language.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Overview](#overview)
|
|
16
|
+
- [Features](#features)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [Usage Examples](#usage-examples)
|
|
19
|
+
- [Configuration](#configuration)
|
|
20
|
+
- [API & Client Usage](#api--client-usage)
|
|
21
|
+
- [AI IDE Integration (Cursor, Cline, etc.)](#ai-ide-integration-cursor-cline-etc)
|
|
22
|
+
- [Security](#security)
|
|
23
|
+
- [Project Structure](#project-structure)
|
|
24
|
+
- [Integrations](#integrations)
|
|
25
|
+
- [Contribution](#contribution)
|
|
26
|
+
- [License](#license)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
- **Modern, TypeScript-based AEM MCP server**
|
|
32
|
+
- **REST/JSON-RPC API** for AEM content, component, and asset operations
|
|
33
|
+
- **AI/LLM integration** (OpenAI, Anthropic, Ollama, custom HTTP APIs)
|
|
34
|
+
- **Production-ready, modular, and extensible**
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
- **AEM Page & Asset Management**: Create, update, delete, activate, deactivate, and replicate pages and assets
|
|
40
|
+
- **Component Operations**: Validate, update, scan, and manage AEM components (including Experience Fragments)
|
|
41
|
+
- **Advanced Search**: QueryBuilder, fulltext, fuzzy, and enhanced page search
|
|
42
|
+
- **Replication & Rollout**: Publish/unpublish content, roll out changes to language copies
|
|
43
|
+
- **Text & Image Extraction**: Extract all text and images from pages, including fragments
|
|
44
|
+
- **Template & Structure Discovery**: List templates, analyze page/component structure
|
|
45
|
+
- **JCR Node Access**: Legacy and modern node/content access
|
|
46
|
+
- **AI/LLM Integration**: Natural language interface for AEM via OpenAI, Anthropic, Ollama, or custom LLMs
|
|
47
|
+
- **Telegram Bot**: Manage AEM via chat, including conversational commands
|
|
48
|
+
- **Security**: Auth, environment-based config, and safe operation defaults
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
### Prerequisites
|
|
55
|
+
- Node.js 18+
|
|
56
|
+
- Access to an AEM instance (local or remote)
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
```sh
|
|
60
|
+
cd clone
|
|
61
|
+
npm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Build
|
|
65
|
+
```sh
|
|
66
|
+
npm run build
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Run (Production)
|
|
70
|
+
```sh
|
|
71
|
+
npm start
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Run (Development, hot reload)
|
|
75
|
+
```sh
|
|
76
|
+
npm run dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Usage Examples
|
|
82
|
+
|
|
83
|
+
### 1. List all pages under a path
|
|
84
|
+
```sh
|
|
85
|
+
curl -u admin:admin \
|
|
86
|
+
-X POST http://localhost:8080/api \
|
|
87
|
+
-H 'Content-Type: application/json' \
|
|
88
|
+
-d '{"method":"mcp_aem-mcp_listPages","params":{"siteRoot":"/content/we-retail","depth":2,"limit":10}}'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Update a component property
|
|
92
|
+
```sh
|
|
93
|
+
curl -u admin:admin \
|
|
94
|
+
-X POST http://localhost:8080/api \
|
|
95
|
+
-H 'Content-Type: application/json' \
|
|
96
|
+
-d '{"method":"mcp_aem-mcp_updateComponent","params":{"componentPath":"/content/we-retail/us/en/experience/jcr:content/root/hero_image","properties":{"Heading":"New Heading"}}}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Use with AI IDEs (Cursor, Cline, etc.)
|
|
100
|
+
- See the [AI IDE Integration](#ai-ide-integration-cursor-cline-etc) section below.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
### Environment Variables
|
|
107
|
+
Create a `.env` file in the project root with the following (edit as needed):
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
AEM_HOST=http://localhost:4502
|
|
111
|
+
AEM_SERVICE_USER=admin
|
|
112
|
+
AEM_SERVICE_PASSWORD=admin
|
|
113
|
+
SERVER_PORT=3000
|
|
114
|
+
MCP_USERNAME=admin
|
|
115
|
+
MCP_PASSWORD=admin
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### MCP Client Configuration
|
|
119
|
+
Sample for AI-based code editors or custom clients:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"aem-mcp": {
|
|
125
|
+
"command": "node",
|
|
126
|
+
"args": [
|
|
127
|
+
"absolute path to dist/index.js"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## API & Client Usage
|
|
137
|
+
- **REST/JSON-RPC**: Exposes all AEM operations via HTTP endpoints
|
|
138
|
+
- **Supported Operations**: Page/asset CRUD, component validation/update, search, rollout, publish, text/image extraction, and more
|
|
139
|
+
- **AI/LLM**: Send natural language commands to the server (via API or Telegram)
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## AI IDE Integration (Cursor, Cline, etc.)
|
|
144
|
+
|
|
145
|
+
AEM MCP Server is compatible with modern AI IDEs and code editors that support MCP protocol, such as **Cursor** and **Cline**.
|
|
146
|
+
|
|
147
|
+
### How to Connect:
|
|
148
|
+
1. **Install and run the AEM MCP Server** as described above.
|
|
149
|
+
2. **Configure your IDE** to connect to the MCP server. Example for Cursor/Cline:
|
|
150
|
+
- Open your IDE's MCP server settings.
|
|
151
|
+
- Add a new server with:
|
|
152
|
+
- **Type:** Custom MCP
|
|
153
|
+
- **Command:** `node`
|
|
154
|
+
- **Args:** `["/absolute/path/to/dist/index.js"]`
|
|
155
|
+
- **Port:** `3000` (or as configured)
|
|
156
|
+
- **Auth:** Use `MCP_USERNAME`/`MCP_PASSWORD` from your `.env`
|
|
157
|
+
3. **Restart your IDE** and connect. The IDE will now be able to:
|
|
158
|
+
- List, search, and manage AEM content
|
|
159
|
+
- Run MCP methods (CRUD, search, rollout, etc.)
|
|
160
|
+
- Use AI/LLM features if enabled
|
|
161
|
+
|
|
162
|
+
### Custom MCP Clients
|
|
163
|
+
- You can build your own MCP client in any language that supports HTTP/JSON-RPC.
|
|
164
|
+
- See the [Usage Examples](#usage-examples) for API call patterns.
|
|
165
|
+
- Authenticate using basic auth (`MCP_USERNAME`/`MCP_PASSWORD`).
|
|
166
|
+
- All MCP methods are available via the `/api` endpoint.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Security
|
|
171
|
+
- Auth required for all operations (see `MCP_USERNAME`/`MCP_PASSWORD`)
|
|
172
|
+
- Environment-based configuration for safe deployment
|
|
173
|
+
- All destructive operations require explicit parameters and validation
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Project Structure
|
|
178
|
+
- `src/` — TypeScript source code
|
|
179
|
+
- `dist/` — Compiled JS output
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Integrations
|
|
184
|
+
- **AI/LLM**: OpenAI, Anthropic, Ollama, custom HTTP APIs
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Contribution
|
|
189
|
+
Contributions are welcome! Please open issues or pull requests for bug fixes, features, or documentation improvements.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export const DEFAULT_AEM_CONFIG = {
|
|
4
|
+
contentPaths: {
|
|
5
|
+
sitesRoot: process.env.AEM_SITES_ROOT || '/content',
|
|
6
|
+
assetsRoot: process.env.AEM_ASSETS_ROOT || '/content/dam',
|
|
7
|
+
templatesRoot: process.env.AEM_TEMPLATES_ROOT || '/conf',
|
|
8
|
+
experienceFragmentsRoot: process.env.AEM_XF_ROOT || '/content/experience-fragments',
|
|
9
|
+
},
|
|
10
|
+
replication: {
|
|
11
|
+
publisherUrls: process.env.AEM_PUBLISHER_URLS?.split(',') || ['http://localhost:4503'],
|
|
12
|
+
defaultReplicationAgent: process.env.AEM_DEFAULT_AGENT || 'publish',
|
|
13
|
+
},
|
|
14
|
+
components: {
|
|
15
|
+
allowedTypes: process.env.AEM_ALLOWED_COMPONENTS?.split(',') || [
|
|
16
|
+
'text', 'image', 'hero', 'button', 'list', 'teaser', 'carousel'
|
|
17
|
+
],
|
|
18
|
+
defaultProperties: {
|
|
19
|
+
'jcr:primaryType': 'nt:unstructured',
|
|
20
|
+
'sling:resourceType': 'foundation/components/text'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
queries: {
|
|
24
|
+
maxLimit: parseInt(process.env.AEM_QUERY_MAX_LIMIT || '100'),
|
|
25
|
+
defaultLimit: parseInt(process.env.AEM_QUERY_DEFAULT_LIMIT || '20'),
|
|
26
|
+
timeoutMs: parseInt(process.env.AEM_QUERY_TIMEOUT || '30000'),
|
|
27
|
+
},
|
|
28
|
+
validation: {
|
|
29
|
+
maxDepth: parseInt(process.env.AEM_MAX_DEPTH || '5'),
|
|
30
|
+
allowedLocales: ['en'],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export function getAEMConfig() {
|
|
34
|
+
return DEFAULT_AEM_CONFIG;
|
|
35
|
+
}
|
|
36
|
+
export function isValidContentPath(path, config = DEFAULT_AEM_CONFIG) {
|
|
37
|
+
const allowedRoots = Object.values(config.contentPaths);
|
|
38
|
+
return allowedRoots.some(root => path.startsWith(root));
|
|
39
|
+
}
|
|
40
|
+
export function isValidComponentType(componentType, config = DEFAULT_AEM_CONFIG) {
|
|
41
|
+
return config.components.allowedTypes.includes(componentType);
|
|
42
|
+
}
|
|
43
|
+
export function isValidLocale(locale, config = DEFAULT_AEM_CONFIG) {
|
|
44
|
+
if (!locale)
|
|
45
|
+
return false;
|
|
46
|
+
const normalized = locale.toLowerCase();
|
|
47
|
+
return config.validation.allowedLocales.some(l => l.toLowerCase() === normalized ||
|
|
48
|
+
(normalized === 'en' && l.toLowerCase().startsWith('en')));
|
|
49
|
+
}
|