@contentstack/mcp 0.2.0 → 0.3.1
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/LICENSE +1 -1
- package/README.md +40 -14
- package/dist/index.js +61 -33
- package/package.json +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contentstack MCP Server
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that connects with Contentstack's Content Management API, Content Delivery API, BrandKit AI, Personalize API, Analytics API, Launch API, and Lytics, delivering extensive content administration, manipulation, delivery, personalization, analytics, deployment, and insights functionality.
|
|
3
|
+
A Model Context Protocol (MCP) server that connects with Contentstack's Content Management API, Content Delivery API, BrandKit AI, Personalize API, Analytics API, Launch API, Developer Hub, and Lytics, delivering extensive content administration, manipulation, delivery, personalization, analytics, deployment, marketplace App management, and insights functionality.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -19,6 +19,7 @@ A Model Context Protocol (MCP) server that connects with Contentstack's Content
|
|
|
19
19
|
- **Launch Deployment**: Complete deployment platform integration with environment management, deploy hooks, deployments, and CDN cache revalidation for hosting Contentstack-powered websites.
|
|
20
20
|
- **Lytics Analytics**: Audience management, content classification, user profiling, and advanced analytics capabilities.
|
|
21
21
|
- **Personalization**: Advanced personalization capabilities with audience segmentation, A/B testing, experience management, and analytics for optimizing user engagement.
|
|
22
|
+
- **Developer Hub**: Complete Marketplace App lifecycle management with capabilities to create, update, delete, and retrieve Marketplace Apps, manage app installations across stacks and organizations.
|
|
22
23
|
- **Flexible Query Options**: Advanced query capabilities with support for pagination, filtering, sorting, and including associated data.
|
|
23
24
|
|
|
24
25
|
## API Groups
|
|
@@ -30,6 +31,7 @@ The MCP server supports multiple API groups that can be used independently or to
|
|
|
30
31
|
- **Analytics**: Usage analytics, performance monitoring, and operational insights
|
|
31
32
|
- **BrandKit**: AI-powered brand management and content generation
|
|
32
33
|
- **Launch**: Deployment platform for hosting and managing Contentstack-powered websites
|
|
34
|
+
- **DeveloperHub**: Marketplace app lifecycle management and installations
|
|
33
35
|
- **Lytics**: Advanced analytics and audience insights
|
|
34
36
|
- **Personalize**: Advanced personalization and A/B testing capabilities
|
|
35
37
|
- **All**: Enable all API groups
|
|
@@ -202,6 +204,29 @@ The MCP server supports multiple API groups that can be used independently or to
|
|
|
202
204
|
|
|
203
205
|
- **revalidate_cdn_cache**: Revalidates the CDN cache for an environment when content or configuration is modified. Prompts the CDN to fetch the latest content from the origin server, ensuring visitors see the most up-to-date version across all domains in the environment.
|
|
204
206
|
|
|
207
|
+
### Developer Hub
|
|
208
|
+
|
|
209
|
+
#### Marketplace App Management
|
|
210
|
+
|
|
211
|
+
- **create_an_app**: Creates a Marketplace App in an Organization.
|
|
212
|
+
- **update_an_app**: Updates a specified Marketplace App in an Organization.
|
|
213
|
+
- **delete_an_app**: Deletes a specified Marketplace App from an Organization.
|
|
214
|
+
- **get_an_app**: Retrieves detailed information for a specified Marketplace App from an Organization.
|
|
215
|
+
- **get_all_apps**: Retrieves all Marketplace Apps with pagination support, search capabilities, and filtering options for target type, enabling efficient Marketplace App discovery and management.
|
|
216
|
+
|
|
217
|
+
#### Marketplace App OAuth Management
|
|
218
|
+
|
|
219
|
+
- **get_app_oauth**: Retrieves the OAuth configuration details for a specified Marketplace App.
|
|
220
|
+
- **get_oauth_scopes**: Retrieves available OAuth scopes for Marketplace Apps, with optional filtering by app type (stack or organization).
|
|
221
|
+
- **update_app_oauth**: Updates the OAuth configuration for a specified Marketplace App, including redirect URIs, user token configuration, and app token configuration for secure API access.
|
|
222
|
+
|
|
223
|
+
#### Marketplace App Installation Management
|
|
224
|
+
|
|
225
|
+
- **install_an_app**: Installs a specified Marketplace App in a target stack or organization, enabling Marketplace App functionality within the designated scope based on app configuration.
|
|
226
|
+
- **update_an_app_installation**: Updates a specified Marketplace App installation in a stack or organization.
|
|
227
|
+
- **get_app_installations**: Retrieves all installations for a specified Marketplace App, providing visibility into where and how the Marketplace App is deployed across stacks and organizations.
|
|
228
|
+
- **uninstall_an_app**: Uninstalls a specified Marketplace App from a stack or organization, removing Marketplace App functionality and cleaning up Marketplace App-related configurations.
|
|
229
|
+
|
|
205
230
|
### Lytics Analytics
|
|
206
231
|
|
|
207
232
|
#### Audience Management
|
|
@@ -279,9 +304,9 @@ The MCP server supports multiple API groups that can be used independently or to
|
|
|
279
304
|
|
|
280
305
|
1. Create a Contentstack account at [Contentstack](https://www.contentstack.com/login/)
|
|
281
306
|
|
|
282
|
-
### OAuth Setup (Required for CMA, Analytics, BrandKit, Launch, and Personalize)
|
|
307
|
+
### OAuth Setup (Required for CMA, Analytics, BrandKit, Launch, DeveloperHub, and Personalize)
|
|
283
308
|
|
|
284
|
-
**Important**: Before using Content Management API (CMA), Analytics, BrandKit, Launch, or Personalize tools, you must authenticate using OAuth:
|
|
309
|
+
**Important**: Before using Content Management API (CMA), Analytics, BrandKit, Launch, DeveloperHub, or Personalize tools, you must authenticate using OAuth:
|
|
285
310
|
|
|
286
311
|
```bash
|
|
287
312
|
npx @contentstack/mcp --auth
|
|
@@ -307,19 +332,20 @@ These variables can also be set as arguments
|
|
|
307
332
|
- `CONTENTSTACK_LAUNCH_PROJECT_ID` / `--launch-project-id`: Your Launch Project ID (required for Launch tools)
|
|
308
333
|
- `LYTICS_ACCESS_TOKEN` / `--lytics-access-token`: Your Lytics access token (required for Lytics tools)
|
|
309
334
|
- `CONTENTSTACK_PERSONALIZE_PROJECT_ID` / `--personalize-project-id`: Your Personalize Project ID (required for Personalize tools)
|
|
310
|
-
- `GROUPS` / `--groups`: Comma-separated list of API groups to enable (options: `cma`, `cda`, `analytics`, `brandkit`, `launch`, `lytics`, `personalize`, `all`. Default: `cma`)
|
|
335
|
+
- `GROUPS` / `--groups`: Comma-separated list of API groups to enable (options: `cma`, `cda`, `analytics`, `brandkit`, `launch`, `developerhub`, `lytics`, `personalize`, `all`. Default: `cma`)
|
|
311
336
|
|
|
312
337
|
### Group Requirements Summary
|
|
313
338
|
|
|
314
|
-
| Group
|
|
315
|
-
|
|
|
316
|
-
| **CMA**
|
|
317
|
-
| **CDA**
|
|
318
|
-
| **Analytics**
|
|
319
|
-
| **BrandKit**
|
|
320
|
-
| **Launch**
|
|
321
|
-
| **
|
|
322
|
-
| **
|
|
339
|
+
| Group | Authentication | Required Tokens/Configuration |
|
|
340
|
+
| ---------------- | -------------- | -------------------------------------- |
|
|
341
|
+
| **CMA** | OAuth | Stack API Key |
|
|
342
|
+
| **CDA** | Token-based | Stack API Key + Delivery Token |
|
|
343
|
+
| **Analytics** | OAuth | Stack API Key |
|
|
344
|
+
| **BrandKit** | OAuth | Stack API Key + Brand Kit ID |
|
|
345
|
+
| **Launch** | OAuth | Stack API Key + Launch Project ID |
|
|
346
|
+
| **DeveloperHub** | OAuth | Stack API Key |
|
|
347
|
+
| **Lytics** | Token-based | Lytics Access Token |
|
|
348
|
+
| **Personalize** | OAuth | Stack API Key + Personalize Project ID |
|
|
323
349
|
|
|
324
350
|
### Usage with Claude Desktop
|
|
325
351
|
|
|
@@ -352,7 +378,7 @@ You can use this MCP without cloning the repository by simply modifying your Cla
|
|
|
352
378
|
- The `CONTENTSTACK_LAUNCH_PROJECT_ID` is required only for Launch tools.
|
|
353
379
|
- The `CONTENTSTACK_PERSONALIZE_PROJECT_ID` is required only for Personalize tools.
|
|
354
380
|
- The `LYTICS_ACCESS_TOKEN` is required only for Lytics tools.
|
|
355
|
-
- Before using CMA, Analytics, BrandKit, Launch, or Personalize groups, you must first run OAuth authentication: `npx @contentstack/mcp --auth`
|
|
381
|
+
- Before using CMA, Analytics, BrandKit, Launch, DeveloperHub, or Personalize groups, you must first run OAuth authentication: `npx @contentstack/mcp --auth`
|
|
356
382
|
|
|
357
383
|
If your MCPClient doesn't support environment variables, you can alternatively provide the required authentication parameters as command-line arguments:
|
|
358
384
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import {
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
6
|
import {
|
|
7
7
|
CallToolRequestSchema,
|
|
@@ -13,7 +13,7 @@ import dotenv from "dotenv";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@contentstack/mcp",
|
|
16
|
-
version: "0.
|
|
16
|
+
version: "0.3.1",
|
|
17
17
|
main: "./dist/index.js",
|
|
18
18
|
type: "module",
|
|
19
19
|
publishConfig: {
|
|
@@ -46,7 +46,7 @@ var package_default = {
|
|
|
46
46
|
url: "https://github.com/contentstack/mcp.git"
|
|
47
47
|
},
|
|
48
48
|
dependencies: {
|
|
49
|
-
"@modelcontextprotocol/sdk": "
|
|
49
|
+
"@modelcontextprotocol/sdk": "1.24.3",
|
|
50
50
|
axios: "^1.9.0",
|
|
51
51
|
dotenv: "^16.5.0",
|
|
52
52
|
inquirer: "^12.6.3",
|
|
@@ -84,6 +84,17 @@ var package_default = {
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
// src/oauth.ts
|
|
88
|
+
import axios from "axios";
|
|
89
|
+
import http from "http";
|
|
90
|
+
import url from "url";
|
|
91
|
+
import fs from "fs/promises";
|
|
92
|
+
import path from "path";
|
|
93
|
+
import os from "os";
|
|
94
|
+
import open from "open";
|
|
95
|
+
import crypto from "crypto";
|
|
96
|
+
import inquirer from "inquirer";
|
|
97
|
+
|
|
87
98
|
// src/utils/constants.ts
|
|
88
99
|
var CMA_URLS = {
|
|
89
100
|
NA: "https://api.contentstack.io",
|
|
@@ -176,6 +187,14 @@ var LAUNCH_URLS = {
|
|
|
176
187
|
GCP_NA: "https://gcp-na-launch-api.contentstack.com/manage",
|
|
177
188
|
GCP_EU: "https://gcp-eu-launch-api.contentstack.com/manage"
|
|
178
189
|
};
|
|
190
|
+
var DEVELOPERHUB_URLS = {
|
|
191
|
+
NA: "https://developerhub-api.contentstack.com",
|
|
192
|
+
EU: "https://eu-developerhub-api.contentstack.com",
|
|
193
|
+
AZURE_NA: "https://azure-na-developerhub-api.contentstack.com",
|
|
194
|
+
AZURE_EU: "https://azure-eu-developerhub-api.contentstack.com",
|
|
195
|
+
GCP_NA: "https://gcp-na-developerhub-api.contentstack.com",
|
|
196
|
+
GCP_EU: "https://gcp-eu-developerhub-api.contentstack.com"
|
|
197
|
+
};
|
|
179
198
|
var GroupEnum = {
|
|
180
199
|
CMA: "cma",
|
|
181
200
|
CDA: "cda",
|
|
@@ -184,7 +203,8 @@ var GroupEnum = {
|
|
|
184
203
|
LYTICS: "lytics",
|
|
185
204
|
ANALYTICS: "analytics",
|
|
186
205
|
PERSONALIZE: "personalize",
|
|
187
|
-
LAUNCH: "launch"
|
|
206
|
+
LAUNCH: "launch",
|
|
207
|
+
DEVELOPERHUB: "developerhub"
|
|
188
208
|
};
|
|
189
209
|
var apiVersionHeaders = [
|
|
190
210
|
"publish_variants_of_an_entry",
|
|
@@ -198,22 +218,11 @@ var TOOL_URLS = {
|
|
|
198
218
|
lytics: "https://mcp.contentstack.com/lytics/tools",
|
|
199
219
|
personalize: "https://mcp.contentstack.com/personalize/tools",
|
|
200
220
|
analytics: "https://mcp.contentstack.com/analytics/tools",
|
|
201
|
-
launch: "https://mcp.contentstack.com/launch/tools"
|
|
221
|
+
launch: "https://mcp.contentstack.com/launch/tools",
|
|
222
|
+
developerhub: "https://mcp.contentstack.com/developerhub/tools"
|
|
202
223
|
};
|
|
203
224
|
|
|
204
|
-
// src/utils/index.ts
|
|
205
|
-
import axios2 from "axios";
|
|
206
|
-
|
|
207
225
|
// src/oauth.ts
|
|
208
|
-
import axios from "axios";
|
|
209
|
-
import http from "http";
|
|
210
|
-
import url from "url";
|
|
211
|
-
import fs from "fs/promises";
|
|
212
|
-
import path from "path";
|
|
213
|
-
import os from "os";
|
|
214
|
-
import open from "open";
|
|
215
|
-
import crypto from "crypto";
|
|
216
|
-
import inquirer from "inquirer";
|
|
217
226
|
var ContentstackOAuthHandler = class _ContentstackOAuthHandler {
|
|
218
227
|
appId;
|
|
219
228
|
clientId;
|
|
@@ -763,6 +772,18 @@ var ContentstackOAuthHandler = class _ContentstackOAuthHandler {
|
|
|
763
772
|
var oauth_default = ContentstackOAuthHandler;
|
|
764
773
|
|
|
765
774
|
// src/utils/index.ts
|
|
775
|
+
import axios2 from "axios";
|
|
776
|
+
import fs2 from "fs";
|
|
777
|
+
var fetchToolsJson = async (url2) => {
|
|
778
|
+
try {
|
|
779
|
+
if (url2.startsWith("http")) {
|
|
780
|
+
return await axios2.get(url2);
|
|
781
|
+
}
|
|
782
|
+
return { data: JSON.parse(fs2.readFileSync(url2, "utf8")) };
|
|
783
|
+
} catch (error) {
|
|
784
|
+
throw new Error(`Error fetching tools from ${url2}: ${error}`);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
766
787
|
var getBaseUrl = (region, group, subgroup) => {
|
|
767
788
|
if (group === GroupEnum.CMA) {
|
|
768
789
|
return CMA_URLS[region];
|
|
@@ -781,6 +802,8 @@ var getBaseUrl = (region, group, subgroup) => {
|
|
|
781
802
|
return ANALYTICS_URLS[region];
|
|
782
803
|
} else if (group === GroupEnum.LAUNCH) {
|
|
783
804
|
return LAUNCH_URLS[region];
|
|
805
|
+
} else if (group === GroupEnum.DEVELOPERHUB) {
|
|
806
|
+
return DEVELOPERHUB_URLS[region];
|
|
784
807
|
} else {
|
|
785
808
|
throw new Error(`Invalid group: ${group}`);
|
|
786
809
|
}
|
|
@@ -794,7 +817,8 @@ var getTools = async (groups) => {
|
|
|
794
817
|
[GroupEnum.LYTICS]: TOOL_URLS.lytics,
|
|
795
818
|
[GroupEnum.PERSONALIZE]: TOOL_URLS.personalize,
|
|
796
819
|
[GroupEnum.ANALYTICS]: TOOL_URLS.analytics,
|
|
797
|
-
[GroupEnum.LAUNCH]: TOOL_URLS.launch
|
|
820
|
+
[GroupEnum.LAUNCH]: TOOL_URLS.launch,
|
|
821
|
+
[GroupEnum.DEVELOPERHUB]: TOOL_URLS.developerhub
|
|
798
822
|
};
|
|
799
823
|
if (groups.includes(GroupEnum.ALL)) {
|
|
800
824
|
const [
|
|
@@ -804,15 +828,17 @@ var getTools = async (groups) => {
|
|
|
804
828
|
lyticsRes,
|
|
805
829
|
personalizeRes,
|
|
806
830
|
analyticsRes,
|
|
807
|
-
launchRes
|
|
831
|
+
launchRes,
|
|
832
|
+
developerhubRes
|
|
808
833
|
] = await Promise.all([
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
834
|
+
fetchToolsJson(TOOL_URLS.cma),
|
|
835
|
+
fetchToolsJson(TOOL_URLS.cda),
|
|
836
|
+
fetchToolsJson(TOOL_URLS.brandkit),
|
|
837
|
+
fetchToolsJson(TOOL_URLS.lytics),
|
|
838
|
+
fetchToolsJson(TOOL_URLS.personalize),
|
|
839
|
+
fetchToolsJson(TOOL_URLS.analytics),
|
|
840
|
+
fetchToolsJson(TOOL_URLS.launch),
|
|
841
|
+
fetchToolsJson(TOOL_URLS.developerhub)
|
|
816
842
|
]);
|
|
817
843
|
return {
|
|
818
844
|
...cmaRes.data,
|
|
@@ -821,7 +847,8 @@ var getTools = async (groups) => {
|
|
|
821
847
|
...lyticsRes.data,
|
|
822
848
|
...personalizeRes.data,
|
|
823
849
|
...analyticsRes.data,
|
|
824
|
-
...launchRes.data
|
|
850
|
+
...launchRes.data,
|
|
851
|
+
...developerhubRes.data
|
|
825
852
|
};
|
|
826
853
|
}
|
|
827
854
|
const responses = await Promise.all(
|
|
@@ -830,7 +857,7 @@ var getTools = async (groups) => {
|
|
|
830
857
|
if (!url2) {
|
|
831
858
|
throw new Error(`Invalid group: ${group}`);
|
|
832
859
|
}
|
|
833
|
-
return
|
|
860
|
+
return fetchToolsJson(url2);
|
|
834
861
|
})
|
|
835
862
|
);
|
|
836
863
|
return responses.reduce((allTools, response) => {
|
|
@@ -1139,7 +1166,8 @@ var GROUPS = {
|
|
|
1139
1166
|
LYTICS: "lytics",
|
|
1140
1167
|
ANALYTICS: "analytics",
|
|
1141
1168
|
PERSONALIZE: "personalize",
|
|
1142
|
-
LAUNCH: "launch"
|
|
1169
|
+
LAUNCH: "launch",
|
|
1170
|
+
DEVELOPERHUB: "developerhub"
|
|
1143
1171
|
};
|
|
1144
1172
|
function getArgValue(argName) {
|
|
1145
1173
|
const index = process.argv.findIndex((arg) => arg === argName);
|
|
@@ -1217,7 +1245,7 @@ function validateGroupRequirements(groups, options) {
|
|
|
1217
1245
|
}
|
|
1218
1246
|
function createContentstackMCPServer(options) {
|
|
1219
1247
|
const { groups } = options;
|
|
1220
|
-
const
|
|
1248
|
+
const mcpServer = new McpServer(
|
|
1221
1249
|
{
|
|
1222
1250
|
name: "Contentstack MCP",
|
|
1223
1251
|
version: package_default.version
|
|
@@ -1229,7 +1257,7 @@ function createContentstackMCPServer(options) {
|
|
|
1229
1257
|
}
|
|
1230
1258
|
);
|
|
1231
1259
|
let toolData;
|
|
1232
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
1260
|
+
mcpServer.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
1233
1261
|
try {
|
|
1234
1262
|
toolData = await getTools(groups);
|
|
1235
1263
|
if (!toolData || Object.keys(toolData).length === 0) {
|
|
@@ -1244,7 +1272,7 @@ function createContentstackMCPServer(options) {
|
|
|
1244
1272
|
);
|
|
1245
1273
|
}
|
|
1246
1274
|
});
|
|
1247
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1275
|
+
mcpServer.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1248
1276
|
const { name, arguments: args } = request.params;
|
|
1249
1277
|
if (!name || !args) {
|
|
1250
1278
|
throw new Error("Invalid request: Missing tool name or arguments");
|
|
@@ -1290,7 +1318,7 @@ function createContentstackMCPServer(options) {
|
|
|
1290
1318
|
throw new Error(`Tool execution failed: ${error.message}`);
|
|
1291
1319
|
}
|
|
1292
1320
|
});
|
|
1293
|
-
return
|
|
1321
|
+
return mcpServer;
|
|
1294
1322
|
}
|
|
1295
1323
|
async function checkOAuthConfig() {
|
|
1296
1324
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"url": "https://github.com/contentstack/mcp.git"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/sdk": "
|
|
36
|
+
"@modelcontextprotocol/sdk": "1.24.3",
|
|
37
37
|
"axios": "^1.9.0",
|
|
38
38
|
"dotenv": "^16.5.0",
|
|
39
39
|
"inquirer": "^12.6.3",
|