@contentful/mcp-tools 0.2.1 → 0.2.2
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 +6 -4
- package/dist/index.js +3 -28
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ interface ContentfulConfig {
|
|
|
51
51
|
organizationId?: string;
|
|
52
52
|
/** Contentful App ID */
|
|
53
53
|
appId?: string;
|
|
54
|
+
/** Version number to use for MCP tool calls */
|
|
55
|
+
mcpVersion: string;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/**
|
|
@@ -4188,7 +4190,7 @@ declare class ContentfulMcpTools {
|
|
|
4188
4190
|
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
4189
4191
|
skip: zod.ZodOptional<zod.ZodNumber>;
|
|
4190
4192
|
order: zod.ZodOptional<zod.ZodString>;
|
|
4191
|
-
|
|
4193
|
+
query: zod.ZodOptional<zod.ZodString>;
|
|
4192
4194
|
'fields.title': zod.ZodOptional<zod.ZodString>;
|
|
4193
4195
|
'fields.slug': zod.ZodOptional<zod.ZodString>;
|
|
4194
4196
|
'fields.internalName': zod.ZodOptional<zod.ZodString>;
|
|
@@ -4212,7 +4214,7 @@ declare class ContentfulMcpTools {
|
|
|
4212
4214
|
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
4213
4215
|
skip: zod.ZodOptional<zod.ZodNumber>;
|
|
4214
4216
|
order: zod.ZodOptional<zod.ZodString>;
|
|
4215
|
-
|
|
4217
|
+
query: zod.ZodOptional<zod.ZodString>;
|
|
4216
4218
|
'fields.title': zod.ZodOptional<zod.ZodString>;
|
|
4217
4219
|
'fields.slug': zod.ZodOptional<zod.ZodString>;
|
|
4218
4220
|
'fields.internalName': zod.ZodOptional<zod.ZodString>;
|
|
@@ -4236,7 +4238,7 @@ declare class ContentfulMcpTools {
|
|
|
4236
4238
|
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
4237
4239
|
skip: zod.ZodOptional<zod.ZodNumber>;
|
|
4238
4240
|
order: zod.ZodOptional<zod.ZodString>;
|
|
4239
|
-
|
|
4241
|
+
query: zod.ZodOptional<zod.ZodString>;
|
|
4240
4242
|
'fields.title': zod.ZodOptional<zod.ZodString>;
|
|
4241
4243
|
'fields.slug': zod.ZodOptional<zod.ZodString>;
|
|
4242
4244
|
'fields.internalName': zod.ZodOptional<zod.ZodString>;
|
|
@@ -4262,12 +4264,12 @@ declare class ContentfulMcpTools {
|
|
|
4262
4264
|
spaceId: string;
|
|
4263
4265
|
environmentId: string;
|
|
4264
4266
|
query: {
|
|
4265
|
-
match?: string | undefined;
|
|
4266
4267
|
skip?: number | undefined;
|
|
4267
4268
|
limit?: number | undefined;
|
|
4268
4269
|
select?: string | undefined;
|
|
4269
4270
|
include?: number | undefined;
|
|
4270
4271
|
order?: string | undefined;
|
|
4272
|
+
query?: string | undefined;
|
|
4271
4273
|
links_to_entry?: string | undefined;
|
|
4272
4274
|
content_type?: string | undefined;
|
|
4273
4275
|
'fields.title'?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -56,31 +56,6 @@ function withErrorHandling(handler, errorPrefix = "Error") {
|
|
|
56
56
|
// src/utils/tools.ts
|
|
57
57
|
import ctfl from "contentful-management";
|
|
58
58
|
import { z } from "zod";
|
|
59
|
-
|
|
60
|
-
// src/utils/getVersion.ts
|
|
61
|
-
import { readFileSync, existsSync } from "fs";
|
|
62
|
-
import { join } from "path";
|
|
63
|
-
import { fileURLToPath } from "url";
|
|
64
|
-
import { dirname } from "path";
|
|
65
|
-
var getVersion = () => {
|
|
66
|
-
const __filename2 = fileURLToPath(import.meta.url);
|
|
67
|
-
const __dirname2 = dirname(__filename2);
|
|
68
|
-
const possiblePaths = [
|
|
69
|
-
join(__dirname2, "../package.json"),
|
|
70
|
-
// For bundled code (dist/index.js -> package.json)
|
|
71
|
-
join(__dirname2, "../../package.json")
|
|
72
|
-
// For source code (src/utils/getVersion.ts -> package.json)
|
|
73
|
-
];
|
|
74
|
-
for (const packageJsonPath of possiblePaths) {
|
|
75
|
-
if (existsSync(packageJsonPath)) {
|
|
76
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
77
|
-
return packageJson.version;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
throw new Error("Could not find package.json");
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/utils/tools.ts
|
|
84
59
|
var BaseToolSchema = z.object({
|
|
85
60
|
spaceId: z.string().describe("The ID of the Contentful space"),
|
|
86
61
|
environmentId: z.string().describe("The ID of the Contentful environment")
|
|
@@ -91,7 +66,7 @@ function createToolClient(config, params) {
|
|
|
91
66
|
host: config.host ?? "api.contentful.com",
|
|
92
67
|
space: params.spaceId ?? config.spaceId,
|
|
93
68
|
headers: {
|
|
94
|
-
"X-Contentful-User-Agent-Tool": `contentful-mcp/${
|
|
69
|
+
"X-Contentful-User-Agent-Tool": `contentful-mcp/${config.mcpVersion}`
|
|
95
70
|
}
|
|
96
71
|
};
|
|
97
72
|
return ctfl.createClient(clientConfig, { type: "plain" });
|
|
@@ -101,7 +76,7 @@ function createClientConfig(config) {
|
|
|
101
76
|
accessToken: config.accessToken,
|
|
102
77
|
host: config.host ?? "api.contentful.com",
|
|
103
78
|
headers: {
|
|
104
|
-
"X-Contentful-User-Agent-Tool": `contentful-mcp/${
|
|
79
|
+
"X-Contentful-User-Agent-Tool": `contentful-mcp/${config.mcpVersion}`
|
|
105
80
|
}
|
|
106
81
|
};
|
|
107
82
|
return clientConfig;
|
|
@@ -2201,7 +2176,7 @@ var SearchEntriesToolParams = BaseToolSchema.extend({
|
|
|
2201
2176
|
skip: z35.number().optional().describe("Skip this many entries for pagination"),
|
|
2202
2177
|
order: z35.string().optional().describe("Order entries by this field"),
|
|
2203
2178
|
// Full-text search
|
|
2204
|
-
|
|
2179
|
+
query: z35.string().optional().describe("Full-text search across all fields"),
|
|
2205
2180
|
// Common field-based searches (examples - any field is supported via catchall)
|
|
2206
2181
|
"fields.title": z35.string().optional().describe("Search by title field"),
|
|
2207
2182
|
"fields.slug": z35.string().optional().describe("Search by slug field"),
|