mcpose 2.0.2 → 3.0.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.
Files changed (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +494 -37
  3. package/dist/backendClient.d.ts +5 -0
  4. package/dist/backendClient.d.ts.map +1 -1
  5. package/dist/backendClient.js +17 -9
  6. package/dist/backendClient.js.map +1 -1
  7. package/dist/core.d.ts +293 -28
  8. package/dist/core.d.ts.map +1 -1
  9. package/dist/core.js +969 -175
  10. package/dist/core.js.map +1 -1
  11. package/dist/delegation.d.ts +89 -0
  12. package/dist/delegation.d.ts.map +1 -0
  13. package/dist/delegation.js +175 -0
  14. package/dist/delegation.js.map +1 -0
  15. package/dist/eventStore.d.ts +12 -0
  16. package/dist/eventStore.d.ts.map +1 -1
  17. package/dist/eventStore.js +43 -5
  18. package/dist/eventStore.js.map +1 -1
  19. package/dist/hiddenTools.d.ts +42 -0
  20. package/dist/hiddenTools.d.ts.map +1 -0
  21. package/dist/hiddenTools.js +53 -0
  22. package/dist/hiddenTools.js.map +1 -0
  23. package/dist/index.d.ts +15 -6
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +7 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/mesh.d.ts +82 -0
  28. package/dist/mesh.d.ts.map +1 -0
  29. package/dist/mesh.js +141 -0
  30. package/dist/mesh.js.map +1 -0
  31. package/dist/middleware.d.ts +13 -0
  32. package/dist/middleware.d.ts.map +1 -1
  33. package/dist/middleware.js +27 -3
  34. package/dist/middleware.js.map +1 -1
  35. package/dist/proxyContext.d.ts +65 -5
  36. package/dist/proxyContext.d.ts.map +1 -1
  37. package/dist/proxyContext.js +39 -4
  38. package/dist/proxyContext.js.map +1 -1
  39. package/dist/rejection.d.ts +1 -1
  40. package/dist/rejection.d.ts.map +1 -1
  41. package/dist/rejection.js +1 -1
  42. package/dist/rejection.js.map +1 -1
  43. package/dist/sanitizeCatalog.d.ts +37 -0
  44. package/dist/sanitizeCatalog.d.ts.map +1 -0
  45. package/dist/sanitizeCatalog.js +86 -0
  46. package/dist/sanitizeCatalog.js.map +1 -0
  47. package/dist/sessionRegistry.d.ts +79 -0
  48. package/dist/sessionRegistry.d.ts.map +1 -0
  49. package/dist/sessionRegistry.js +83 -0
  50. package/dist/sessionRegistry.js.map +1 -0
  51. package/dist/telemetry.d.ts +29 -1
  52. package/dist/telemetry.d.ts.map +1 -1
  53. package/dist/testing.d.ts +18 -2
  54. package/dist/testing.d.ts.map +1 -1
  55. package/dist/testing.js +30 -8
  56. package/dist/testing.js.map +1 -1
  57. package/dist/version.d.ts +7 -0
  58. package/dist/version.d.ts.map +1 -0
  59. package/dist/version.js +7 -0
  60. package/dist/version.js.map +1 -0
  61. package/package.json +30 -14
  62. package/src/__tests__/_helpers.ts +64 -0
  63. package/src/__tests__/backendClient.test.ts +198 -0
  64. package/src/__tests__/core.delegation.test.ts +964 -0
  65. package/src/__tests__/core.edge.test.ts +314 -0
  66. package/src/__tests__/core.hiddenTools.predicate.test.ts +236 -0
  67. package/src/__tests__/core.localTools.test.ts +314 -0
  68. package/src/__tests__/core.mesh.test.ts +1182 -0
  69. package/src/__tests__/core.stripRequestMeta.test.ts +226 -0
  70. package/src/__tests__/core.stripResultMeta.test.ts +217 -0
  71. package/src/__tests__/core.test.ts +1019 -0
  72. package/src/__tests__/eventStore.test.ts +141 -0
  73. package/src/__tests__/mapToolResult.test.ts +101 -0
  74. package/src/__tests__/middleware.edge.test.ts +126 -0
  75. package/src/__tests__/middleware.test.ts +233 -0
  76. package/src/__tests__/proxyContext.test.ts +140 -0
  77. package/src/__tests__/sanitizeCatalog.test.ts +359 -0
  78. package/src/__tests__/startHttpProxy.lifecycle.test.ts +638 -0
  79. package/src/__tests__/startHttpProxy.registry.test.ts +409 -0
  80. package/src/__tests__/startHttpProxy.replay.test.ts +116 -0
  81. package/src/__tests__/startHttpProxy.security.test.ts +288 -0
  82. package/src/__tests__/startHttpProxy.test.ts +985 -0
  83. package/src/__tests__/testing.test.ts +250 -0
  84. package/src/__tests__/version.test.ts +12 -0
  85. package/src/backendClient.ts +83 -0
  86. package/src/core.ts +2042 -0
  87. package/src/delegation.ts +224 -0
  88. package/src/eventStore.ts +106 -0
  89. package/src/hiddenTools.ts +84 -0
  90. package/src/identity.ts +15 -0
  91. package/src/index.ts +63 -0
  92. package/src/mesh.ts +204 -0
  93. package/src/middleware.ts +101 -0
  94. package/src/proxyContext.ts +108 -0
  95. package/src/rejection.ts +37 -0
  96. package/src/sanitizeCatalog.ts +120 -0
  97. package/src/sessionRegistry.ts +142 -0
  98. package/src/telemetry.ts +46 -0
  99. package/src/testing.ts +174 -0
  100. package/src/version.ts +6 -0
@@ -2,6 +2,7 @@
2
2
  * Backend MCP client factory.
3
3
  * Modes: stdio (spawns child process) or HTTP/SSE (connects to running server).
4
4
  */
5
+ import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
5
6
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
6
7
  /** Backend connection config. */
7
8
  export interface BackendConfig {
@@ -11,6 +12,10 @@ export interface BackendConfig {
11
12
  args?: string[];
12
13
  /** HTTP/SSE URL of running backend. Takes precedence over stdio. */
13
14
  url?: string;
15
+ /** Custom HTTP headers sent on every request to the backend (HTTP/SSE only). */
16
+ headers?: Record<string, string>;
17
+ /** OAuth provdider for interactive/browser auth + transparent token refresh (HHT/SSE only). */
18
+ authProvider?: OAuthClientProvider;
14
19
  }
15
20
  export type BackendClient = Client;
16
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"backendClient.d.ts","sourceRoot":"","sources":["../src/backendClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAqBxB"}
1
+ {"version":3,"file":"backendClient.d.ts","sourceRoot":"","sources":["../src/backendClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AASnE,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,+FAA+F;IAC/F,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAyBxB"}
@@ -1,10 +1,7 @@
1
- /**
2
- * Backend MCP client factory.
3
- * Modes: stdio (spawns child process) or HTTP/SSE (connects to running server).
4
- */
5
1
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
6
2
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
7
- import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
3
+ import { StreamableHTTPClientTransport, } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
+ import { VERSION } from './version.js';
8
5
  /**
9
6
  * Creates and connects an MCP client to the backend.
10
7
  * @throws If neither `command` nor `url` provided, or connection fails.
@@ -13,21 +10,32 @@ export async function createBackendClient(config) {
13
10
  if (!config.command && !config.url) {
14
11
  throw new Error('mcpose: either command or url must be provided in BackendConfig');
15
12
  }
16
- const client = new Client({ name: 'mcpose-backend', version: '1.1.1' }, { capabilities: {} });
13
+ const client = new Client({ name: 'mcpose-backend', version: VERSION }, { capabilities: {} });
17
14
  const transport = config.url
18
- ? getHttpTransport(config.url)
15
+ ? getHttpTransport(config.url, config.headers, config.authProvider)
19
16
  : new StdioClientTransport({
20
17
  command: config.command,
21
18
  args: config.args ?? [],
22
19
  });
20
+ // The SDK's own transports are not assignable to its own `Transport`
21
+ // interface under `exactOptionalPropertyTypes` (the interface declares
22
+ // `sessionId?: string`, the implementations `sessionId: string | undefined`).
23
+ // Purely a declaration mismatch upstream — the value is a real Transport.
23
24
  await client.connect(transport);
24
25
  return client;
25
26
  }
26
- const getHttpTransport = (urlString) => {
27
+ const getHttpTransport = (urlString, headers, authProvider) => {
27
28
  const url = new URL(urlString);
28
29
  if (url.protocol !== 'http:' && url.protocol !== 'https:') {
29
30
  throw new Error(`mcpose: unsupported URL protocol "${url.protocol}" — only http: and https: are allowed`);
30
31
  }
31
- return new StreamableHTTPClientTransport(url);
32
+ const opts = {};
33
+ if (headers) {
34
+ opts.requestInit = { headers };
35
+ }
36
+ if (authProvider) {
37
+ opts.authProvider = authProvider;
38
+ }
39
+ return new StreamableHTTPClientTransport(url, opts);
32
40
  };
33
41
  //# sourceMappingURL=backendClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backendClient.js","sourceRoot":"","sources":["../src/backendClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAcnG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AAE,CAAC;IAC/D,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,WAAW,GAAG,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,YAAY,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,6BAA6B,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC"}
package/dist/core.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  import * as http from 'node:http';
2
2
  import * as https from 'node:https';
3
3
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
- import { type ListToolsRequest, type ListToolsResult, type CallToolRequest, type CallToolResult, type CompatibilityCallToolResult, type ReadResourceRequest, type ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
4
+ import { type ListToolsRequest, type ListToolsResult, type CallToolRequest, type CallToolRequestParams, type CallToolResult, type CompatibilityCallToolResult, type ContentBlock, type GetPromptRequest, type GetPromptResult, type TextContent, type ReadResourceRequest, type ReadResourceResult, type Tool } from '@modelcontextprotocol/sdk/types.js';
5
5
  import { type Middleware } from './middleware.js';
6
- import type { BackendClient } from './backendClient.js';
6
+ import type { HiddenToolPredicate } from './hiddenTools.js';
7
+ import { type ProxyContext } from './proxyContext.js';
7
8
  import type { Identity } from './identity.js';
8
9
  import type { TelemetryEvent } from './telemetry.js';
10
+ import { type Backends } from './mesh.js';
11
+ import { type SessionRegistry } from './sessionRegistry.js';
9
12
  import type { EventStore } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
10
- export type { ProxyContext } from './proxyContext.js';
11
13
  /**
12
14
  * Middleware for tool calls.
13
15
  * Uses `CompatibilityCallToolResult` to cover legacy `{ toolResult }` shape
@@ -16,30 +18,103 @@ export type { ProxyContext } from './proxyContext.js';
16
18
  export type ToolMiddleware = Middleware<CallToolRequest, CompatibilityCallToolResult>;
17
19
  /** Middleware for resource reads. */
18
20
  export type ResourceMiddleware = Middleware<ReadResourceRequest, ReadResourceResult>;
21
+ /** Middleware for prompt fetches (`prompts/get`). */
22
+ export type PromptMiddleware = Middleware<GetPromptRequest, GetPromptResult>;
19
23
  /** Middleware for tool-list responses. */
20
24
  export type ListToolsMiddleware = Middleware<ListToolsRequest, ListToolsResult>;
21
25
  /**
22
- * Narrows `CompatibilityCallToolResult` to `CallToolResult` (has `.content` array).
23
- * Both union members carry `[x: string]: unknown`, so this avoids unsafe casts.
26
+ * The result channels of a `CallToolResult` — everything a redaction or
27
+ * transform middleware must account for:
28
+ *
29
+ * 1. `content` blocks (text, image, audio, resource link, embedded
30
+ * resource), each carrying its own block-level `_meta`,
31
+ * 2. `structuredContent`, the machine-readable mirror of the content,
32
+ * 3. result-level `_meta`,
33
+ * 4. `isError`,
34
+ * 5. unknown extra keys via the index signature.
35
+ *
36
+ * Redaction that maps only `.content` misses 2, 3, and the non-text
37
+ * members of 1. Use {@link mapToolResult} to cover every payload channel
38
+ * by construction; channel 3 is stripped at the proxy boundary by default
39
+ * via `ProxyOptions.stripResultMeta` (ADR-0009).
40
+ *
41
+ * This guard narrows `CompatibilityCallToolResult` to `CallToolResult`
42
+ * (has `.content` array). Both union members carry `[x: string]: unknown`,
43
+ * so this avoids unsafe casts.
24
44
  */
25
45
  export declare function hasToolContent(r: CompatibilityCallToolResult): r is CallToolResult;
46
+ /**
47
+ * Handlers for {@link mapToolResult}, one per payload channel. All three
48
+ * are required, so forgetting a channel is a compile error rather than a
49
+ * silent leak.
50
+ */
51
+ export interface ToolResultHandlers {
52
+ /** Maps a text content block. Return `null` to drop the block. */
53
+ onText: (block: TextContent) => ContentBlock | null;
54
+ /**
55
+ * Maps a non-text content block (image, audio, resource link, embedded
56
+ * resource). Return `null` to drop the block.
57
+ */
58
+ onOther: (block: Exclude<ContentBlock, TextContent>) => ContentBlock | null;
59
+ /**
60
+ * Maps `structuredContent`. Called only when the field is present.
61
+ * Return `undefined` to remove the field entirely.
62
+ */
63
+ onStructured: (structured: Record<string, unknown>) => Record<string, unknown> | undefined;
64
+ }
65
+ /**
66
+ * Maps every payload channel of a tool result through the given handlers.
67
+ *
68
+ * The legacy `{ toolResult }` shape (protocol 2024-10-07) is returned
69
+ * untouched. `isError`, result-level `_meta`, and unknown extra keys are
70
+ * preserved by spread — result-level `_meta` needs no handler because the
71
+ * proxy strips it by default (`stripResultMeta`, ADR-0009); with
72
+ * `stripResultMeta: false` forwarding it is the consumer's explicit choice.
73
+ */
74
+ export declare function mapToolResult(result: CompatibilityCallToolResult, handlers: ToolResultHandlers): CompatibilityCallToolResult;
26
75
  /** HTTP transport options for {@link startHttpProxy}. */
27
76
  export interface HttpProxyOptions {
28
77
  /** Default: 3000 */
29
78
  port?: number;
30
- /** Default: all interfaces */
79
+ /**
80
+ * Bind address. Default: `'127.0.0.1'` (loopback).
81
+ *
82
+ * Binding a non-loopback address (e.g. `'0.0.0.0'`) exposes an
83
+ * unauthenticated MCP proxy holding an authenticated upstream session to
84
+ * the network, so it is a deliberate opt-in; doing so without
85
+ * {@link resolveIdentity} reports a startup warning through {@link onError}.
86
+ */
31
87
  host?: string;
32
88
  /** Default: '/mcp' */
33
89
  path?: string;
34
- /** Called for every incoming request before MCP handling. Return false to block (caller writes its own response). Throw to get a 401. */
90
+ /**
91
+ * Called for every incoming request before MCP handling. Return false to
92
+ * block (caller writes its own response). Throw to get a 401, with the error
93
+ * reported through {@link onError}.
94
+ */
35
95
  onRequest?: (req: http.IncomingMessage, res: http.ServerResponse) => boolean | Promise<boolean>;
36
- /** Called on unhandled errors instead of console.error. */
96
+ /**
97
+ * Called on unhandled errors instead of console.error, and on every auth
98
+ * hook that throws: the request still fails closed, and the operator still
99
+ * sees why.
100
+ */
37
101
  onError?: (err: unknown) => void;
38
102
  /** Maximum request body size in bytes. Default: 4 MB. */
39
103
  maxBodyBytes?: number;
40
- /** Maximum number of concurrent MCP sessions. Excess requests return 503. */
104
+ /**
105
+ * Maximum number of concurrent MCP sessions. Excess requests return 503.
106
+ * Default: 1000. Set to `Infinity` to opt out of the cap.
107
+ *
108
+ * `0` is a valid value and means "reject every session", so it is not the
109
+ * opt-out.
110
+ */
41
111
  maxSessions?: number;
42
- /** Session TTL in milliseconds. Sessions are closed after this duration. */
112
+ /**
113
+ * Session TTL in milliseconds. Sessions are closed after this duration,
114
+ * which fires {@link onSessionClosed}. Default: 30 minutes. Finite values
115
+ * must not exceed Node's maximum timer delay of 2,147,483,647 ms. Set to
116
+ * `Infinity` to opt out of the TTL.
117
+ */
43
118
  sessionTtlMs?: number;
44
119
  /**
45
120
  * Resolves caller identity from the initial session request.
@@ -48,7 +123,7 @@ export interface HttpProxyOptions {
48
123
  *
49
124
  * Supply a JWT extractor, mTLS cert reader, API-key lookup, or any async
50
125
  * function returning an {@link Identity}. Errors thrown here abort the
51
- * session with a 401.
126
+ * session with a 401 and are reported through {@link onError}.
52
127
  *
53
128
  * @example
54
129
  * resolveIdentity: extractJwtIdentity({ jwksUri: '...' })
@@ -73,21 +148,118 @@ export interface HttpProxyOptions {
73
148
  * (suitable for single-instance deployments). For multi-instance / HA
74
149
  * deployments, supply a Redis or Postgres-backed implementation.
75
150
  *
151
+ * Stream ids reach the store namespaced as `<sessionId>:<streamId>`, so
152
+ * one store serves every session without their replay histories mixing.
153
+ *
76
154
  * Set to `null` to disable reconnect replay entirely.
77
155
  */
78
156
  eventStore?: EventStore | null;
79
157
  /**
80
- * Called when a session is closed (client DELETE or TTL expiry).
81
- * Wire {@link AuditMiddlewareHandle.closeSession} here to flush the
82
- * ReplayManifest for the session.
158
+ * Shared record of live sessions, so a client can resume after a proxy
159
+ * restart or on another instance behind a load balancer. Without one,
160
+ * sessions live only in this process and a resume against a fresh process
161
+ * is a 404.
162
+ *
163
+ * A record is written before the initialize response goes out and read
164
+ * only for an `mcp-session-id` this instance does not hold; the resumed
165
+ * session negotiates what the original did, keeps its identity, and dies
166
+ * at the original deadline. Client DELETE and TTL expiry delete the
167
+ * record, server shutdown keeps it. Pair it with the matching
168
+ * {@link eventStore} adapter, or a resumed session has no replay history.
169
+ *
170
+ * @example
171
+ * sessionRegistry: createRedisSessionRegistry(redis),
172
+ * eventStore: createRedisEventStore(redis),
173
+ */
174
+ sessionRegistry?: SessionRegistry;
175
+ /**
176
+ * Called when a session is closed (client DELETE, TTL expiry, or server
177
+ * shutdown). Wire {@link AuditMiddlewareHandle.closeSession} here to flush
178
+ * the ReplayManifest for the session.
179
+ *
180
+ * A returned promise is awaited: `server.close()` does not complete until
181
+ * every session's hook has settled, so a host that exits in the close
182
+ * callback never loses a final manifest. A throw or a rejection is routed
183
+ * to {@link onError} and never breaks teardown.
83
184
  *
84
185
  * @example
85
186
  * onSessionClosed: (sessionId) => auditHandle.closeSession(sessionId)
86
187
  */
87
- onSessionClosed?: (sessionId: string) => void;
188
+ onSessionClosed?: (sessionId: string) => unknown;
189
+ /**
190
+ * Re-validates an existing session on every routed request. Return `false`
191
+ * (or throw, which is reported through {@link onError}) to reject with 401.
192
+ * Use to bind sessions to their original credential — e.g. re-check the
193
+ * bearer token — so a leaked `mcp-session-id` alone cannot take over a
194
+ * session.
195
+ */
196
+ validateSession?: (req: http.IncomingMessage, session: {
197
+ sessionId: string;
198
+ identity?: Identity;
199
+ }) => boolean | Promise<boolean>;
200
+ /**
201
+ * Hosts allowed in the `Host` header when
202
+ * {@link enableDnsRebindingProtection} is on. Forwarded to the SDK
203
+ * transport, which only validates against a non-empty list.
204
+ *
205
+ * Default: for a loopback bind, derived from the effective bind address
206
+ * and the real listening port (`127.0.0.1:<port>`, `localhost:<port>`,
207
+ * `[::1]:<port>`). An explicit value is used verbatim, never merged with
208
+ * the derived list. No list is derived for a non-loopback bind.
209
+ */
210
+ allowedHosts?: string[];
211
+ /**
212
+ * Origins allowed in the `Origin` header. Forwarded to the SDK transport,
213
+ * which only validates against a non-empty list.
214
+ *
215
+ * Default: for a loopback bind, the derived {@link allowedHosts} entries
216
+ * as origins (`http://` or `https://` matching {@link tlsOptions}). An
217
+ * explicit value is used verbatim, never merged.
218
+ */
219
+ allowedOrigins?: string[];
220
+ /**
221
+ * Enables the SDK transport's DNS-rebinding protection (Host/Origin
222
+ * checks). Default: `true` when the effective bind address is loopback,
223
+ * `false` otherwise (a non-loopback bind usually sits behind a gateway
224
+ * that rewrites `Host`).
225
+ *
226
+ * Enabling this on a non-loopback bind without explicit
227
+ * {@link allowedHosts} / {@link allowedOrigins} validates nothing and
228
+ * reports a startup warning through {@link onError}.
229
+ */
230
+ enableDnsRebindingProtection?: boolean;
231
+ }
232
+ /**
233
+ * A tool the proxy implements itself, instead of forwarding to the
234
+ * upstream. See ADR-0007.
235
+ */
236
+ export interface LocalTool {
237
+ /** The tool definition advertised in `tools/list`. */
238
+ tool: Tool;
239
+ /**
240
+ * Runs instead of the upstream call, from inside the innermost `next`,
241
+ * so the whole `toolMiddleware` pipeline (audit, redaction) still
242
+ * applies.
243
+ */
244
+ handler: (params: CallToolRequestParams, context: ProxyContext) => Promise<CallToolResult>;
88
245
  }
89
246
  /** Proxy server options. */
90
247
  export interface ProxyOptions {
248
+ /**
249
+ * Human-readable name for this proxy instance. Required, and rejected at
250
+ * construction when empty or whitespace-only.
251
+ *
252
+ * It is stamped onto every `ProxyContext`, every audit event, and the
253
+ * `ReplayManifest` as provenance (ADR-0012), so a default would record a
254
+ * whole fleet under one name: attribution in appearance only (#122).
255
+ */
256
+ name: string;
257
+ /**
258
+ * Version of this proxy server (yours, not the mcpose library). MCP clients see
259
+ * it in the `initialize` response. Defaults to the mcpose library version when
260
+ * omitted; set it to your own release version when you ship your proxy.
261
+ */
262
+ version?: string;
91
263
  /**
92
264
  * Tool middleware in response-processing order (first = innermost).
93
265
  * @example [piiMW, auditMW] // pii redacts first, audit logs clean data
@@ -95,20 +267,110 @@ export interface ProxyOptions {
95
267
  toolMiddleware?: ReadonlyArray<ToolMiddleware>;
96
268
  /** Resource middleware in response-processing order (first = innermost). */
97
269
  resourceMiddleware?: ReadonlyArray<ResourceMiddleware>;
270
+ /**
271
+ * Prompt middleware in response-processing order (first = innermost),
272
+ * per ADR-0002. Runs around every `prompts/get`, in both 1:1 and mesh
273
+ * mode.
274
+ *
275
+ * Mesh routing and the `BACKEND_UNROUTABLE` rejection for an unroutable
276
+ * prompt name happen inside the innermost `next` (the ADR-0007 pattern),
277
+ * so an observing middleware such as audit records every prompt call
278
+ * including the rejected ones.
279
+ *
280
+ * `prompts/list` has no pipeline yet; hiding and pass-through for prompts
281
+ * are deferred with it (ADR-0014).
282
+ */
283
+ promptMiddleware?: ReadonlyArray<PromptMiddleware>;
98
284
  /** Tool-list middleware in response-processing order (first = innermost). */
99
285
  listToolsMiddleware?: ReadonlyArray<ListToolsMiddleware>;
100
- /** Tools that skip middleware — upstream response forwarded as-is. */
286
+ /**
287
+ * Tools that skip transforming middleware — upstream response forwarded
288
+ * as-is. Middleware wrapped in `markPassThroughObserver()` (e.g. audit)
289
+ * still runs for these tools.
290
+ */
101
291
  passThroughTools?: ReadonlyArray<string>;
102
- /** Resources that skip middleware — upstream response forwarded as-is. */
292
+ /**
293
+ * Resources that skip middleware — upstream response forwarded as-is.
294
+ * Matched against the URI the client sees, which in mesh mode is
295
+ * `mcpose://<backendKey>/<uri>` (ADR-0022).
296
+ */
103
297
  passThroughResources?: ReadonlyArray<string>;
104
- /** Tools hidden from list_tools and rejected at runtime with MethodNotFound. */
105
- hiddenTools?: ReadonlyArray<string>;
106
- /** Resources hidden from list_resources and rejected at runtime with InvalidRequest. */
298
+ /**
299
+ * Tools hidden from list_tools and rejected at runtime with
300
+ * MethodNotFound. Precedence: a tool listed here AND in
301
+ * `passThroughTools` stays hidden. Hidden filtering is applied both
302
+ * before and after `listToolsMiddleware`, so list middleware cannot
303
+ * re-expose a hidden tool.
304
+ *
305
+ * A name array cannot see through a dispatcher (meta-tool) that takes
306
+ * the real tool name as an argument. Pass a {@link HiddenToolPredicate}
307
+ * (e.g. {@link dispatcherAwareBlock}) to close that bypass: it receives
308
+ * `undefined` args during list filtering and always an object at call
309
+ * time. See ADR-0006.
310
+ */
311
+ hiddenTools?: ReadonlyArray<string> | HiddenToolPredicate;
312
+ /**
313
+ * Resources hidden from list_resources and rejected at runtime with
314
+ * InvalidRequest. Matched against the URI the client sees, which in mesh
315
+ * mode is `mcpose://<backendKey>/<uri>` (ADR-0022).
316
+ */
107
317
  hiddenResources?: ReadonlyArray<string>;
108
318
  /**
109
- * Called after every tool call with timing and outcome data.
110
- * Wire to {@link https://www.npmjs.com/package/@mcpose/otel | @mcpose/otel}
111
- * or any custom telemetry sink.
319
+ * Strips `params._meta` from every request the proxy forwards (tool
320
+ * calls, resource reads, list and prompt calls). Default: `true`.
321
+ *
322
+ * MCP clients put correlation identifiers there (VS Code sends
323
+ * `progressToken`, a W3C `traceparent`, and `vscode/conversationId`),
324
+ * and the upstream is frequently a third party. The strip happens at the
325
+ * proxy boundary, before the pipeline, so middleware sees the stripped
326
+ * request and can still add its own `_meta` deliberately. Progress relay
327
+ * is unaffected: the proxy reads the client's progress token from the
328
+ * server-side request `extra`, and the SDK client stamps its own token
329
+ * on the upstream request.
330
+ *
331
+ * Applies to `passThroughTools` too; disable only globally with `false`
332
+ * for upstreams that read other `_meta` keys. See ADR-0008.
333
+ */
334
+ stripRequestMeta?: boolean;
335
+ /**
336
+ * Strips top-level `_meta` from every result the proxy returns from the
337
+ * upstream (tool calls, resource reads, list and prompt calls).
338
+ * Default: `true`.
339
+ *
340
+ * The response-direction mirror of {@link stripRequestMeta}: upstreams
341
+ * stamp correlation identifiers there (the SDK stamps
342
+ * `io.modelcontextprotocol/related-task`), and the client is a third
343
+ * party to them. The strip happens at the upstream boundary, inside the
344
+ * innermost `next`, so middleware sees the stripped result and any
345
+ * `_meta` middleware adds deliberately still reaches the client.
346
+ *
347
+ * Local tool results are not stripped (they have no upstream), and
348
+ * nested `_meta` (per-tool in `tools[]`, per-block in `content`) is
349
+ * untouched. Applies to pass-through tools and resources too; disable
350
+ * only globally with `false`. See ADR-0009.
351
+ */
352
+ stripResultMeta?: boolean;
353
+ /**
354
+ * Tools the proxy implements itself. Local tools appear in `tools/list`
355
+ * (first page only, so pagination does not duplicate them) and route to
356
+ * their handler instead of the upstream, from inside the innermost
357
+ * `next`, so the full `toolMiddleware` pipeline still runs.
358
+ *
359
+ * Precedence: `hiddenTools` beats a local tool; a local tool beats (and
360
+ * shadows) an upstream tool of the same name; `passThroughTools` has no
361
+ * effect on a local tool, because pass-through means "forward the
362
+ * upstream response as-is" and a local tool has no upstream.
363
+ *
364
+ * The proxy advertises the `tools` capability when this is non-empty
365
+ * even if the upstream has none. A duplicate local tool name throws at
366
+ * {@link createProxyServer}. See ADR-0007.
367
+ */
368
+ localTools?: ReadonlyArray<LocalTool>;
369
+ /**
370
+ * Called after every tool call with timing and outcome data. Wire to any
371
+ * custom telemetry sink, or to `createOtelTelemetry` from `@mcpose/otel`
372
+ * for OpenTelemetry spans.
373
+ * A throwing sink is logged and never fails the tool call.
112
374
  */
113
375
  onTelemetry?: (event: TelemetryEvent) => void;
114
376
  }
@@ -116,22 +378,25 @@ export interface ProxyOptions {
116
378
  * Creates a proxy MCP server without connecting it to a transport.
117
379
  *
118
380
  * Mirrors upstream tool/resource/prompt lists and routes requests through
119
- * middleware pipelines. Prompts are forwarded as-is.
381
+ * middleware pipelines. `prompts/list` is forwarded as-is; `prompts/get`
382
+ * runs `promptMiddleware` (ADR-0014).
120
383
  *
121
384
  * Uses low-level `Server` (not `McpServer`) — transparent proxying requires
122
385
  * generic list interception; `McpServer.tool()` needs names upfront.
123
386
  *
124
- * @param backend - Connected (or mock) upstream MCP client.
387
+ * @param backends - Connected (or mock) upstream MCP client for a 1:1 proxy,
388
+ * or a record of named backends for mesh mode (ADR-0013), where every
389
+ * upstream tool and prompt is exposed as `<backendKey>__<name>`.
125
390
  * @param options - Middleware stacks, hidden/passthrough sets.
126
391
  * @returns Configured {@link Server} ready to connect.
127
392
  */
128
- export declare function createProxyServer(backend: BackendClient, options?: ProxyOptions): Server;
393
+ export declare function createProxyServer(backends: Backends, options: ProxyOptions): Server;
129
394
  /**
130
395
  * Starts the proxy on stdio.
131
396
  * Calls {@link createProxyServer} then connects to `StdioServerTransport`.
132
397
  * Use `createProxyServer` directly for testable access to the server.
133
398
  */
134
- export declare function startProxy(backend: BackendClient, options?: ProxyOptions): Promise<void>;
399
+ export declare function startProxy(backends: Backends, options: ProxyOptions): Promise<void>;
135
400
  /**
136
401
  * Starts the proxy over Streamable HTTP with stateful sessions.
137
402
  *
@@ -143,5 +408,5 @@ export declare function startProxy(backend: BackendClient, options?: ProxyOption
143
408
  * @returns Promise resolving to the listening `http.Server` (or `https.Server`
144
409
  * when `tlsOptions` is supplied).
145
410
  */
146
- export declare function startHttpProxy(backend: BackendClient, options?: ProxyOptions, httpOptions?: HttpProxyOptions): Promise<http.Server>;
411
+ export declare function startHttpProxy(backends: Backends, options: ProxyOptions, httpOptions?: HttpProxyOptions): Promise<http.Server>;
147
412
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAOpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,C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