@contentstack/mcp 0.4.0 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +26 -0
  2. package/dist/index.js +35 -6
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Contentstack MCP Server
2
2
 
3
+ > **⚠️ EXPERIMENTAL**: This MCP server is currently in experimental stage. Features, APIs, and functionality may change without notice. Use in production environments at your own risk. We welcome feedback and contributions as we work towards a stable release.
4
+
3
5
  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
6
 
5
7
  ## Features
@@ -198,9 +200,22 @@ The MCP server supports multiple API groups that can be used independently or to
198
200
 
199
201
  ### Launch API
200
202
 
203
+ #### Project Management
204
+
205
+ - **get_all_projects**: Fetches the list of all projects in your organization with pagination support. Returns project details including repository information, organization UID, and metadata.
206
+ - **get_a_project**: Fetches a specific project in Launch using the project UID. Returns comprehensive project details including repository configuration and metadata.
207
+ - **create_a_project**: Creates a project in Launch using either a Git Provider or File Upload. For Git Provider: connect your GitHub/Bitbucket account and provide repository details. For File Upload: first get a signed upload URL, then upload your ZIP file (valid for 10 minutes).
208
+ - **update_a_project**: Updates an existing project in your organization. Allows modification of project name and description.
209
+ - **delete_a_project**: Deletes an existing project in your organization. This action is permanent and will remove all associated environments and deployments.
210
+
201
211
  #### Environment Management
202
212
 
203
213
  - **get_environments**: Retrieves environment configurations with comprehensive details including build settings, deployment information, password protection, and recent commits using cursor-based pagination. Returns empty commits if the project was created by file upload and not connected to GitHub.
214
+ - **get_all_environments**: Fetches the list of all environments in a project with pagination support. Returns environment details including build settings, Git branch configuration, and domain information.
215
+ - **get_an_environment**: Fetches a specific environment from a project using the project UID and environment UID. Returns comprehensive environment details including build configuration, domains, and settings.
216
+ - **create_an_environment**: Creates a new environment in your Launch project. For Git Provider projects, specify the Git branch. For File Upload projects, first get a signed upload URL and upload your ZIP file (valid for 10 minutes).
217
+ - **update_an_environment**: Updates an existing environment in your project. Allows modification of build settings, Git branch, environment variables, password protection, and feature flags.
218
+ - **delete_an_environment**: Deletes an existing environment in your project. This action is permanent and will remove all associated deployments.
204
219
 
205
220
  #### Deploy Hook Management
206
221
 
@@ -213,7 +228,18 @@ The MCP server supports multiple API groups that can be used independently or to
213
228
  #### Deployment Management
214
229
 
215
230
  - **get_latest_live_deployment**: Retrieves the most recent live deployment for a specified environment or project. Returns comprehensive deployment details including build configuration, Git information, deployment status, and performance metrics.
231
+ - **get_all_deployments**: Fetches the list of all deployments within a specific environment with pagination support. Returns deployment details including build status, Git commit information, duration, and preview URLs.
232
+ - **get_deployment**: Retrieves a specific deployment from an environment using the project UID, environment UID, and deployment UID. Returns comprehensive deployment details including status, build information, and performance metrics.
216
233
  - **create_deployment**: Creates a new deployment for the specified environment. Initiates the build and deployment process using the latest commit from the environment's configured Git branch.
234
+ - **get_deployment_logs**: Fetches the deployment logs of a specific deployment. These logs provide detailed build and deployment information, helping track the build process and identify issues. Supports optional timestamp parameter for pagination.
235
+ - **get_server_logs**: Fetches the server logs of a specific deployment. These logs capture runtime information from deployed apps, helping monitor performance and debug runtime issues. Requires startTime and endTime parameters.
236
+
237
+ #### File Upload Management
238
+
239
+ - **get_signed_upload_url_project**: Fetches the signed URL where you must upload the ZIP file when creating a project via file upload. The signed URL is valid for 10 minutes. After getting this URL, upload your ZIP file, then use the uploadUid in the Create Project API.
240
+ - **get_signed_upload_url_environment**: Fetches the signed URL where you must upload the ZIP file when creating an environment via file upload. The signed URL is valid for 10 minutes. Only available for FILEUPLOAD projects.
241
+ - **get_signed_upload_url_deployment**: Retrieves the signed URL where you must upload the ZIP file when creating or redeploying a deployment via file upload. The signed URL is valid for 10 minutes. Only available for FILEUPLOAD projects.
242
+ - **get_signed_download_url_deployment**: Returns the signed URL to download the uploaded file from the latest deployment. The signed URL is valid for 15 minutes (900 seconds).
217
243
 
218
244
  #### Cache Management
219
245
 
package/dist/index.js CHANGED
@@ -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.4.0",
16
+ version: "0.5.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": "1.25.1",
49
+ "@modelcontextprotocol/sdk": "1.25.2",
50
50
  axios: "^1.13.2",
51
51
  dotenv: "^17.2.3",
52
52
  inquirer: "^13.1.0",
@@ -922,6 +922,16 @@ async function buildContentstackRequest(actionMapper, args, groupName, subgroupN
922
922
  }
923
923
  });
924
924
  }
925
+ const customHeaders = {};
926
+ if (actionMapper.headers) {
927
+ Object.entries(actionMapper.headers).forEach(
928
+ ([headerName, argName]) => {
929
+ if (args[argName] !== void 0) {
930
+ customHeaders[headerName] = args[argName];
931
+ }
932
+ }
933
+ );
934
+ }
925
935
  let body = void 0;
