@mcpcloud/runtime 0.12.4 → 0.15.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.
@@ -23,7 +23,18 @@
23
23
  * keep the two in step, and see `toolErrorsBuilder.test.ts`, which pins the
24
24
  * parts that must not drift.
25
25
  */
26
- import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
26
+ import type { CallToolResult } from '@modelcontextprotocol/server';
27
+ import type * as McpSdk from '@modelcontextprotocol/server';
28
+ /**
29
+ * The SDK's `inputRequired` builder, INJECTED rather than imported as a value.
30
+ *
31
+ * Typed off the SDK so the shape is exact, but reached only through a
32
+ * type-only import, which is erased. This module therefore stays free of any
33
+ * runtime dependency on the MCP SDK — it is the one place tool failures are
34
+ * classified, and keeping it importable without standing a server up is worth
35
+ * threading one parameter for.
36
+ */
37
+ export type InputRequiredBuilder = typeof McpSdk.inputRequired;
27
38
  export type ToolErrorClass =
28
39
  /** Arguments were rejected before the request left us. Fix the call, not the code. */
29
40
  'BINDING_MISUSE'
@@ -71,7 +82,7 @@ export declare function classifyToolError(error: unknown): ToolErrorMeta;
71
82
  * prompts). Swallowing it into an `isError` result would silently break
72
83
  * elicitation, so this check gates the catch below.
73
84
  *
74
- * Deliberately structural rather than `instanceof McpError`. Generated bundles
85
+ * Deliberately structural rather than `instanceof ProtocolError`. Generated bundles
75
86
  * throw this from the vendored `runtime/mcp-runtime.js`, which carries its own
76
87
  * copy of the SDK classes — an `instanceof` against the npm copy would be false
77
88
  * there, and elicitation would break silently in exactly the servers that use
@@ -88,6 +99,15 @@ export declare function mustRethrow(error: unknown): boolean;
88
99
  export declare function toToolErrorResult(error: unknown): CallToolResult;
89
100
  /**
90
101
  * Run a tool handler, converting a throw into a classified error result.
91
- * Elicitation errors pass straight through.
102
+ *
103
+ * URL elicitation is the one failure that must reach the client intact rather
104
+ * than becoming an `isError` result — the caller has to act on it. Which SHAPE
105
+ * it takes depends on the protocol era, and the two are incompatible: 2025
106
+ * clients expect the `-32042` error and 2026-07-28 clients cannot be sent one
107
+ * at all. Legacy (the default) rethrows exactly as before; modern converts to
108
+ * the `input_required` result the revision defines.
92
109
  */
93
- export declare function runToolHandler(invoke: () => Promise<CallToolResult>): Promise<CallToolResult>;
110
+ export declare function runToolHandler(invoke: () => Promise<CallToolResult>, options?: {
111
+ era?: 'legacy' | 'modern';
112
+ inputRequired?: InputRequiredBuilder;
113
+ }): Promise<CallToolResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpcloud/runtime",
3
- "version": "0.12.4",
3
+ "version": "0.15.0",
4
4
  "description": "MCPCloud generated-server runtime: transports, config, upstream auth/HTTP, validation, projection, and discovery for MCP servers built on MCPCloud.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -36,11 +36,12 @@
36
36
  "dependencies": {
37
37
  "@jitl/quickjs-ffi-types": "^0.32.0",
38
38
  "@metrichor/jmespath": "^0.3.1",
39
- "@modelcontextprotocol/sdk": "^1.29.0",
39
+ "@modelcontextprotocol/server": "^2.0.0",
40
40
  "quickjs-emscripten-core": "^0.32.0",
41
41
  "zod": "^4.4.3"
42
42
  },
43
43
  "devDependencies": {
44
+ "@modelcontextprotocol/client": "^2.0.0",
44
45
  "typescript": "^5.9.3",
45
46
  "vitest": "^3.2.4"
46
47
  },