@contentful/mcp-tools 0.1.2 → 0.2.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/dist/index.d.ts CHANGED
@@ -4188,23 +4188,71 @@ declare class ContentfulMcpTools {
4188
4188
  limit: zod.ZodOptional<zod.ZodNumber>;
4189
4189
  skip: zod.ZodOptional<zod.ZodNumber>;
4190
4190
  order: zod.ZodOptional<zod.ZodString>;
4191
- }, "strip", zod.ZodTypeAny, {
4192
- skip?: number | undefined;
4193
- limit?: number | undefined;
4194
- select?: string | undefined;
4195
- include?: number | undefined;
4196
- order?: string | undefined;
4197
- links_to_entry?: string | undefined;
4198
- content_type?: string | undefined;
4199
- }, {
4200
- skip?: number | undefined;
4201
- limit?: number | undefined;
4202
- select?: string | undefined;
4203
- include?: number | undefined;
4204
- order?: string | undefined;
4205
- links_to_entry?: string | undefined;
4206
- content_type?: string | undefined;
4207
- }>;
4191
+ query: zod.ZodOptional<zod.ZodString>;
4192
+ 'fields.title': zod.ZodOptional<zod.ZodString>;
4193
+ 'fields.slug': zod.ZodOptional<zod.ZodString>;
4194
+ 'fields.internalName': zod.ZodOptional<zod.ZodString>;
4195
+ 'fields.text': zod.ZodOptional<zod.ZodString>;
4196
+ 'fields.title[match]': zod.ZodOptional<zod.ZodString>;
4197
+ 'fields.slug[match]': zod.ZodOptional<zod.ZodString>;
4198
+ 'fields.title[exists]': zod.ZodOptional<zod.ZodBoolean>;
4199
+ 'fields.slug[exists]': zod.ZodOptional<zod.ZodBoolean>;
4200
+ 'sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4201
+ 'sys.contentType.sys.id': zod.ZodOptional<zod.ZodString>;
4202
+ 'sys.createdAt[gte]': zod.ZodOptional<zod.ZodString>;
4203
+ 'sys.createdAt[lte]': zod.ZodOptional<zod.ZodString>;
4204
+ 'sys.updatedAt[gte]': zod.ZodOptional<zod.ZodString>;
4205
+ 'sys.updatedAt[lte]': zod.ZodOptional<zod.ZodString>;
4206
+ 'metadata.tags.sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4207
+ }, "strip", zod.ZodAny, zod.objectOutputType<{
4208
+ content_type: zod.ZodOptional<zod.ZodString>;
4209
+ include: zod.ZodOptional<zod.ZodNumber>;
4210
+ select: zod.ZodOptional<zod.ZodString>;
4211
+ links_to_entry: zod.ZodOptional<zod.ZodString>;
4212
+ limit: zod.ZodOptional<zod.ZodNumber>;
4213
+ skip: zod.ZodOptional<zod.ZodNumber>;
4214
+ order: zod.ZodOptional<zod.ZodString>;
4215
+ query: zod.ZodOptional<zod.ZodString>;
4216
+ 'fields.title': zod.ZodOptional<zod.ZodString>;
4217
+ 'fields.slug': zod.ZodOptional<zod.ZodString>;
4218
+ 'fields.internalName': zod.ZodOptional<zod.ZodString>;
4219
+ 'fields.text': zod.ZodOptional<zod.ZodString>;
4220
+ 'fields.title[match]': zod.ZodOptional<zod.ZodString>;
4221
+ 'fields.slug[match]': zod.ZodOptional<zod.ZodString>;
4222
+ 'fields.title[exists]': zod.ZodOptional<zod.ZodBoolean>;
4223
+ 'fields.slug[exists]': zod.ZodOptional<zod.ZodBoolean>;
4224
+ 'sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4225
+ 'sys.contentType.sys.id': zod.ZodOptional<zod.ZodString>;
4226
+ 'sys.createdAt[gte]': zod.ZodOptional<zod.ZodString>;
4227
+ 'sys.createdAt[lte]': zod.ZodOptional<zod.ZodString>;
4228
+ 'sys.updatedAt[gte]': zod.ZodOptional<zod.ZodString>;
4229
+ 'sys.updatedAt[lte]': zod.ZodOptional<zod.ZodString>;
4230
+ 'metadata.tags.sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4231
+ }, zod.ZodAny, "strip">, zod.objectInputType<{
4232
+ content_type: zod.ZodOptional<zod.ZodString>;
4233
+ include: zod.ZodOptional<zod.ZodNumber>;
4234
+ select: zod.ZodOptional<zod.ZodString>;
4235
+ links_to_entry: zod.ZodOptional<zod.ZodString>;
4236
+ limit: zod.ZodOptional<zod.ZodNumber>;
4237
+ skip: zod.ZodOptional<zod.ZodNumber>;
4238
+ order: zod.ZodOptional<zod.ZodString>;
4239
+ query: zod.ZodOptional<zod.ZodString>;
4240
+ 'fields.title': zod.ZodOptional<zod.ZodString>;
4241
+ 'fields.slug': zod.ZodOptional<zod.ZodString>;
4242
+ 'fields.internalName': zod.ZodOptional<zod.ZodString>;
4243
+ 'fields.text': zod.ZodOptional<zod.ZodString>;
4244
+ 'fields.title[match]': zod.ZodOptional<zod.ZodString>;
4245
+ 'fields.slug[match]': zod.ZodOptional<zod.ZodString>;
4246
+ 'fields.title[exists]': zod.ZodOptional<zod.ZodBoolean>;
4247
+ 'fields.slug[exists]': zod.ZodOptional<zod.ZodBoolean>;
4248
+ 'sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4249
+ 'sys.contentType.sys.id': zod.ZodOptional<zod.ZodString>;
4250
+ 'sys.createdAt[gte]': zod.ZodOptional<zod.ZodString>;
4251
+ 'sys.createdAt[lte]': zod.ZodOptional<zod.ZodString>;
4252
+ 'sys.updatedAt[gte]': zod.ZodOptional<zod.ZodString>;
4253
+ 'sys.updatedAt[lte]': zod.ZodOptional<zod.ZodString>;
4254
+ 'metadata.tags.sys.id[in]': zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
4255
+ }, zod.ZodAny, "strip">>;
4208
4256
  };
