aem-mcp-server 1.0.7 → 1.0.9
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/README.md +20 -0
- package/dist/aem/aem.config.js +39 -40
- package/dist/aem/aem.connector.js +1 -3
- package/dist/cli.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,6 +47,19 @@ npm install aem-mcp-server -g
|
|
|
47
47
|
aem-mcp
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Configuration
|
|
51
|
+
```
|
|
52
|
+
Options:
|
|
53
|
+
--version Show version number [boolean]
|
|
54
|
+
-H, --host Author instance URL [string] [default: "http://localhost:4502"]
|
|
55
|
+
-P, --publisher Publisher instance URL [string] [default: "http://localhost:4503"]
|
|
56
|
+
-u, --user Username for authentication [string] [default: "admin"]
|
|
57
|
+
-p, --pass Password for authentication [string] [default: "admin"]
|
|
58
|
+
-m, --mcpPort Port for MCP server [number] [default: 3000]
|
|
59
|
+
-e, --explorer Enable Swagger API explorer [boolean] [default: false]
|
|
60
|
+
-h, --help Show help [boolean]
|
|
61
|
+
|
|
62
|
+
```
|
|
50
63
|
---
|
|
51
64
|
|
|
52
65
|
## AI IDE Integration (Cursor, Cline, etc.)
|
|
@@ -88,6 +101,13 @@ Sample for AI-based code editors or custom clients:
|
|
|
88
101
|
@scanPageComponents() /content/path/to/page
|
|
89
102
|
```
|
|
90
103
|
|
|
104
|
+
## API Documentation
|
|
105
|
+
|
|
106
|
+
For detailed API documentation, please refer to the [API Docs](docs/API.md).
|
|
107
|
+
- Enable the API explorer with the `-e` flag to access Swagger UI:
|
|
108
|
+
```aem-mcp -e```
|
|
109
|
+
- Open http://localhost:3000/api-docs to explore the API endpoints.
|
|
110
|
+
|
|
91
111
|
## Contribution
|
|
92
112
|
Contributions are welcome! Please open issues or pull requests for bug fixes, features, or documentation improvements.
|
|
93
113
|
|
package/dist/aem/aem.config.js
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
export function getAEMConfig(config) {
|
|
3
|
+
return {
|
|
4
|
+
contentPaths: {
|
|
5
|
+
sitesRoot: "/content",
|
|
6
|
+
assetsRoot: "/content/dam",
|
|
7
|
+
templatesRoot: "/conf",
|
|
8
|
+
experienceFragmentsRoot: "/content/experience-fragments"
|
|
9
|
+
},
|
|
10
|
+
replication: {
|
|
11
|
+
publisherUrls: config.AEM_PUBLISHER_URLS?.split(",") || ["http://localhost:4503"],
|
|
12
|
+
defaultReplicationAgent: "publish"
|
|
13
|
+
},
|
|
14
|
+
components: {
|
|
15
|
+
allowedTypes: config.AEM_ALLOWED_COMPONENTS?.split(",") || [
|
|
16
|
+
"text",
|
|
17
|
+
"image",
|
|
18
|
+
"hero",
|
|
19
|
+
"button",
|
|
20
|
+
"list",
|
|
21
|
+
"teaser",
|
|
22
|
+
"carousel"
|
|
23
|
+
],
|
|
24
|
+
defaultProperties: {
|
|
25
|
+
"jcr:primaryType": "nt:unstructured",
|
|
26
|
+
"sling:resourceType": "foundation/components/text"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
queries: {
|
|
30
|
+
maxLimit: parseInt(config.AEM_QUERY_MAX_LIMIT || "100"),
|
|
31
|
+
defaultLimit: parseInt(config.AEM_QUERY_DEFAULT_LIMIT || "20"),
|
|
32
|
+
timeoutMs: parseInt(config.AEM_QUERY_TIMEOUT || "30000")
|
|
33
|
+
},
|
|
34
|
+
validation: {
|
|
35
|
+
maxDepth: parseInt(config.AEM_MAX_DEPTH || "5"),
|
|
36
|
+
allowedLocales: ["en"]
|
|
26
37
|
}
|
|
27
|
-
}
|
|
28
|
-
queries: {
|
|
29
|
-
maxLimit: parseInt(process.env.AEM_QUERY_MAX_LIMIT || "100"),
|
|
30
|
-
defaultLimit: parseInt(process.env.AEM_QUERY_DEFAULT_LIMIT || "20"),
|
|
31
|
-
timeoutMs: parseInt(process.env.AEM_QUERY_TIMEOUT || "30000")
|
|
32
|
-
},
|
|
33
|
-
validation: {
|
|
34
|
-
maxDepth: parseInt(process.env.AEM_MAX_DEPTH || "5"),
|
|
35
|
-
allowedLocales: ["en"]
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export function getAEMConfig() {
|
|
39
|
-
return DEFAULT_AEM_CONFIG;
|
|
38
|
+
};
|
|
40
39
|
}
|
|
41
|
-
export function isValidContentPath(path, config
|
|
40
|
+
export function isValidContentPath(path, config) {
|
|
42
41
|
const allowedRoots = Object.values(config.contentPaths);
|
|
43
42
|
return allowedRoots.some((root) => path.startsWith(root));
|
|
44
43
|
}
|
|
45
|
-
export function isValidComponentType(componentType, config
|
|
44
|
+
export function isValidComponentType(componentType, config) {
|
|
46
45
|
return config.components.allowedTypes.includes(componentType);
|
|
47
46
|
}
|
|
48
|
-
export function isValidLocale(locale, config
|
|
47
|
+
export function isValidLocale(locale, config) {
|
|
49
48
|
if (!locale) return false;
|
|
50
49
|
const normalized = locale.toLowerCase();
|
|
51
50
|
return config.validation.allowedLocales.some((l) => l.toLowerCase() === normalized || normalized === "en" && l.toLowerCase().startsWith("en"));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import axios from "axios";
|
|
3
|
-
import dotenv from "dotenv";
|
|
4
3
|
import { getAEMConfig, isValidContentPath, isValidComponentType, isValidLocale } from "./aem.config.js";
|
|
5
4
|
import {
|
|
6
5
|
createAEMError,
|
|
@@ -10,14 +9,13 @@ import {
|
|
|
10
9
|
createSuccessResponse,
|
|
11
10
|
AEM_ERROR_CODES
|
|
12
11
|
} from "./aem.errors.js";
|
|
13
|
-
dotenv.config();
|
|
14
12
|
export class AEMConnector {
|
|
15
13
|
config;
|
|
16
14
|
auth;
|
|
17
15
|
aemConfig;
|
|
18
16
|
constructor(params) {
|
|
19
17
|
this.config = this.loadConfig(params);
|
|
20
|
-
this.aemConfig = getAEMConfig();
|
|
18
|
+
this.aemConfig = getAEMConfig({});
|
|
21
19
|
this.auth = {
|
|
22
20
|
username: this.config.aem.serviceUser.username,
|
|
23
21
|
password: this.config.aem.serviceUser.password
|
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,11 @@ import yargs from "yargs";
|
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
5
|
import { startServer } from "./index.js";
|
|
6
6
|
const argv = yargs(hideBin(process.argv)).options({
|
|
7
|
-
host: { type: "string", default: "http://localhost:4502" },
|
|
8
|
-
user: { type: "string", default: "admin" },
|
|
9
|
-
pass: { type: "string", default: "admin" },
|
|
10
|
-
mcpPort: { type: "number", default: 3e3 },
|
|
11
|
-
explorer: { type: "boolean", default: false }
|
|
7
|
+
host: { type: "string", default: "http://localhost:4502", alias: "H" },
|
|
8
|
+
user: { type: "string", default: "admin", alias: "u" },
|
|
9
|
+
pass: { type: "string", default: "admin", alias: "p" },
|
|
10
|
+
mcpPort: { type: "number", default: 3e3, alias: "m" },
|
|
11
|
+
explorer: { type: "boolean", default: false, alias: "e" }
|
|
12
12
|
}).help().alias("h", "help").parseSync();
|
|
13
13
|
if (argv.help) {
|
|
14
14
|
process.exit(0);
|