@contentful/mcp-server 1.4.0 → 1.5.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.
@@ -55,6 +55,9 @@ export const MCP_INSTRUCTIONS = `You are a helpful assistant integrated with Con
55
55
  - Use transform_image for AI-powered image operations
56
56
  - Always verify entry existence before attempting to modify it
57
57
 
58
+ # Migration Strategies
59
+ - Use the space_to_space migration workflow to help a user when they want to migrate content from one space to another. Start this workflow by calling the start_space_to_space_migration tool.
60
+ - You do not need to fetch content types (ex. list_content_types tool) or entries (ex. search_entries tool) prior to starting the migration workflow. Once the user states they want to start the migration workflow, you simply need to call the start_space_to_space_migration tool.
58
61
 
59
62
  # Error Handling and Debugging
60
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/tools/context/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mPA8GmN,CAAC"}
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/tools/context/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mPAiHmN,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { registerSpaceToSpaceMigrationTools } from './space-to-space-migration/register.js';
2
+ export function registerJobs(server) {
3
+ registerSpaceToSpaceMigrationTools(server);
4
+ }
5
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/tools/jobs/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAE5F,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,kCAAkC,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,148 @@
1
+ import { z } from 'zod';
2
+ import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
3
+ import { BaseToolSchema } from '../../../utils/tools.js';
4
+ import { getDefaultClientConfig } from '../../../config/contentful.js';
5
+ import { EntryQuerySchema, AssetQuerySchema, } from '../../../types/querySchema.js';
6
+ import path from 'path';
7
+ import { createRequire } from 'module';
8
+ const require = createRequire(import.meta.url);
9
+ const contentfulExport = require('contentful-export');
10
+ export const ExportSpaceToolParams = BaseToolSchema.extend({
11
+ exportDir: z
12
+ .string()
13
+ .optional()
14
+ .describe('Directory to save the exported space data (optional, defaults to current directory)'),
15
+ saveFile: z
16
+ .boolean()
17
+ .optional()
18
+ .default(true)
19
+ .describe('Save the exported space data to a file'),
20
+ contentFile: z
21
+ .string()
22
+ .optional()
23
+ .describe('Custom filename for the exported space data (optional)'),
24
+ includeDrafts: z
25
+ .boolean()
26
+ .optional()
27
+ .default(false)
28
+ .describe('Include draft entries in the export'),
29
+ includeArchived: z
30
+ .boolean()
31
+ .optional()
32
+ .default(false)
33
+ .describe('Include archived entries in the export'),
34
+ skipContentModel: z
35
+ .boolean()
36
+ .optional()
37
+ .default(false)
38
+ .describe('Skip exporting content types'),
39
+ skipEditorInterfaces: z
40
+ .boolean()
41
+ .optional()
42
+ .default(false)
43
+ .describe('Skip exporting editor interfaces'),
44
+ skipContent: z
45
+ .boolean()
46
+ .optional()
47
+ .default(false)
48
+ .describe('Skip exporting entries and assets'),
49
+ skipRoles: z
50
+ .boolean()
51
+ .optional()
52
+ .default(false)
53
+ .describe('Skip exporting roles and permissions'),
54
+ skipTags: z
55
+ .boolean()
56
+ .optional()
57
+ .default(false)
58
+ .describe('Skip exporting tags'),
59
+ skipWebhooks: z
60
+ .boolean()
61
+ .optional()
62
+ .default(false)
63
+ .describe('Skip exporting webhooks'),
64
+ stripTags: z
65
+ .boolean()
66
+ .optional()
67
+ .default(false)
68
+ .describe('Untag assets and entries'),
69
+ contentOnly: z
70
+ .boolean()
71
+ .optional()
72
+ .default(false)
73
+ .describe('Only export assets and entries'),
74
+ queryEntries: EntryQuerySchema.optional().describe('Export only entries that match query parameters'),
75
+ queryAssets: AssetQuerySchema.optional().describe('Export only assets that match query parameters'),
76
+ downloadAssets: z
77
+ .boolean()
78
+ .optional()
79
+ .default(false)
80
+ .describe('Download actual asset files'),
81
+ maxAllowedLimit: z
82
+ .number()
83
+ .optional()
84
+ .default(1000)
85
+ .describe('Maximum number of items per request'),
86
+ deliveryToken: z
87
+ .string()
88
+ .optional()
89
+ .describe('CDA token to export only published content (excludes tags)'),
90
+ host: z.string().optional().describe('Management API host'),
91
+ hostDelivery: z.string().optional().describe('Delivery API host'),
92
+ proxy: z.string().optional().describe('HTTP/HTTPS proxy config'),
93
+ rawProxy: z
94
+ .boolean()
95
+ .optional()
96
+ .describe('Pass raw proxy config directly to Axios'),
97
+ headers: z
98
+ .record(z.string())
99
+ .optional()
100
+ .describe('Additional headers to include in requests'),
101
+ errorLogFile: z.string().optional().describe('Path to error log output file'),
102
+ useVerboseRenderer: z
103
+ .boolean()
104
+ .optional()
105
+ .describe('Line-by-line logging, useful for CI'),
106
+ config: z
107
+ .string()
108
+ .optional()
109
+ .describe('Path to a JSON config file with all options'),
110
+ });
111
+ async function tool(args) {
112
+ // Get management token from the same config used by other MCP tools
113
+ const clientConfig = getDefaultClientConfig();
114
+ const managementToken = clientConfig.accessToken;
115
+ if (!managementToken) {
116
+ throw new Error('Contentful management token is not configured');
117
+ }
118
+ // Consolidate args with defaults and additional required fields
119
+ const exportOptions = {
120
+ ...args,
121
+ managementToken,
122
+ environmentId: args.environmentId || 'master',
123
+ exportDir: args.exportDir || process.cwd(),
124
+ contentFile: args.contentFile || `contentful-export-${args.spaceId}.json`,
125
+ };
126
+ try {
127
+ const result = await contentfulExport(exportOptions);
128
+ const exportPath = path.join(exportOptions.exportDir, exportOptions.contentFile);
129
+ return createSuccessResponse('Space exported successfully', {
130
+ spaceId: args.spaceId,
131
+ environmentId: args.environmentId || 'master',
132
+ exportPath,
133
+ contentTypes: result.contentTypes?.length || 0,
134
+ entries: result.entries?.length || 0,
135
+ assets: result.assets?.length || 0,
136
+ locales: result.locales?.length || 0,
137
+ tags: result.tags?.length || 0,
138
+ webhooks: result.webhooks?.length || 0,
139
+ roles: result.roles?.length || 0,
140
+ editorInterfaces: result.editorInterfaces?.length || 0,
141
+ });
142
+ }
143
+ catch (error) {
144
+ throw new Error(`Failed to export space: ${error instanceof Error ? error.message : String(error)}`);
145
+ }
146
+ }
147
+ export const createExportSpaceTool = withErrorHandling(tool, 'Error exporting space');
148
+ //# sourceMappingURL=exportSpace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportSpace.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/exportSpace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,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AAY,EAAE,MAAM,IAAI,CAAC;YAC9C,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;YACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;YAClC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;YAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;YACtC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;YAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACpF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CACpD,IAAI,EACJ,uBAAuB,CACxB,CAAC"}
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
3
+ import { BaseToolSchema } from '../../../utils/tools.js';
4
+ import { createRequire } from 'module';
5
+ import { getDefaultClientConfig } from '../../../config/contentful.js';
6
+ const require = createRequire(import.meta.url);
7
+ const contentfulImport = require('contentful-import');
8
+ export const ImportSpaceToolParams = BaseToolSchema.extend({
9
+ contentFile: z
10
+ .string()
11
+ .optional()
12
+ .describe('Path to JSON file containing the content to import'),
13
+ content: z
14
+ .record(z.any())
15
+ .optional()
16
+ .describe('JS object containing import content (must match expected structure)'),
17
+ contentModelOnly: z
18
+ .boolean()
19
+ .optional()
20
+ .default(false)
21
+ .describe('Import only content types'),
22
+ skipContentModel: z
23
+ .boolean()
24
+ .optional()
25
+ .default(false)
26
+ .describe('Skip importing content types and locales'),
27
+ skipLocales: z
28
+ .boolean()
29
+ .optional()
30
+ .default(false)
31
+ .describe('Skip importing locales'),
32
+ skipContentUpdates: z
33
+ .boolean()
34
+ .optional()
35
+ .default(false)
36
+ .describe('Do not update existing content'),
37
+ skipContentPublishing: z
38
+ .boolean()
39
+ .optional()
40
+ .default(false)
41
+ .describe('Create but do not publish content'),
42
+ uploadAssets: z
43
+ .boolean()
44
+ .optional()
45
+ .default(false)
46
+ .describe('Upload asset files (requires assetsDirectory)'),
47
+ skipAssetUpdates: z
48
+ .boolean()
49
+ .optional()
50
+ .default(false)
51
+ .describe('Do not update existing assets'),
52
+ assetsDirectory: z
53
+ .string()
54
+ .optional()
55
+ .describe('Path to directory containing exported asset files'),
56
+ timeout: z
57
+ .number()
58
+ .optional()
59
+ .default(3000)
60
+ .describe('Time between retries during asset processing (ms)'),
61
+ retryLimit: z
62
+ .number()
63
+ .optional()
64
+ .default(10)
65
+ .describe('Max retries for asset processing'),
66
+ host: z.string().optional().describe('Management API host'),
67
+ proxy: z
68
+ .string()
69
+ .optional()
70
+ .describe('HTTP/HTTPS proxy string (host:port or user:pass@host:port)'),
71
+ rawProxy: z
72
+ .boolean()
73
+ .optional()
74
+ .describe('Pass proxy config directly to Axios'),
75
+ rateLimit: z
76
+ .number()
77
+ .optional()
78
+ .default(7)
79
+ .describe('Max requests per second to the API'),
80
+ headers: z
81
+ .record(z.any())
82
+ .optional()
83
+ .describe('Additional headers to attach to requests'),
84
+ errorLogFile: z.string().optional().describe('Path to error log file'),
85
+ useVerboseRenderer: z
86
+ .boolean()
87
+ .optional()
88
+ .describe('Line-by-line progress output (good for CI)'),
89
+ config: z
90
+ .string()
91
+ .optional()
92
+ .describe('Path to config JSON file (merged with CLI args)'),
93
+ });
94
+ // Get management token from the same config used by other MCP tools
95
+ const clientConfig = getDefaultClientConfig();
96
+ const managementToken = clientConfig.accessToken;
97
+ if (!managementToken) {
98
+ throw new Error('Contentful management token is not configured');
99
+ }
100
+ async function tool(args) {
101
+ // Consolidate args with defaults and additional required fields
102
+ const importOptions = {
103
+ ...args,
104
+ managementToken,
105
+ environmentId: args.environmentId || 'master',
106
+ };
107
+ try {
108
+ const result = await contentfulImport(importOptions);
109
+ return createSuccessResponse('Space imported successfully', {
110
+ spaceId: args.spaceId,
111
+ environmentId: args.environmentId || 'master',
112
+ contentTypes: result.contentTypes?.length || 0,
113
+ entries: result.entries?.length || 0,
114
+ assets: result.assets?.length || 0,
115
+ locales: result.locales?.length || 0,
116
+ tags: result.tags?.length || 0,
117
+ webhooks: result.webhooks?.length || 0,
118
+ roles: result.roles?.length || 0,
119
+ editorInterfaces: result.editorInterfaces?.length || 0,
120
+ });
121
+ }
122
+ catch (error) {
123
+ throw new Error(`Failed to import space: ${error instanceof Error ? error.message : String(error)}`);
124
+ }
125
+ }
126
+ export const createImportSpaceTool = withErrorHandling(tool, 'Error importing space');
127
+ //# sourceMappingURL=importSpace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importSpace.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/importSpace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,CAAC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can help with space to space migration.
3
+
4
+ You will be given a list of tools that can be used to migrate a space to another space.
5
+
6
+ ## Workflow Management:
7
+ The space to space migration workflow is managed by a single unified tool: **space_to_space_migration_handler**
8
+
9
+ - To **start** the workflow: Call space_to_space_migration_handler with enableWorkflow=true
10
+ - To **conclude** the workflow: Call space_to_space_migration_handler with enableWorkflow=false
11
+
12
+ Once the workflow is started, you will need to call the tools in the following order:
13
+
14
+ 1. space_to_space_migration_handler with enableWorkflow=true (already confirmed by the user)
15
+ 2. IMPORTANT: After starting the workflow, you MUST ask the user for confirmation before proceeding to the next step. The enabled tools will not appear until the agent is reprompted by the user.
16
+ 3. space_to_space_param_collection (only call after user confirms they are ready to proceed)
17
+ 4. export_space
18
+ 5. import_space
19
+ 6. space_to_space_migration_handler with enableWorkflow=false (to conclude the workflow)
20
+
21
+ ## Path Configuration Best Practices:
22
+ - ALWAYS use consistent path formats throughout the workflow
23
+
24
+ ### Asset Handling Paths:
25
+ - When downloadAssets=true, the export tool creates an assets directory structure like: exportDir/images.ctfassets.net/
26
+ - The import tool expects assetsDirectory to point to the images.ctfassets.net directory, not the parent export directory
27
+
28
+ Troubleshooting:
29
+ - If the start_space_to_space_migration is not found, try to call it again on behalf of the user.
30
+ - If space_to_space_param_collection or other tools are not found, ask the user to confirm they are ready to proceed, as the tools need to be enabled first.
31
+ - If import fails with path errors, verify that exportDir and assetsDirectory paths are correctly aligned and accessible.
32
+ `;
33
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BzC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
3
+ import { BaseToolSchema } from '../../../utils/tools.js';
4
+ import { S2S_MIGRATION_INSTRUCTIONS } from './instructions.js';
5
+ export const S2S_TEARDOWN_INSTRUCTIONS = `
6
+ The space to space migration workflow has been concluded and all related tools have been disabled.
7
+
8
+ The workflow is now complete. You can start a new migration workflow by calling space_to_space_migration_handler with enableWorkflow=true if needed.
9
+ `;
10
+ export const SpaceToSpaceMigrationHandlerToolParams = BaseToolSchema.extend({
11
+ enableWorkflow: z
12
+ .boolean()
13
+ .describe('Set to true to enable the workflow tools, false to disable them and conclude the workflow'),
14
+ });
15
+ export const makeSpaceToSpaceMigrationHandlerTool = (tools) => {
16
+ async function tool(args) {
17
+ const { enableWorkflow } = args;
18
+ if (enableWorkflow) {
19
+ // Enable all workflow tools
20
+ tools.forEach((tool) => {
21
+ if (tool) {
22
+ tool.enable();
23
+ }
24
+ });
25
+ return createSuccessResponse('Space to space migration workflow started.', {
26
+ enableWorkflow,
27
+ instructions: S2S_MIGRATION_INSTRUCTIONS,
28
+ });
29
+ }
30
+ else {
31
+ // Disable all workflow tools (but not the handler itself)
32
+ tools.forEach((tool) => {
33
+ if (tool) {
34
+ tool.disable();
35
+ }
36
+ });
37
+ return createSuccessResponse('Space to space migration workflow concluded.', {
38
+ enableWorkflow,
39
+ instructions: S2S_TEARDOWN_INSTRUCTIONS,
40
+ });
41
+ }
42
+ }
43
+ return withErrorHandling(tool, 'Error managing space to space migration workflow');
44
+ };
45
+ //# sourceMappingURL=migrationHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrationHandler.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/migrationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;CAIxC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,cAAc,CAAC,MAAM,CAAC;IAC1E,cAAc,EAAE,CAAC;SACd,OAAO,EAAE;SACT,QAAQ,CACP,2FAA2F,CAC5F;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAClD,KAAuB,EACvB,EAAE;IACF,KAAK,UAAU,IAAI,CAAC,IAAY;QAC9B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAEhC,IAAI,cAAc,EAAE,CAAC;YACnB,4BAA4B;YAC5B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrB,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,qBAAqB,CAC1B,4CAA4C,EAC5C;gBACE,cAAc;gBACd,YAAY,EAAE,0BAA0B;aACzC,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,0DAA0D;YAC1D,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrB,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,qBAAqB,CAC1B,8CAA8C,EAC9C;gBACE,cAAc;gBACd,YAAY,EAAE,yBAAyB;aACxC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CACtB,IAAI,EACJ,kDAAkD,CACnD,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,156 @@
1
+ import { vi } from 'vitest';
2
+ /**
3
+ * Mock client for space-to-space migration tools
4
+ * Provides mocked contentful-export and contentful-import functions
5
+ */
6
+ // Mock the contentful-export function
7
+ export const mockContentfulExport = vi.fn();
8
+ // Mock the contentful-import function
9
+ export const mockContentfulImport = vi.fn();
10
+ // Mock export result data
11
+ export const mockExportResult = {
12
+ contentTypes: [
13
+ {
14
+ sys: { id: 'test-content-type', type: 'ContentType' },
15
+ name: 'Test Content Type',
16
+ fields: [],
17
+ },
18
+ ],
19
+ entries: [
20
+ {
21
+ sys: { id: 'test-entry', type: 'Entry' },
22
+ fields: { title: { 'en-US': 'Test Entry' } },
23
+ },
24
+ ],
25
+ assets: [
26
+ {
27
+ sys: { id: 'test-asset', type: 'Asset' },
28
+ fields: { title: { 'en-US': 'Test Asset' } },
29
+ },
30
+ ],
31
+ locales: [
32
+ {
33
+ sys: { id: 'en-US', type: 'Locale' },
34
+ code: 'en-US',
35
+ name: 'English (United States)',
36
+ default: true,
37
+ },
38
+ ],
39
+ tags: [
40
+ {
41
+ sys: { id: 'test-tag', type: 'Tag' },
42
+ name: 'Test Tag',
43
+ },
44
+ ],
45
+ webhooks: [],
46
+ roles: [],
47
+ editorInterfaces: [],
48
+ };
49
+ // Mock import result data
50
+ export const mockImportResult = {
51
+ contentTypes: [
52
+ {
53
+ sys: { id: 'imported-content-type', type: 'ContentType' },
54
+ name: 'Imported Content Type',
55
+ },
56
+ ],
57
+ entries: [
58
+ {
59
+ sys: { id: 'imported-entry', type: 'Entry' },
60
+ fields: { title: { 'en-US': 'Imported Entry' } },
61
+ },
62
+ ],
63
+ assets: [
64
+ {
65
+ sys: { id: 'imported-asset', type: 'Asset' },
66
+ fields: { title: { 'en-US': 'Imported Asset' } },
67
+ },
68
+ ],
69
+ locales: [
70
+ {
71
+ sys: { id: 'en-US', type: 'Locale' },
72
+ code: 'en-US',
73
+ name: 'English (United States)',
74
+ default: true,
75
+ },
76
+ ],
77
+ tags: [],
78
+ webhooks: [],
79
+ roles: [],
80
+ editorInterfaces: [],
81
+ };
82
+ /**
83
+ * Standard test arguments for space-to-space migration operations
84
+ */
85
+ export const mockArgs = {
86
+ spaceId: 'test-space-id',
87
+ environmentId: 'test-environment',
88
+ };
89
+ /**
90
+ * Helper function to create import test args with defaults
91
+ */
92
+ export const createImportTestArgs = (overrides = {}) => ({
93
+ spaceId: 'test-space-id',
94
+ environmentId: 'test-environment',
95
+ contentModelOnly: false,
96
+ skipContentModel: false,
97
+ skipLocales: false,
98
+ skipContentUpdates: false,
99
+ skipContentPublishing: false,
100
+ uploadAssets: false,
101
+ skipAssetUpdates: false,
102
+ timeout: 3000,
103
+ retryLimit: 10,
104
+ rateLimit: 7,
105
+ ...overrides,
106
+ });
107
+ /**
108
+ * Helper function to create export test args with defaults
109
+ */
110
+ export const createExportTestArgs = (overrides = {}) => ({
111
+ spaceId: 'test-space-id',
112
+ environmentId: 'test-environment',
113
+ saveFile: true,
114
+ includeDrafts: false,
115
+ includeArchived: false,
116
+ skipContentModel: false,
117
+ skipEditorInterfaces: false,
118
+ skipContent: false,
119
+ skipRoles: false,
120
+ skipTags: false,
121
+ skipWebhooks: false,
122
+ stripTags: false,
123
+ contentOnly: false,
124
+ downloadAssets: false,
125
+ maxAllowedLimit: 1000,
126
+ rawProxy: false,
127
+ useVerboseRenderer: false,
128
+ ...overrides,
129
+ });
130
+ /**
131
+ * Mock parameter collection arguments
132
+ */
133
+ export const mockParamCollectionArgs = {
134
+ ...mockArgs,
135
+ confirmation: false,
136
+ export: {
137
+ spaceId: 'source-space-id',
138
+ environmentId: 'master',
139
+ exportDir: '/test/export',
140
+ contentFile: 'export.json',
141
+ },
142
+ import: {
143
+ spaceId: 'target-space-id',
144
+ environmentId: 'master',
145
+ contentFile: '/test/export/export.json',
146
+ },
147
+ };
148
+ /**
149
+ * Mock migration handler arguments
150
+ */
151
+ export const mockMigrationHandlerArgs = {
152
+ spaceId: 'test-space-id',
153
+ environmentId: 'test-environment',
154
+ enableWorkflow: true,
155
+ };
156
+ //# sourceMappingURL=mockClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/mockClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE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E,IAAI;IACb,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,CAAC;IACZ,GAAG,SAAS;CACb,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,YAAqC,EAAE,EACvC,EAAE,CAAC,CAAC;IACJ,OAAO,EAAE,eAAe;IACxB,aAAa,EAAE,kBAAkB;IACjC,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,KAAK;IACpB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,KAAK;IAC3B,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,KAAK;IACf,kBAAkB,EAAE,KAAK;IACzB,GAAG,SAAS;CACb,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,GAAG,QAAQ;IACX,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE;QACN,OAAO,EAAE,iBAAiB;QAC1B,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,aAAa;KAC3B;IACD,MAAM,EAAE;QACN,OAAO,EAAE,iBAAiB;QAC1B,aAAa,EAAE,QAAQ;QACvB,WAAW,EAAE,0BAA0B;KACxC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,eAAe;IACxB,aAAa,EAAE,kBAAkB;IACjC,cAAc,EAAE,IAAI;CACrB,CAAC"}
@@ -0,0 +1,288 @@
1
+ import { z } from 'zod';
2
+ import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
3
+ import { BaseToolSchema } from '../../../utils/tools.js';
4
+ import { EntryQuerySchema, AssetQuerySchema, } from '../../../types/querySchema.js';
5
+ export const ParamCollectionToolParams = BaseToolSchema.extend({
6
+ confirmation: z
7
+ .boolean()
8
+ .optional()
9
+ .describe('User confirmation that they are ready to proceed with the workflow'),
10
+ export: z
11
+ .object({
12
+ spaceId: z
13
+ .string()
14
+ .optional()
15
+ .describe('ID of the space with source data'),
16
+ environmentId: z
17
+ .string()
18
+ .optional()
19
+ .describe('ID of the environment in the source space'),
20
+ deliveryToken: z
21
+ .string()
22
+ .optional()
23
+ .describe('CDA token to export only published content (excludes tags)'),
24
+ exportDir: z.string().optional().describe('Path to export JSON output'),
25
+ saveFile: z
26
+ .boolean()
27
+ .optional()
28
+ .describe('Save the export as a JSON file'),
29
+ contentFile: z.string().optional().describe('Filename for exported data'),
30
+ includeDrafts: z
31
+ .boolean()
32
+ .optional()
33
+ .describe('Include drafts in exported entries'),
34
+ includeArchived: z
35
+ .boolean()
36
+ .optional()
37
+ .describe('Include archived entries'),
38
+ skipContentModel: z
39
+ .boolean()
40
+ .optional()
41
+ .describe('Skip exporting content models'),
42
+ skipEditorInterfaces: z
43
+ .boolean()
44
+ .optional()
45
+ .describe('Skip exporting editor interfaces'),
46
+ skipContent: z
47
+ .boolean()
48
+ .optional()
49
+ .describe('Skip exporting entries and assets'),
50
+ skipRoles: z
51
+ .boolean()
52
+ .optional()
53
+ .describe('Skip exporting roles and permissions'),
54
+ skipTags: z.boolean().optional().describe('Skip exporting tags'),
55
+ skipWebhooks: z.boolean().optional().describe('Skip exporting webhooks'),
56
+ stripTags: z
57
+ .boolean()
58
+ .optional()
59
+ .describe('Remove tags from entries and assets'),
60
+ contentOnly: z
61
+ .boolean()
62
+ .optional()
63
+ .describe('Export only entries and assets'),
64
+ queryEntries: EntryQuerySchema.optional().describe('Export only entries that match query parameters'),
65
+ queryAssets: AssetQuerySchema.optional().describe('Export only assets that match query parameters'),
66
+ downloadAssets: z
67
+ .boolean()
68
+ .optional()
69
+ .describe('Download asset files to disk'),
70
+ host: z.string().optional().describe('Management API host'),
71
+ hostDelivery: z.string().optional().describe('Delivery API host'),
72
+ proxy: z.string().optional().describe('HTTP/HTTPS proxy config'),
73
+ rawProxy: z
74
+ .boolean()
75
+ .optional()
76
+ .describe('Pass raw proxy config directly to Axios'),
77
+ maxAllowedLimit: z.number().optional().describe('Page size for requests'),
78
+ headers: z
79
+ .record(z.any())
80
+ .optional()
81
+ .describe('Additional headers to include in requests'),
82
+ errorLogFile: z
83
+ .string()
84
+ .optional()
85
+ .describe('Path to error log output file'),
86
+ useVerboseRenderer: z
87
+ .boolean()
88
+ .optional()
89
+ .describe('Line-by-line logging, useful for CI'),
90
+ config: z
91
+ .string()
92
+ .optional()
93
+ .describe('Path to a JSON config file with all options'),
94
+ })
95
+ .optional(),
96
+ import: z
97
+ .object({
98
+ spaceId: z.string().optional().describe('ID of the space to import into'),
99
+ environmentId: z
100
+ .string()
101
+ .optional()
102
+ .describe('Target environment in destination space'),
103
+ contentFile: z
104
+ .string()
105
+ .optional()
106
+ .describe('Path to JSON file containing the content to import'),
107
+ content: z
108
+ .record(z.any())
109
+ .optional()
110
+ .describe('JS object containing import content (must match expected structure)'),
111
+ contentModelOnly: z
112
+ .boolean()
113
+ .optional()
114
+ .describe('Import only content types'),
115
+ skipContentModel: z
116
+ .boolean()
117
+ .optional()
118
+ .describe('Skip importing content types and locales'),
119
+ skipLocales: z.boolean().optional().describe('Skip importing locales'),
120
+ skipContentUpdates: z
121
+ .boolean()
122
+ .optional()
123
+ .describe('Do not update existing content'),
124
+ skipContentPublishing: z
125
+ .boolean()
126
+ .optional()
127
+ .describe('Create but do not publish content'),
128
+ uploadAssets: z
129
+ .boolean()
130
+ .optional()
131
+ .describe('Upload asset files (requires assetsDirectory)'),
132
+ skipAssetUpdates: z
133
+ .boolean()
134
+ .optional()
135
+ .describe('Do not update existing assets'),
136
+ assetsDirectory: z
137
+ .string()
138
+ .optional()
139
+ .describe('Path to directory containing exported asset files'),
140
+ timeout: z
141
+ .number()
142
+ .optional()
143
+ .describe('Time between retries during asset processing (ms)'),
144
+ retryLimit: z
145
+ .number()
146
+ .optional()
147
+ .describe('Max retries for asset processing'),
148
+ host: z.string().optional().describe('Management API host'),
149
+ proxy: z
150
+ .string()
151
+ .optional()
152
+ .describe('HTTP/HTTPS proxy string (host:port or user:pass@host:port)'),
153
+ rawProxy: z
154
+ .boolean()
155
+ .optional()
156
+ .describe('Pass proxy config directly to Axios'),
157
+ rateLimit: z
158
+ .number()
159
+ .optional()
160
+ .describe('Max requests per second to the API'),
161
+ headers: z
162
+ .record(z.any())
163
+ .optional()
164
+ .describe('Additional headers to attach to requests'),
165
+ errorLogFile: z.string().optional().describe('Path to error log file'),
166
+ useVerboseRenderer: z
167
+ .boolean()
168
+ .optional()
169
+ .describe('Line-by-line progress output (good for CI)'),
170
+ config: z
171
+ .string()
172
+ .optional()
173
+ .describe('Path to config JSON file (merged with CLI args)'),
174
+ })
175
+ .optional(),
176
+ });
177
+ const paramCollectionConfig = {
178
+ export: {
179
+ requiredParams: `
180
+ spaceId // [string] [required] - ID of the space with source data
181
+ `,
182
+ optionalParams: `
183
+ environmentId // [string] [default: 'master'] - ID of the environment in the source space
184
+ deliveryToken // [string] - CDA token to export only published content (excludes tags)
185
+
186
+ exportDir // [string] [default: process.cwd()] - Path to export JSON output
187
+ saveFile // [boolean] [default: true] - Save the export as a JSON file
188
+ contentFile // [string] - Filename for exported data
189
+
190
+ includeDrafts // [boolean] [default: false] - Include drafts in exported entries
191
+ includeArchived // [boolean] [default: false] - Include archived entries
192
+ skipContentModel // [boolean] [default: false] - Skip exporting content models
193
+ skipEditorInterfaces // [boolean] [default: false] - Skip exporting editor interfaces
194
+ skipContent // [boolean] [default: false] - Skip exporting entries and assets
195
+ skipRoles // [boolean] [default: false] - Skip exporting roles and permissions
196
+ skipTags // [boolean] [default: false] - Skip exporting tags
197
+ skipWebhooks // [boolean] [default: false] - Skip exporting webhooks
198
+ stripTags // [boolean] [default: false] - Remove tags from entries and assets
199
+ contentOnly // [boolean] [default: false] - Export only entries and assets
200
+
201
+ queryEntries // [array] - Export only entries that match query parameters
202
+ queryAssets // [array] - Export only assets that match query parameters
203
+ downloadAssets // [boolean] - Download asset files to disk
204
+
205
+ host // [string] [default: 'api.contentful.com'] - Management API host
206
+ hostDelivery // [string] [default: 'cdn.contentful.com'] - Delivery API host
207
+ proxy // [string] - HTTP/HTTPS proxy config
208
+ rawProxy // [boolean] - Pass raw proxy config directly to Axios
209
+ maxAllowedLimit // [number] [default: 1000] - Page size for requests
210
+ headers // [object] - Additional headers to include in requests
211
+
212
+ errorLogFile // [string] - Path to error log output file
213
+ useVerboseRenderer // [boolean] [default: false] - Line-by-line logging, useful for CI
214
+ config // [string] - Path to a JSON config file with all options
215
+ `,
216
+ },
217
+ import: {
218
+ requiredParams: `
219
+ spaceId // [string] [required] - ID of the space to import into
220
+ managementToken // [string] [required] - Contentful Management API token
221
+ `,
222
+ optionalParams: `
223
+ environmentId // [string] [default: 'master'] - Target environment in destination space
224
+ contentFile // [string] - Path to JSON file containing the content to import
225
+ content // [object] - JS object containing import content (must match expected structure)
226
+
227
+ contentModelOnly // [boolean] [default: false] - Import only content types
228
+ skipContentModel // [boolean] [default: false] - Skip importing content types and locales
229
+ skipLocales // [boolean] [default: false] - Skip importing locales
230
+ skipContentUpdates // [boolean] [default: false] - Do not update existing content
231
+ skipContentPublishing // [boolean] [default: false] - Create but do not publish content
232
+
233
+ uploadAssets // [boolean] [default: false] - Upload asset files (requires assetsDirectory)
234
+ skipAssetUpdates // [boolean] [default: false] - Do not update existing assets
235
+ assetsDirectory // [string] - Path to directory containing exported asset files
236
+ timeout // [number] [default: 3000] - Time between retries during asset processing (ms)
237
+ retryLimit // [number] [default: 10] - Max retries for asset processing
238
+
239
+ host // [string] [default: 'api.contentful.com'] - Management API host
240
+ proxy // [string] - HTTP/HTTPS proxy string (host:port or user:pass@host:port)
241
+ rawProxy // [boolean] - Pass proxy config directly to Axios
242
+ rateLimit // [number] [default: 7] - Max requests per second to the API
243
+ headers // [object] - Additional headers to attach to requests
244
+
245
+ errorLogFile // [string] - Path to error log file
246
+ useVerboseRenderer // [boolean] [default: false] - Line-by-line progress output (good for CI)
247
+ config // [string] - Path to config JSON file (merged with CLI args)
248
+ `,
249
+ },
250
+ };
251
+ async function tool(args) {
252
+ // Extract export and import parameters, filtering out undefined values
253
+ const exportParams = args.export
254
+ ? Object.fromEntries(Object.entries(args.export).filter(([, value]) => value !== undefined))
255
+ : {};
256
+ const importParams = args.import
257
+ ? Object.fromEntries(Object.entries(args.import).filter(([, value]) => value !== undefined))
258
+ : {};
259
+ const params = {
260
+ export: Object.keys(exportParams).length > 0 ? exportParams : undefined,
261
+ import: Object.keys(importParams).length > 0 ? importParams : undefined,
262
+ };
263
+ // If user has confirmed, return ready-to-proceed response
264
+ if (args.confirmation === true) {
265
+ return createSuccessResponse('User ready to proceed with workflow', {
266
+ message: 'User has confirmed they are ready to proceed with the space-to-space migration workflow.',
267
+ workflowParams: params,
268
+ nextStep: 'Proceed with the migration workflow using the collected parameters.',
269
+ });
270
+ }
271
+ // Otherwise, return parameter collection response
272
+ return createSuccessResponse('Param collection tool', {
273
+ instructions: `
274
+ Help the user collect the correct parameters for the space to space migration workflow.
275
+ Call this tool repeatedly until the user feels they are ready to start the workflow.
276
+
277
+ Help them understand the required and optional parameters for the export and import tools.
278
+ Help them understand the instructions for the export and import tools.
279
+ Help them understand the available params for the export and import tools, ensure you list at all the optional params not just the required ones.
280
+
281
+ Continue to build the parameters passed into this tool until the user passes a confirmation that they are ready to start the workflow.
282
+ `,
283
+ availableParams: paramCollectionConfig,
284
+ currentParams: params,
285
+ });
286
+ }
287
+ export const createParamCollectionTool = withErrorHandling(tool, 'Error creating param collection tool');
288
+ //# sourceMappingURL=paramCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paramCollection.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/paramCollection.ts"],"names":[],"mappings":"AAAA,OAAO,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AY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;QACvE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;KACxE,CAAC;IAEF,0DAA0D;IAC1D,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,qBAAqB,CAAC,qCAAqC,EAAE;YAClE,OAAO,EACL,0FAA0F;YAC5F,cAAc,EAAE,MAAM;YACtB,QAAQ,EACN,qEAAqE;SACxE,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,OAAO,qBAAqB,CAAC,uBAAuB,EAAE;QACpD,YAAY,EAAE;;;;;;;;;KASb;QACD,eAAe,EAAE,qBAAqB;QACtC,aAAa,EAAE,MAAM;KACtB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CACxD,IAAI,EACJ,sCAAsC,CACvC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { createExportSpaceTool, ExportSpaceToolParams } from './exportSpace.js';
2
+ import { ParamCollectionToolParams, createParamCollectionTool, } from './paramCollection.js';
3
+ import { ImportSpaceToolParams, createImportSpaceTool } from './importSpace.js';
4
+ import { SpaceToSpaceMigrationHandlerToolParams, makeSpaceToSpaceMigrationHandlerTool, } from './migrationHandler.js';
5
+ export function registerSpaceToSpaceMigrationTools(server) {
6
+ // Param collection tool
7
+ const paramCollectionTool = server.tool('space_to_space_param_collection', 'Collect parameters for the space to space migration workflow. This tool should ALWAYS start with confirmation false, until the user confirms they are ready to proceed with the workflow. Do not assume they use wants to proceed with the workflow until they explicitly say so.', ParamCollectionToolParams.shape, createParamCollectionTool);
8
+ // Export space tool
9
+ const exportSpaceTool = server.tool('export_space', 'Export a space to a file', ExportSpaceToolParams.shape, createExportSpaceTool);
10
+ // Import space tool
11
+ const importSpaceTool = server.tool('import_space', 'Import a space from a file. Step 4 of the space to space migration workflow.', ImportSpaceToolParams.shape, createImportSpaceTool);
12
+ // Create the unified migration handler tool
13
+ server.tool('space_to_space_migration_handler', 'Enable or disable the space to space migration workflow tools. Set enableWorkflow=true to start, false to conclude the workflow.', SpaceToSpaceMigrationHandlerToolParams.shape, makeSpaceToSpaceMigrationHandlerTool([
14
+ paramCollectionTool,
15
+ exportSpaceTool,
16
+ importSpaceTool,
17
+ ]));
18
+ // Disable all workflow tools by default (only the handler remains enabled)
19
+ paramCollectionTool.disable();
20
+ importSpaceTool.disable();
21
+ exportSpaceTool.disable();
22
+ }
23
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,UAAU,kCAAkC,CAAC,MAAiB;IAClE,wBAAwB;IACxB,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CACrC,iCAAiC,EACjC,mRAAmR,EACnR,yBAAyB,CAAC,KAAK,EAC/B,yBAAyB,CAC1B,CAAC;IAEF,oBAAoB;IACpB,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACjC,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,CAAC,KAAK,EAC3B,qBAAqB,CACtB,CAAC;IAEF,oBAAoB;IACpB,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACjC,cAAc,EACd,8EAA8E,EAC9E,qBAAqB,CAAC,KAAK,EAC3B,qBAAqB,CACtB,CAAC;IAEF,4CAA4C;IAC5C,MAAM,CAAC,IAAI,CACT,kCAAkC,EAClC,kIAAkI,EAClI,sCAAsC,CAAC,KAAK,EAC5C,oCAAoC,CAAC;QACnC,mBAAmB;QACnB,eAAe;QACf,eAAe;KAChB,CAAC,CACH,CAAC;IAEF,2EAA2E;IAC3E,mBAAmB,CAAC,OAAO,EAAE,CAAC;IAC9B,eAAe,CAAC,OAAO,EAAE,CAAC;IAC1B,eAAe,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC"}
@@ -7,6 +7,7 @@ import { registerSpaceTools } from './spaces/register.js';
7
7
  import { registerTagsTools } from './tags/register.js';