4209
4257
  annotations: {
4210
4258
  readOnlyHint: boolean;
@@ -4219,8 +4267,26 @@ declare class ContentfulMcpTools {
4219
4267
  select?: string | undefined;
4220
4268
  include?: number | undefined;
4221
4269
  order?: string | undefined;
4270
+ query?: string | undefined;
4222
4271
  links_to_entry?: string | undefined;
4223
4272
  content_type?: string | undefined;
4273
+ 'fields.title'?: string | undefined;
4274
+ 'fields.slug'?: string | undefined;
4275
+ 'fields.internalName'?: string | undefined;
4276
+ 'fields.text'?: string | undefined;
4277
+ 'fields.title[match]'?: string | undefined;
4278
+ 'fields.slug[match]'?: string | undefined;
4279
+ 'fields.title[exists]'?: boolean | undefined;
4280
+ 'fields.slug[exists]'?: boolean | undefined;
4281
+ 'sys.id[in]'?: string[] | undefined;
4282
+ 'sys.contentType.sys.id'?: string | undefined;
4283
+ 'sys.createdAt[gte]'?: string | undefined;
4284
+ 'sys.createdAt[lte]'?: string | undefined;
4285
+ 'sys.updatedAt[gte]'?: string | undefined;
4286
+ 'sys.updatedAt[lte]'?: string | undefined;
4287
+ 'metadata.tags.sys.id[in]'?: string[] | undefined;
4288
+ } & {
4289
+ [k: string]: any;
4224
4290
  };
4225
4291
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
4226
4292
  };
@@ -4611,6 +4677,7 @@ declare class ContentfulMcpTools {
4611
4677
  } & {
4612
4678
  environmentId: zod.ZodString;
4613
4679
  name: zod.ZodString;
4680
+ sourceEnvironmentId: zod.ZodOptional<zod.ZodString>;
4614
4681
  };
