@mapbox/mcp-server 0.8.1-dev.0 → 0.8.1-dev.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapbox/mcp-server",
3
- "version": "0.8.1-dev.0",
3
+ "version": "0.8.1-dev.1",
4
4
  "description": "Mapbox MCP server.",
5
5
  "mcpName": "io.github.mapbox/mcp-server",
6
6
  "main": "./dist/commonjs/index.js",
@@ -48,7 +48,6 @@
48
48
  "globals": "^16.3.0",
49
49
  "husky": "^9.0.0",
50
50
  "lint-staged": "^16.1.0",
51
- "patch-package": "^8.0.1",
52
51
  "plop": "^4.0.1",
53
52
  "prettier": "^3.0.0",
54
53
  "tshy": "^3.0.2",
@@ -64,7 +63,8 @@
64
63
  "node": ">=22"
65
64
  },
66
65
  "files": [
67
- "dist"
66
+ "dist",
67
+ "patches"
68
68
  ],
69
69
  "repository": {
70
70
  "type": "git",
@@ -85,6 +85,7 @@
85
85
  "@opentelemetry/sdk-node": "^0.56.0",
86
86
  "@opentelemetry/sdk-trace-base": "^1.30.1",
87
87
  "@opentelemetry/semantic-conventions": "^1.30.1",
88
+ "patch-package": "^8.0.1",
88
89
  "zod": "^3.25.42"
89
90
  },
90
91
  "tshy": {
@@ -0,0 +1,54 @@
1
+ diff --git a/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js b/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js
2
+ index 31819ff..ae95a35 100644
3
+ --- a/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js
4
+ +++ b/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js
5
+ @@ -100,12 +100,16 @@ class McpServer {
6
+ }
7
+ if (tool.outputSchema && !result.isError) {
8
+ if (!result.structuredContent) {
9
+ - throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Output validation error: Tool ${request.params.name} has an output schema but no structured content was provided`);
10
+ - }
11
+ - // if the tool has an output schema, validate structured content
12
+ - const parseResult = await tool.outputSchema.safeParseAsync(result.structuredContent);
13
+ - if (!parseResult.success) {
14
+ - throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${request.params.name}: ${parseResult.error.message}`);
15
+ + // Log warning but don't throw - allow tools to omit structured content
16
+ + console.warn(`[MCP SDK Patch] Output validation warning: Tool ${request.params.name} has an output schema but no structured content was provided`);
17
+ + } else {
18
+ + // if the tool has an output schema, validate structured content
19
+ + const parseResult = await tool.outputSchema.safeParseAsync(result.structuredContent);
20
+ + if (!parseResult.success) {
21
+ + // Log warning but don't throw - allow schema mismatches
22
+ + console.warn(`[MCP SDK Patch] Output validation warning: Invalid structured content for tool ${request.params.name}: ${parseResult.error.message}`);
23
+ + // Keep the structuredContent despite validation failure
24
+ + }
25
+ }
26
+ }
27
+ }
28
+ diff --git a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
29
+ index d5aadc5..b527424 100644
30
+ --- a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
31
+ +++ b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
32
+ @@ -97,12 +97,16 @@ export class McpServer {
33
+ }
34
+ if (tool.outputSchema && !result.isError) {
35
+ if (!result.structuredContent) {
36
+ - throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${request.params.name} has an output schema but no structured content was provided`);
37
+ - }
38
+ - // if the tool has an output schema, validate structured content
39
+ - const parseResult = await tool.outputSchema.safeParseAsync(result.structuredContent);
40
+ - if (!parseResult.success) {
41
+ - throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${request.params.name}: ${parseResult.error.message}`);
42
+ + // Log warning but don't throw - allow tools to omit structured content
43
+ + console.warn(`[MCP SDK Patch] Output validation warning: Tool ${request.params.name} has an output schema but no structured content was provided`);
44
+ + } else {
45
+ + // if the tool has an output schema, validate structured content
46
+ + const parseResult = await tool.outputSchema.safeParseAsync(result.structuredContent);
47
+ + if (!parseResult.success) {
48
+ + // Log warning but don't throw - allow schema mismatches
49
+ + console.warn(`[MCP SDK Patch] Output validation warning: Invalid structured content for tool ${request.params.name}: ${parseResult.error.message}`);
50
+ + // Keep the structuredContent despite validation failure
51
+ + }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,41 @@
1
+ # MCP SDK Patches
2
+
3
+ This directory contains patches for npm dependencies that are automatically applied after `npm install`.
4
+
5
+ ## @modelcontextprotocol/sdk
6
+
7
+ **File:** `@modelcontextprotocol+sdk+1.21.1.patch`
8
+
9
+ **Purpose:** Makes MCP output schema validation non-fatal to improve resilience and user experience.
10
+
11
+ **Problem:** The MCP SDK enforces strict output schema validation, which causes the entire tool call to fail when there are minor schema mismatches. This creates unnecessary risk and poor user experience - most MCP clients can gracefully handle responses that don't perfectly match the declared schema.
12
+
13
+ **Solution:** This patch modifies the MCP SDK to log warnings instead of throwing errors when output validation fails. This provides a better balance between:
14
+
15
+ - **Schema documentation** - Output schemas still serve as documentation for expected response structure
16
+ - **Resilience** - Tools continue working even with minor variations in response format
17
+ - **Observability** - Validation issues are logged for monitoring and debugging
18
+ - **User experience** - Clients receive the actual data instead of an error
19
+
20
+ **Benefits:**
21
+
22
+ - Prevents tool failures due to minor schema variations
23
+ - Allows graceful degradation when APIs evolve or return edge cases
24
+ - Maintains backward compatibility while improving reliability
25
+ - Clients that need strict validation can implement it themselves
26
+
27
+ **Changes:**
28
+
29
+ - Converts validation errors to console warnings with `[MCP SDK Patch]` prefix
30
+ - Allows tools to return structured content even when it doesn't match the schema exactly
31
+ - Preserves all existing functionality while removing unnecessary strictness
32
+
33
+ **Maintenance:**
34
+
35
+ - This patch is automatically applied after `npm install` via the `postinstall` script
36
+ - If the MCP SDK is updated, you may need to recreate this patch:
37
+ 1. Remove the old patch file
38
+ 2. Make the same modifications to the new SDK version
39
+ 3. Run `npx patch-package @modelcontextprotocol/sdk`
40
+
41
+ **Philosophy:** This patch follows the robustness principle: "Be conservative in what you send, be liberal in what you accept." Output schemas remain valuable for documentation and tooling, but shouldn't cause failures when the real-world data varies slightly from the ideal schema.