@contentful/mcp-tools 0.4.2 → 0.4.5

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/dist/index.d.ts CHANGED
@@ -57,6 +57,10 @@ interface ContentfulConfig {
57
57
  appId?: string;
58
58
  /** Version number to use for MCP tool calls */
59
59
  mcpVersion: string;
60
+ /** Contentful CDA token for exporting only published content */
61
+ deliveryToken?: string;
62
+ /** Contentful Delivery API host (used with deliveryToken for custom CDA endpoints) */
63
+ hostDelivery?: string;
60
64
  }
61
65
 
62
66
  /**
@@ -5982,11 +5986,11 @@ declare class ContentfulMcpTools {
5982
5986
  } | undefined;
5983
5987
  downloadAssets?: boolean | undefined;
5984
5988
  maxAllowedLimit?: number | undefined;
5989
+ errorLogFile?: string | undefined;
5990
+ useVerboseRenderer?: boolean | undefined;
5985
5991
  deliveryToken?: string | undefined;
5986
5992
  hostDelivery?: string | undefined;
5987
5993
  rawProxy?: boolean | undefined;
5988
- errorLogFile?: string | undefined;
5989
- useVerboseRenderer?: boolean | undefined;
5990
5994
  }, {
5991
5995
  config?: string | undefined;
5992
5996
  spaceId?: string | undefined;
@@ -6025,11 +6029,11 @@ declare class ContentfulMcpTools {
6025
6029
  } | undefined;
6026
6030
  downloadAssets?: boolean | undefined;
6027
6031
  maxAllowedLimit?: number | undefined;
6032
+ errorLogFile?: string | undefined;
6033
+ useVerboseRenderer?: boolean | undefined;
6028
6034
  deliveryToken?: string | undefined;
6029
6035
  hostDelivery?: string | undefined;
6030
6036
  rawProxy?: boolean | undefined;
6031
- errorLogFile?: string | undefined;
6032
- useVerboseRenderer?: boolean | undefined;
6033
6037
  }>>;
6034
6038
  import: zod.ZodOptional<zod.ZodObject<{
6035
6039
  spaceId: zod.ZodOptional<zod.ZodString>;
@@ -6066,9 +6070,9 @@ declare class ContentfulMcpTools {
6066
6070
  timeout?: number | undefined;
6067
6071
  contentFile?: string | undefined;
6068
6072
  skipContentModel?: boolean | undefined;
6069
- rawProxy?: boolean | undefined;
6070
6073
  errorLogFile?: string | undefined;
6071
6074
  useVerboseRenderer?: boolean | undefined;
6075
+ rawProxy?: boolean | undefined;
6072
6076
  contentModelOnly?: boolean | undefined;
6073
6077
  skipLocales?: boolean | undefined;
6074
6078
  skipContentUpdates?: boolean | undefined;
@@ -6089,9 +6093,9 @@ declare class ContentfulMcpTools {
6089
6093
  timeout?: number | undefined;
6090
6094
  contentFile?: string | undefined;
6091
6095
  skipContentModel?: boolean | undefined;
6092
- rawProxy?: boolean | undefined;
6093
6096
  errorLogFile?: string | undefined;
6094
6097
  useVerboseRenderer?: boolean | undefined;
6098
+ rawProxy?: boolean | undefined;
6095
6099
  contentModelOnly?: boolean | undefined;
6096
6100
  skipLocales?: boolean | undefined;
6097
6101
  skipContentUpdates?: boolean | undefined;
@@ -6148,11 +6152,11 @@ declare class ContentfulMcpTools {
6148
6152
  } | undefined;
6149
6153
  downloadAssets?: boolean | undefined;
6150
6154
  maxAllowedLimit?: number | undefined;
6155
+ errorLogFile?: string | undefined;
6156
+ useVerboseRenderer?: boolean | undefined;
6151
6157
  deliveryToken?: string | undefined;
6152
6158
  hostDelivery?: string | undefined;
6153
6159
  rawProxy?: boolean | undefined;
6154
- errorLogFile?: string | undefined;
6155
- useVerboseRenderer?: boolean | undefined;
6156
6160
  } | undefined;
6157
6161
  import?: {
6158
6162
  config?: string | undefined;
@@ -6166,9 +6170,9 @@ declare class ContentfulMcpTools {
6166
6170
  timeout?: number | undefined;
6167
6171
  contentFile?: string | undefined;
6168
6172
  skipContentModel?: boolean | undefined;
6169
- rawProxy?: boolean | undefined;
6170
6173
  errorLogFile?: string | undefined;
6171
6174
  useVerboseRenderer?: boolean | undefined;
6175
+ rawProxy?: boolean | undefined;
6172
6176
  contentModelOnly?: boolean | undefined;
6173
6177
  skipLocales?: boolean | undefined;
6174
6178
  skipContentUpdates?: boolean | undefined;
@@ -6246,15 +6250,8 @@ declare class ContentfulMcpTools {
6246
6250
  }>>;
6247
6251
  downloadAssets: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
6248
6252
  maxAllowedLimit: zod.ZodDefault<zod.ZodOptional<zod.ZodNumber>>;
6249
- deliveryToken: zod.ZodOptional<zod.ZodString>;
6250
- host: zod.ZodOptional<zod.ZodString>;
6251
- hostDelivery: zod.ZodOptional<zod.ZodString>;
6252
- proxy: zod.ZodOptional<zod.ZodString>;
6253
- rawProxy: zod.ZodOptional<zod.ZodBoolean>;
6254
- headers: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
6255
6253
  errorLogFile: zod.ZodOptional<zod.ZodString>;
6256
6254
  useVerboseRenderer: zod.ZodOptional<zod.ZodBoolean>;
6257
- config: zod.ZodOptional<zod.ZodString>;
6258
6255
  };
6259
6256
  annotations: {
6260
6257
  readOnlyHint: boolean;
@@ -6276,10 +6273,6 @@ declare class ContentfulMcpTools {
6276
6273
  contentOnly: boolean;
6277
6274
  downloadAssets: boolean;
6278
6275
  maxAllowedLimit: number;
6279
- config?: string | undefined;
6280
- host?: string | undefined;
6281
- proxy?: string | undefined;
6282
- headers?: Record<string, string> | undefined;
6283
6276
  exportDir?: string | undefined;
6284
6277
  contentFile?: string | undefined;
6285
6278
  queryEntries?: {
@@ -6298,9 +6291,6 @@ declare class ContentfulMcpTools {
6298
6291
  order?: string | undefined;
6299
6292
  mimetype_group?: string | undefined;
6300
6293
  } | undefined;
6301
- deliveryToken?: string | undefined;
6302
- hostDelivery?: string | undefined;
6303
- rawProxy?: boolean | undefined;
6304
6294
  errorLogFile?: string | undefined;
6305
6295
  useVerboseRenderer?: boolean | undefined;
6306
6296
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
@@ -6324,14 +6314,9 @@ declare class ContentfulMcpTools {
6324
6314
  assetsDirectory: zod.ZodOptional<zod.ZodString>;
6325
6315
  timeout: zod.ZodDefault<zod.ZodOptional<zod.ZodNumber>>;
6326
6316
  retryLimit: zod.ZodDefault<zod.ZodOptional<zod.ZodNumber>>;
6327
- host: zod.ZodOptional<zod.ZodString>;
6328
- proxy: zod.ZodOptional<zod.ZodString>;
6329
- rawProxy: zod.ZodOptional<zod.ZodBoolean>;
6330
6317
  rateLimit: zod.ZodDefault<zod.ZodOptional<zod.ZodNumber>>;
6331
- headers: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
6332
6318
  errorLogFile: zod.ZodOptional<zod.ZodString>;
6333
6319
  useVerboseRenderer: zod.ZodOptional<zod.ZodBoolean>;
6334
- config: zod.ZodOptional<zod.ZodString>;
6335
6320
  };
6336
6321
  annotations: {
6337
6322
  readOnlyHint: boolean;
@@ -6352,13 +6337,8 @@ declare class ContentfulMcpTools {
6352
6337
  uploadAssets: boolean;
6353
6338
  skipAssetUpdates: boolean;
6354
6339
  rateLimit: number;
6355
- config?: string | undefined;
6356
6340
  content?: Record<string, any> | undefined;
6357
- host?: string | undefined;
6358
- proxy?: string | undefined;
6359
- headers?: Record<string, any> | undefined;
6360
6341
  contentFile?: string | undefined;
6361
- rawProxy?: boolean | undefined;
6362
6342
  errorLogFile?: string | undefined;
6363
6343
  useVerboseRenderer?: boolean | undefined;
6364
6344
  assetsDirectory?: string | undefined;
package/dist/index.js CHANGED
@@ -2190,6 +2190,20 @@ function searchLimit(userLimit) {
2190
2190
  return Math.min(userLimit || 10, 1e3);
2191
2191
  }
2192
2192
 
2193
+ // src/utils/queryParams.ts
2194
+ function normalizeArrayFilters(query) {
2195
+ const normalized = {};
2196
+ let didConvert = false;
2197
+ for (const key of Object.keys(query)) {
2198
+ const value = query[key];
2199
+ if (Array.isArray(value)) {
2200
+ normalized[key] = value.join(",");
2201
+ didConvert = true;
2202
+ }
2203
+ }
2204
+ return didConvert ? { ...query, ...normalized } : query;
2205
+ }
2206
+
2193
2207
  // src/tools/entries/searchEntries.ts
2194
2208
  var SearchEntriesToolParams = BaseToolSchema.extend({
2195
2209
  query: z35.object({
@@ -2236,11 +2250,11 @@ function searchEntriesTool(config) {
2236
2250
  const contentfulClient = createToolClient(config, args);
2237
2251
  const entries = await contentfulClient.entry.getMany({
2238
2252
  ...params,
2239
- query: {
2253
+ query: normalizeArrayFilters({
2240
2254
  ...args.query,
2241
2255
  limit: searchLimit(args.query.limit),
2242
2256
  skip: args.query.skip || 0
2243
- }
2257
+ })
2244
2258
  });
2245
2259
  const summarized = summarizeData(entries, {
2246
2260
  maxItems: searchLimit(args.query.limit),
@@ -2951,12 +2965,14 @@ function createEnvironmentTool(config) {
2951
2965
  const environment = await contentfulClient.environment.createWithId(
2952
2966
  {
2953
2967
  spaceId: args.spaceId,
2954
- environmentId: args.environmentId
2968
+ environmentId: args.environmentId,
2969
+ ...args.sourceEnvironmentId && {
2970
+ sourceEnvironmentId: args.sourceEnvironmentId
2971
+ }
2955
2972
  },
2956
2973
  {
2957
2974
  name: args.name
2958
- },
2959
- args.sourceEnvironmentId ? { "X-Contentful-Source-Environment": args.sourceEnvironmentId } : void 0
2975
+ }
2960
2976
  );
2961
2977
  return createSuccessResponse("Environment created successfully", {
2962
2978
  environment
@@ -4378,15 +4394,8 @@ var ExportSpaceToolParams = BaseToolSchema.extend({
4378
4394
  ),
4379
4395
  downloadAssets: z72.boolean().optional().default(false).describe("Download actual asset files"),
4380
4396
  maxAllowedLimit: z72.number().optional().default(1e3).describe("Maximum number of items per request"),
4381
- deliveryToken: z72.string().optional().describe("CDA token to export only published content (excludes tags)"),
4382
- host: z72.string().optional().describe("Management API host"),
4383
- hostDelivery: z72.string().optional().describe("Delivery API host"),
4384
- proxy: z72.string().optional().describe("HTTP/HTTPS proxy config"),
4385
- rawProxy: z72.boolean().optional().describe("Pass raw proxy config directly to Axios"),
4386
- headers: z72.record(z72.string()).optional().describe("Additional headers to include in requests"),
4387
4397
  errorLogFile: z72.string().optional().describe("Path to error log output file"),
4388
- useVerboseRenderer: z72.boolean().optional().describe("Line-by-line logging, useful for CI"),
4389
- config: z72.string().optional().describe("Path to a JSON config file with all options")
4398
+ useVerboseRenderer: z72.boolean().optional().describe("Line-by-line logging, useful for CI")
4390
4399
  });
4391
4400
  function createExportSpaceTool(config) {
4392
4401
  async function tool2(args) {
@@ -4398,6 +4407,9 @@ function createExportSpaceTool(config) {
4398
4407
  const exportOptions = {
4399
4408
  ...args,
4400
4409
  managementToken,
4410
+ host: config.host ?? "api.contentful.com",
4411
+ ...config.deliveryToken && { deliveryToken: config.deliveryToken },
4412
+ ...config.hostDelivery && { hostDelivery: config.hostDelivery },
4401
4413
  environmentId: args.environmentId || "master",
4402
4414
  exportDir: args.exportDir || process.cwd(),
4403
4415
  contentFile: args.contentFile || `contentful-export-${args.spaceId}.json`
@@ -4628,14 +4640,9 @@ var ImportSpaceToolParams = BaseToolSchema.extend({
4628
4640
  assetsDirectory: z74.string().optional().describe("Path to directory containing exported asset files"),
4629
4641
  timeout: z74.number().optional().default(3e3).describe("Time between retries during asset processing (ms)"),
4630
4642
  retryLimit: z74.number().optional().default(10).describe("Max retries for asset processing"),
4631
- host: z74.string().optional().describe("Management API host"),
4632
- proxy: z74.string().optional().describe("HTTP/HTTPS proxy string (host:port or user:pass@host:port)"),
4633
- rawProxy: z74.boolean().optional().describe("Pass proxy config directly to Axios"),
4634
4643
  rateLimit: z74.number().optional().default(7).describe("Max requests per second to the API"),
4635
- headers: z74.record(z74.any()).optional().describe("Additional headers to attach to requests"),
4636
4644
  errorLogFile: z74.string().optional().describe("Path to error log file"),
4637
- useVerboseRenderer: z74.boolean().optional().describe("Line-by-line progress output (good for CI)"),
4638
- config: z74.string().optional().describe("Path to config JSON file (merged with CLI args)")
4645
+ useVerboseRenderer: z74.boolean().optional().describe("Line-by-line progress output (good for CI)")
4639
4646
  });
4640
4647
  function createImportSpaceTool(config) {
4641
4648
  async function tool2(args) {
@@ -4647,6 +4654,7 @@ function createImportSpaceTool(config) {
4647
4654
  const importOptions = {
4648
4655
  ...args,
4649
4656
  managementToken,
4657
+ host: config.host ?? "api.contentful.com",
4650
4658
  environmentId: args.environmentId || "master"
4651
4659
  };
4652
4660
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-tools",
3
- "version": "0.4.2",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",