4615
4682
  annotations: {
4616
4683
  readOnlyHint: boolean;
@@ -4622,6 +4689,7 @@ declare class ContentfulMcpTools {
4622
4689
  spaceId: string;
4623
4690
  environmentId: string;
4624
4691
  name: string;
4692
+ sourceEnvironmentId?: string | undefined;
4625
4693
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
4626
4694
  };
4627
4695
  listEnvironments: {
package/dist/index.js CHANGED
@@ -2181,16 +2181,48 @@ function createEditorInterfaceTools(config) {
2181
2181
 
2182
2182
  // src/tools/entries/searchEntries.ts
2183
2183
  import { z as z35 } from "zod";
2184
+
2185
+ // src/utils/limits.ts
2186
+ function searchLimit(userLimit) {
2187
+ return Math.min(userLimit || 10, 1e3);
2188
+ }
2189
+
2190
+ // src/tools/entries/searchEntries.ts
2184
2191
  var SearchEntriesToolParams = BaseToolSchema.extend({
2185
2192
  query: z35.object({
2193
+ // Core parameters (maintain backward compatibility)
2186
2194
  content_type: z35.string().optional().describe("Filter by content type"),
2187
2195
  include: z35.number().optional().describe("Include this many levels of linked entries"),
2188
2196
  select: z35.string().optional().describe("Comma-separated list of fields to return"),
2189
2197
  links_to_entry: z35.string().optional().describe("Find entries that link to the specified entry ID"),
2190
- limit: z35.number().optional().describe("Maximum number of entries to return"),
2191
- skip: z35.number().optional().describe("Skip this many entries"),
2192
- order: z35.string().optional().describe("Order entries by this field")
2193
- })
2198
+ limit: z35.number().optional().describe(
2199
+ "Maximum number of entries to return (default: 10, max: 100)"
2200
+ ),
2201
+ skip: z35.number().optional().describe("Skip this many entries for pagination"),
2202
+ order: z35.string().optional().describe("Order entries by this field"),
2203
+ // Full-text search
2204
+ query: z35.string().optional().describe("Full-text search across all fields"),
2205
+ // Common field-based searches (examples - any field is supported via catchall)
2206
+ "fields.title": z35.string().optional().describe("Search by title field"),
2207
+ "fields.slug": z35.string().optional().describe("Search by slug field"),
2208
+ "fields.internalName": z35.string().optional().describe("Search by internal name field"),
2209
+ "fields.text": z35.string().optional().describe("Search by text field (useful for testimonials)"),
2210
+ "fields.title[match]": z35.string().optional().describe("Pattern match on title field"),
2211
+ "fields.slug[match]": z35.string().optional().describe("Pattern match on slug field"),
2212
+ "fields.title[exists]": z35.boolean().optional().describe("Check if title field exists"),
2213
+ "fields.slug[exists]": z35.boolean().optional().describe("Check if slug field exists"),
2214
+ // System field searches
2215
+ "sys.id[in]": z35.array(z35.string()).optional().describe("Search by multiple entry IDs"),
2216
+ "sys.contentType.sys.id": z35.string().optional().describe("Filter by content type ID"),
2217
+ "sys.createdAt[gte]": z35.string().optional().describe("Created after date (ISO format)"),
2218
+ "sys.createdAt[lte]": z35.string().optional().describe("Created before date (ISO format)"),
2219
+ "sys.updatedAt[gte]": z35.string().optional().describe("Updated after date (ISO format)"),
2220
+ "sys.updatedAt[lte]": z35.string().optional().describe("Updated before date (ISO format)"),
2221
+ // Metadata searches
2222
+ "metadata.tags.sys.id[in]": z35.array(z35.string()).optional().describe("Filter by tag IDs")
2223
+ }).catchall(z35.any()).describe(
2224
+ "Flexible search parameters supporting ANY Contentful API query parameter. Use fields.* for field searches, sys.* for system fields, and any other Contentful API parameter."
2225
+ )
2194
2226
  });
2195
2227
  function searchEntriesTool(config) {
2196
2228
  async function tool2(args) {
@@ -2203,12 +2235,12 @@ function searchEntriesTool(config) {
2203
2235
  ...params,
2204
2236
  query: {
2205
2237
  ...args.query,
2206
- limit: Math.min(args.query.limit || 3, 3),
2238
+ limit: searchLimit(args.query.limit),
2207
2239
  skip: args.query.skip || 0
2208
2240
  }
2209
2241
  });
2210
2242
  const summarized = summarizeData(entries, {
2211
- maxItems: 3,
2243
+ maxItems: searchLimit(args.query.limit),
2212
2244
  remainingMessage: "To see more entries, please ask me to retrieve the next page."
2213
2245
  });
2214
2246
  return createSuccessResponse("Entries retrieved successfully", {
@@ -2649,7 +2681,10 @@ function createEntryTools(config) {
2649
2681
  import { z as z44 } from "zod";
2650
2682
  var CreateEnvironmentToolParams = BaseToolSchema.extend({
2651
2683
  environmentId: z44.string().describe("The ID of the environment to create"),
2652
- name: z44.string().describe("The name of the environment to create")
2684
+ name: z44.string().describe("The name of the environment to create"),
2685
+ sourceEnvironmentId: z44.string().describe(
2686
+ "The ID of the source environment to clone from (defaults to master)"
2687
+ ).optional()
2653
2688
  });
2654
2689
  function createEnvironmentTool(config) {
2655
2690
  async function tool2(args) {
@@ -2661,7 +2696,8 @@ function createEnvironmentTool(config) {
2661
2696
  },
2662
2697
  {
2663
2698
  name: args.name
2664
- }
2699
+ },
2700
+ args.sourceEnvironmentId ? { "X-Contentful-Source-Environment": args.sourceEnvironmentId } : void 0
2665
2701
  );
2666
2702
  return createSuccessResponse("Environment created successfully", {
2667
2703
  environment
@@ -3517,12 +3553,12 @@ function updateConceptSchemeTool(config) {
3517
3553
  topConcepts: "/topConcepts"
3518
3554
  };
3519
3555
  const patchOperations = [];
3520
- Object.entries(fieldMappings).forEach(([field, path2]) => {
3556
+ Object.entries(fieldMappings).forEach(([field, path]) => {
3521
3557
  const value = args[field];
3522
3558
  if (value !== void 0) {
3523
3559
  patchOperations.push({
3524
3560
  op: "replace",
3525
- path: path2,
3561
+ path,
3526
3562
  value
3527
3563
  });
3528
3564
  }
@@ -4033,10 +4069,6 @@ var AssetQuerySchema = z69.object({
4033
4069
  });
4034
4070
 
4035
4071
  // src/tools/jobs/space-to-space-migration/exportSpace.ts
4036
- import path from "path";
4037
- import { createRequire } from "module";
4038
- var require2 = createRequire(import.meta.url);
4039
- var contentfulExport = require2("contentful-export");
4040
4072
  var ExportSpaceToolParams = BaseToolSchema.extend({
4041
4073
  exportDir: z70.string().optional().describe(
4042
4074
  "Directory to save the exported space data (optional, defaults to current directory)"
@@ -4086,7 +4118,9 @@ function createExportSpaceTool(config) {
4086
4118
  contentFile: args.contentFile || `contentful-export-${args.spaceId}.json`
4087
4119
  };
4088
4120
  try {
4089
- const result = await contentfulExport(exportOptions);
4121
+ const contentfulExport = await import("contentful-export");
4122
+ const path = await import("path");
4123
+ const result = await contentfulExport.default(exportOptions);
4090
4124
  const exportPath = path.join(
4091
4125
  exportOptions.exportDir,
4092
4126
  exportOptions.contentFile
@@ -4294,9 +4328,6 @@ var createParamCollectionTool = withErrorHandling(
4294
4328
 
4295
4329
  // src/tools/jobs/space-to-space-migration/importSpace.ts
4296
4330
  import { z as z72 } from "zod";
4297
- import { createRequire as createRequire2 } from "module";
4298
- var require3 = createRequire2(import.meta.url);
4299
- var contentfulImport = require3("contentful-import");
4300
4331
  var ImportSpaceToolParams = BaseToolSchema.extend({
4301
4332
  contentFile: z72.string().optional().describe("Path to JSON file containing the content to import"),
4302
4333
  content: z72.record(z72.any()).optional().describe(
@@ -4334,7 +4365,8 @@ function createImportSpaceTool(config) {
4334
4365
  environmentId: args.environmentId || "master"
4335
4366
  };
4336
4367
  try {
4337
- const result = await contentfulImport(importOptions);
4368
+ const contentfulImport = await import("contentful-import");
4369
+ const result = await contentfulImport.default(importOptions);
4338
4370
  return createSuccessResponse("Space imported successfully", {
4339
4371
  spaceId: args.spaceId,
4340
4372
  environmentId: args.environmentId || "master",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-tools",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -40,13 +40,13 @@
40
40
  "directory": "packages/mcp-tools"
41
41
  },
42
42
  "dependencies": {
43
+ "@contentful/rich-text-types": "^16.8.5",
43
44
  "@modelcontextprotocol/sdk": "^1.17.0",
44
45
  "contentful-export": "^7.21.78",
45
- "contentful-import": "^9.4.111",
46
+ "contentful-import": "^9.4.129",
46
47
  "contentful-management": "^11.54.3",
47
48
  "fast-xml-parser": "^5.2.5",
48
49
  "outdent": "^0.8.0",
49
- "@contentful/rich-text-types": "^16.8.5",
50
50
  "tsup": "^8.5.0",
51
51
  "vitest": "^3.2.4",
52
52
  "zod": "^3.25.76"