926
936
  if (actionMapper.body) {
927
937
  if (actionMapper.type === "complex") {
@@ -955,7 +965,8 @@ async function buildContentstackRequest(actionMapper, args, groupName, subgroupN
955
965
  url2,
956
966
  body,
957
967
  queryParams,
958
- options
968
+ options,
969
+ customHeaders
959
970
  );
960
971
  return returnObj;
961
972
  }
@@ -979,7 +990,8 @@ async function buildGraphQLRequest(actionMapper, args, groupName, subgroupName,
979
990
  actionMapper.apiUrl,
980
991
  graphqlBody,
981
992
  {},
982
- options
993
+ options,
994
+ {}
983
995
  );
984
996
  }
985
997
  function buildBodyPayload(schema, data) {
@@ -1039,7 +1051,7 @@ function buildBodyPayload(schema, data) {
1039
1051
  }
1040
1052
  return walk(schema).value;
1041
1053
  }
1042
- async function buildReturnValue(groupName, subgroupName, method, url2, data, queryParams, options) {
1054
+ async function buildReturnValue(groupName, subgroupName, method, url2, data, queryParams, options, customHeaders = {}) {
1043
1055
  if (!url2) {
1044
1056
  throw new Error("URL is required");
1045
1057
  }
@@ -1047,6 +1059,7 @@ async function buildReturnValue(groupName, subgroupName, method, url2, data, que
1047
1059
  apiKey,
1048
1060
  deliveryToken,
1049
1061
  brandKitUID,
1062
+ organizationUid,
1050
1063
  launchProjectId,
1051
1064
  personalizeProjectId,
1052
1065
  lyticsAccessToken,
@@ -1131,11 +1144,15 @@ async function buildReturnValue(groupName, subgroupName, method, url2, data, que
1131
1144
  if (!launchProjectId) {
1132
1145
  throw new Error("Launch Project ID is required for Launch API");
1133
1146
  }
1147
+ if (!organizationUid) {
1148
+ throw new Error("Organization UID is required for Launch API");
1149
+ }
1134
1150
  config.headers = {
1135
1151
  ...config.headers,
1136
1152
  "apollographql-client-name": "contentfly-client",
1137
1153
  "apollographql-client-version": "1.3",
1138
- "x-project-uid": launchProjectId
1154
+ "x-project-uid": launchProjectId,
1155
+ "x-organization-uid": organizationUid
1139
1156
  };
1140
1157
  }
1141
1158
  config.headers = {
@@ -1143,6 +1160,12 @@ async function buildReturnValue(groupName, subgroupName, method, url2, data, que
1143
1160
  ...oauthHeaders
1144
1161
  };
1145
1162
  }
1163
+ if (Object.keys(customHeaders).length > 0) {
1164
+ config.headers = {
1165
+ ...config.headers,
1166
+ ...customHeaders
1167
+ };
1168
+ }
1146
1169
  return config;
1147
1170
  }
1148
1171
 
@@ -1152,6 +1175,7 @@ var TOKEN_ARGS = {
1152
1175
  OAUTH: "--auth",
1153
1176
  DELIVERY: "--delivery-token",
1154
1177
  API_KEY: "--stack-api-key",
1178
+ ORGANIZATION_UID: "--organization-uid",
1155
1179
  BRAND_KIT_ID: "--brand-kit-id",
1156
1180
  LYTICS_ACCESS_TOKEN: "--lytics-access-token",
1157
1181
  PERSONALIZE_PROJECT_ID: "--personalize-project-id",
@@ -1343,6 +1367,7 @@ async function initializeMCP() {
1343
1367
  const apiKey = getArgValue(TOKEN_ARGS.API_KEY);
1344
1368
  const deliveryToken = getArgValue(TOKEN_ARGS.DELIVERY);
1345
1369
  const brandKitID = getArgValue(TOKEN_ARGS.BRAND_KIT_ID);
1370
+ const organizationUid = getArgValue(TOKEN_ARGS.ORGANIZATION_UID);
1346
1371
  const launchProjectId = getArgValue(TOKEN_ARGS.LAUNCH_PROJECT_ID);
1347
1372
  const personalizeProjectId = getArgValue(TOKEN_ARGS.PERSONALIZE_PROJECT_ID);
1348
1373
  const lyticsAccessToken = getArgValue(TOKEN_ARGS.LYTICS_ACCESS_TOKEN);
@@ -1362,6 +1387,9 @@ async function initializeMCP() {
1362
1387
  if (deliveryToken) {
1363
1388
  process.env.CONTENTSTACK_DELIVERY_TOKEN = deliveryToken;
1364
1389
  }
1390
+ if (organizationUid) {
1391
+ process.env.CONTENTSTACK_ORGANIZATION_UID = organizationUid;
1392
+ }
1365
1393
  if (lyticsAccessToken) {
1366
1394
  process.env.LYTICS_ACCESS_TOKEN = lyticsAccessToken;
1367
1395
  }
@@ -1389,6 +1417,7 @@ async function initializeMCP() {
1389
1417
  apiKey: process.env.CONTENTSTACK_API_KEY || "",
1390
1418
  deliveryToken: process.env.CONTENTSTACK_DELIVERY_TOKEN || "",
1391
1419
  brandKitUID: process.env.CONTENTSTACK_BRAND_KIT_ID || "",
1420
+ organizationUid: process.env.CONTENTSTACK_ORGANIZATION_UID || "",
1392
1421
  launchProjectId: process.env.CONTENTSTACK_LAUNCH_PROJECT_ID || "",
1393
1422
  lyticsAccessToken: process.env.LYTICS_ACCESS_TOKEN || "",
1394
1423
  personalizeProjectId: process.env.CONTENTSTACK_PERSONALIZE_PROJECT_ID || "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.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": "1.25.1",
36
+ "@modelcontextprotocol/sdk": "1.25.2",
37
37
  "axios": "^1.13.2",
38
38
  "dotenv": "^17.2.3",
39
39
  "inquirer": "^13.1.0",