8
8
  import { registerAiActionsTools } from './ai-actions/register.js';
9
9
  import { registerLocaleTools } from './locales/register.js';
10
+ import { registerJobs } from './jobs/register.js';
10
11
  import { registerOrgTools } from './orgs/register.js';
11
12
  export function registerAllTools(server) {
12
13
  registerContextTools(server);
@@ -18,6 +19,7 @@ export function registerAllTools(server) {
18
19
  registerTagsTools(server);
19
20
  registerAiActionsTools(server);
20
21
  registerLocaleTools(server);
22
+ registerJobs(server);
21
23
  registerOrgTools(server);
22
24
  }
23
25
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/tools/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,E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,oBAAoB,CAAC;AAEtD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shared query schema for entries - used by searchEntries, exportSpace, etc.
4
+ */
5
+ export const EntryQuerySchema = z.object({
6
+ content_type: z.string().optional().describe('Filter by content type'),
7
+ include: z
8
+ .number()
9
+ .optional()
10
+ .describe('Include this many levels of linked entries'),
11
+ select: z
12
+ .string()
13
+ .optional()
14
+ .describe('Comma-separated list of fields to return'),
15
+ links_to_entry: z
16
+ .string()
17
+ .optional()
18
+ .describe('Find entries that link to the specified entry ID'),
19
+ limit: z.number().optional().describe('Maximum number of entries to return'),
20
+ skip: z.number().optional().describe('Skip this many entries'),
21
+ order: z.string().optional().describe('Order entries by this field'),
22
+ });
23
+ /**
24
+ * Shared query schema for assets - used by listAssets, exportSpace, etc.
25
+ */
26
+ export const AssetQuerySchema = z.object({
27
+ mimetype_group: z.string().optional().describe('Filter by MIME type group'),
28
+ select: z
29
+ .string()
30
+ .optional()
31
+ .describe('Comma-separated list of fields to return'),
32
+ limit: z.number().optional().describe('Maximum number of assets to return'),
33
+ skip: z.number().optional().describe('Skip this many assets'),
34
+ order: z.string().optional().describe('Order assets by this field'),
35
+ });
36
+ //# s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CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CACpE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-server",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/contentful/contentful-mcp-server"
@@ -35,7 +35,9 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@modelcontextprotocol/sdk": "^1.17.0",
38
+ "contentful-export": "^7.21.78",
38
39
  "contentful-management": "^11.54.3",
40
+ "contentful-import": "^9.4.111",
39
41
  "dotenv": "^16.4.7",
40
42
  "fast-xml-parser": "^5.2.5",
41
43
  "get-it": "^8.6.10",
@@ -50,7 +52,8 @@
50
52
  "@modelcontextprotocol/inspector": "0.16.2",
51
53
  "@nx/js": "^21.3.6",
52
54
  "@types/node": "^22.16.5",
53
- "@typescript-eslint/eslint-plugin": "^8.38.0",
55
+ "@typescript-eslint/eslint-plugin": "^8.42.0",
56
+ "eslint": "^9.35.0",
54
57
  "eslint-plugin-simple-import-sort": "^12.1.1",
55
58
  "eslint-plugin-unused-imports": "^4.1.4",
56
59
  "husky": "^9.1.7",