@contentful/mcp-tools 0.2.0 → 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 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
  /**
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/${getVersion()}`
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/${getVersion()}`
79
+ "X-Contentful-User-Agent-Tool": `contentful-mcp/${config.mcpVersion}`
105
80
  }
106
81
  };
107
82
  return clientConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-tools",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",