zuplo 7.14.8 → 7.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.
- package/docs/articles/logging.mdx +8 -1
- package/docs/articles/opentelemetry.mdx +269 -0
- package/docs/handlers/mcp-server.mdx +82 -2
- package/docs/mcp-gateway/auth/upstream-oauth.mdx +50 -8
- package/docs/mcp-gateway/code-config/compatibility-dates.mdx +96 -0
- package/docs/mcp-gateway/code-config/mcp-proxy-handler.mdx +22 -0
- package/docs/mcp-gateway/how-it-works.mdx +21 -2
- package/docs/mcp-gateway/observability/logging.mdx +25 -1
- package/docs/mcp-gateway/reference.mdx +86 -5
- package/docs/mcp-gateway/troubleshooting.mdx +5 -1
- package/docs/mcp-server/flat-tool-input.mdx +578 -0
- package/docs/mcp-server/prompts.mdx +10 -0
- package/docs/mcp-server/resources.mdx +58 -1
- package/docs/mcp-server/tools.mdx +132 -93
- package/docs/mcp-server/troubleshooting.mdx +184 -13
- package/docs/programmable-api/compatibility-dates.mdx +258 -0
- package/package.json +5 -5
|
@@ -46,7 +46,14 @@ Select a request to open its details, which list:
|
|
|
46
46
|
- **URL**: the full URL of the request, including the query string.
|
|
47
47
|
- **Route Path**: the route in your OpenAPI file that handled the request.
|
|
48
48
|
- **Properties**: any [custom log properties](#custom-log-properties) your code
|
|
49
|
-
set for the request.
|
|
49
|
+
set for the request. For a request to an
|
|
50
|
+
[MCP Server handler](../handlers/mcp-server.mdx) or
|
|
51
|
+
[MCP Gateway](../mcp-gateway/overview.mdx) route, Zuplo also adds the MCP
|
|
52
|
+
method as `mcp.method.name`, such as `tools/call`, and, for a tool call, the
|
|
53
|
+
tool name as `gen_ai.tool.name`. A method MCP doesn't define is recorded as
|
|
54
|
+
`_OTHER`, and a JSON-RPC batch records neither property. These two properties
|
|
55
|
+
don't count toward the property limit and replace properties of the same name
|
|
56
|
+
that your code sets.
|
|
50
57
|
|
|
51
58
|
When your code calls another route with
|
|
52
59
|
[`context.invokeRoute`](../programmable-api/zuplo-context.mdx#invokeroute), the
|
|
@@ -35,6 +35,11 @@ By default, when the OpenTelemetry plugin is enabled, the following is traced:
|
|
|
35
35
|
each policy is traced.
|
|
36
36
|
- Subrequests: Any use of `fetch` within your custom policies or handlers is
|
|
37
37
|
traced.
|
|
38
|
+
- MCP operations: Every MCP message that the
|
|
39
|
+
[MCP Server handler](../handlers/mcp-server.mdx) or the
|
|
40
|
+
[MCP Gateway](../mcp-gateway/overview.mdx) handles gets a span that follows
|
|
41
|
+
the OpenTelemetry semantic conventions for MCP. See
|
|
42
|
+
[MCP tracing](#mcp-tracing).
|
|
38
43
|
|
|
39
44
|
### Limitations
|
|
40
45
|
|
|
@@ -233,6 +238,270 @@ export function runtimeInit(runtime: RuntimeExtensions) {
|
|
|
233
238
|
}
|
|
234
239
|
```
|
|
235
240
|
|
|
241
|
+
## MCP Tracing
|
|
242
|
+
|
|
243
|
+
When the OpenTelemetry plugin is registered, the
|
|
244
|
+
[MCP Server handler](../handlers/mcp-server.mdx) and the
|
|
245
|
+
[MCP Gateway](../mcp-gateway/overview.mdx) record a span for every MCP request
|
|
246
|
+
and notification they handle. The spans follow the
|
|
247
|
+
[OpenTelemetry semantic conventions for MCP](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/),
|
|
248
|
+
so a backend that understands GenAI and MCP telemetry recognizes the span names,
|
|
249
|
+
kinds, and attributes without any mapping.
|
|
250
|
+
|
|
251
|
+
There's nothing extra to enable. Register the plugin as described in
|
|
252
|
+
[Setup](#setup) and MCP spans appear in the **Observability** tab and in any
|
|
253
|
+
backend you export to. The plugin's [sampling](#performance-and-sampling)
|
|
254
|
+
settings apply to MCP spans the same way they apply to the rest of the trace.
|
|
255
|
+
|
|
256
|
+
All MCP spans use the instrumentation scope `mcp`, whether they come from an MCP
|
|
257
|
+
Server route or the MCP Gateway, so one filter selects every MCP span in a
|
|
258
|
+
project.
|
|
259
|
+
|
|
260
|
+
### Span Names and Kinds
|
|
261
|
+
|
|
262
|
+
Each span is named after the JSON-RPC method, plus the tool or prompt name when
|
|
263
|
+
there is one:
|
|
264
|
+
|
|
265
|
+
| Operation | Span name | Example |
|
|
266
|
+
| ------------------------------ | --------------------------- | ------------------------------- |
|
|
267
|
+
| Tool call | `tools/call {tool name}` | `tools/call get_weather` |
|
|
268
|
+
| Prompt request | `prompts/get {prompt name}` | `prompts/get summarize` |
|
|
269
|
+
| Resource read | `resources/read` | `resources/read` |
|
|
270
|
+
| Lists | `{method}` | `tools/list`, `resources/list` |
|
|
271
|
+
| Lifecycle and notifications | `{method}` | `initialize`, `server/discover` |
|
|
272
|
+
| Unknown method or invalid JSON | `_OTHER` | A request with a malformed body |
|
|
273
|
+
|
|
274
|
+
Every method that MCP defines up to protocol revision `2026-07-28` keeps its
|
|
275
|
+
name, including `server/discover` and `subscriptions/listen`. Only a method MCP
|
|
276
|
+
doesn't define becomes `_OTHER`.
|
|
277
|
+
|
|
278
|
+
The tool or prompt name becomes part of the span name only when the server
|
|
279
|
+
actually has that tool or prompt. A call to a tool that doesn't exist produces a
|
|
280
|
+
span named `tools/call`, and the name the client sent is still recorded in
|
|
281
|
+
`gen_ai.tool.name`. This keeps span names bounded, so a client can't create a
|
|
282
|
+
new span name for every request. Resource URIs never appear in span names. On
|
|
283
|
+
the MCP Gateway, span names don't include the tool or prompt name; read it from
|
|
284
|
+
the `gen_ai.tool.name` or `gen_ai.prompt.name` attribute.
|
|
285
|
+
|
|
286
|
+
The MCP Server handler records a `SERVER` span. The MCP Gateway records two
|
|
287
|
+
spans for each message it proxies: a `SERVER` span for the message as the
|
|
288
|
+
gateway received it from the MCP client, and a `CLIENT` span, its child, for the
|
|
289
|
+
message as the gateway forwarded it to the upstream MCP server.
|
|
290
|
+
|
|
291
|
+
### Span Attributes
|
|
292
|
+
|
|
293
|
+
| Attribute | Recorded on | Description |
|
|
294
|
+
| ---------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
295
|
+
| `mcp.method.name` | Every span | The JSON-RPC method as the client sent it, for example `tools/call`. Unknown methods keep their original value here. |
|
|
296
|
+
| `mcp.protocol.version` | Every span | The MCP protocol version of the request, for example `2025-06-18`. A version Zuplo doesn't recognize is recorded as `unknown`. The MCP Gateway `CLIENT` span records it only when the client sent a version. |
|
|
297
|
+
| `mcp.session.id` | Stateful sessions | The `Mcp-Session-Id` of the request. On the MCP Gateway, an `initialize` span records the session ID the upstream assigns. |
|
|
298
|
+
| `mcp.resource.uri` | Resource operations | The resource URI of `resources/read`, `resources/subscribe`, and `resources/unsubscribe`. |
|
|
299
|
+
| `gen_ai.operation.name` | Tool calls | Always `execute_tool`. |
|
|
300
|
+
| `gen_ai.tool.name` | Tool calls | The name of the tool the client called. |
|
|
301
|
+
| `gen_ai.prompt.name` | Prompt requests | The name of the prompt the client requested. |
|
|
302
|
+
| `gen_ai.tool.call.arguments` | Tool calls (opt-in) | The tool call arguments as a JSON string. See [Capture tool call content](#capture-tool-call-content). |
|
|
303
|
+
| `gen_ai.tool.call.result` | Tool calls (opt-in) | The tool call result as a JSON string. See [Capture tool call content](#capture-tool-call-content). |
|
|
304
|
+
| `jsonrpc.request.id` | Requests | The JSON-RPC `id`. Notifications have no ID, so their spans don't carry it. |
|
|
305
|
+
| `jsonrpc.protocol.version` | Non-standard requests | The JSON-RPC version, recorded only when it isn't `2.0`. |
|
|
306
|
+
| `rpc.response.status_code` | Error responses | The JSON-RPC error code, as a string, for example `-32602`. |
|
|
307
|
+
| `error.type` | Failed operations | Why the operation failed. See [Errors](#errors). |
|
|
308
|
+
| `network.protocol.name` | Every span | `http`. |
|
|
309
|
+
| `network.transport` | Every span | `tcp`. |
|
|
310
|
+
| `client.address` | `SERVER` spans | The IP address of the MCP client. |
|
|
311
|
+
| `server.address` | MCP Gateway `CLIENT` span | The host name of the upstream MCP server. |
|
|
312
|
+
| `server.port` | MCP Gateway `CLIENT` span | The port of the upstream MCP server. |
|
|
313
|
+
|
|
314
|
+
Values the MCP client chooses, such as tool names, resource URIs, request IDs,
|
|
315
|
+
and error messages, are cut to 256 characters.
|
|
316
|
+
|
|
317
|
+
### Errors
|
|
318
|
+
|
|
319
|
+
An MCP operation can fail in several ways. The span records each one with an
|
|
320
|
+
`error.type` attribute and an error status:
|
|
321
|
+
|
|
322
|
+
| Outcome | `error.type` | Span status |
|
|
323
|
+
| ------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------- |
|
|
324
|
+
| The tool returns a result with `isError: true` | `tool_error` | Error |
|
|
325
|
+
| The server answers with a JSON-RPC error | The error code, such as `-32603` | Error, with the error message |
|
|
326
|
+
| The operation throws an exception | The exception name, such as `TypeError` | Error, with the exception recorded as a span event |
|
|
327
|
+
| MCP Gateway: the upstream answers with an HTTP error and no JSON-RPC body | The HTTP status code, such as `502` | Error |
|
|
328
|
+
| MCP Gateway: the client cancels before the response arrives | `cancelled` | Error |
|
|
329
|
+
| MCP Gateway: a policy sends a different response | `response_replaced` | Error |
|
|
330
|
+
| MCP Gateway: the upstream ends the stream without a response | `no_response` | Error |
|
|
331
|
+
|
|
332
|
+
Errors caused by the client's request aren't errors of the server, so `SERVER`
|
|
333
|
+
spans record `rpc.response.status_code` for them but no `error.type` and no
|
|
334
|
+
error status. That covers parse errors (`-32700`), invalid requests (`-32600`),
|
|
335
|
+
unknown methods (`-32601`), invalid parameters, including a call to a tool that
|
|
336
|
+
doesn't exist (`-32602`), unknown resources (`-32002`), and requests the
|
|
337
|
+
transport rejects with an HTTP 4xx status, such as an unsupported protocol
|
|
338
|
+
version. On the MCP Gateway `CLIENT` span, every JSON-RPC error counts as an
|
|
339
|
+
error, because it's the upstream's answer to a request the gateway sent.
|
|
340
|
+
|
|
341
|
+
A tool that fails still returns HTTP `200` with an `isError` result, so the
|
|
342
|
+
request's entry span reports success while the `tools/call` span reports
|
|
343
|
+
`tool_error`. Filter on the MCP span to find failed tool calls.
|
|
344
|
+
|
|
345
|
+
### Trace Structure
|
|
346
|
+
|
|
347
|
+
MCP spans sit inside the request's trace, under the handler span. On an MCP
|
|
348
|
+
Server route, the tool's own route runs inside the `tools/call` span, so the
|
|
349
|
+
policies, handler, and outbound `fetch` calls of that route appear as its
|
|
350
|
+
children:
|
|
351
|
+
|
|
352
|
+
```txt
|
|
353
|
+
|--- POST /mcp (entry span)
|
|
354
|
+
| |
|
|
355
|
+
| |--- handler:mcpServerHandler
|
|
356
|
+
| | |
|
|
357
|
+
| | |--- tools/call get_weather (SERVER)
|
|
358
|
+
| | | |
|
|
359
|
+
| | | |--- policy:rate-limit-inbound
|
|
360
|
+
| | | |
|
|
361
|
+
| | | |--- handler:urlForwardHandler
|
|
362
|
+
| | | | |
|
|
363
|
+
| | | | |--- GET https://api.example.com/weather
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
On the MCP Gateway, the `CLIENT` span holds the call to the upstream MCP server,
|
|
367
|
+
including a retry after the upstream answers `401`:
|
|
368
|
+
|
|
369
|
+
```txt
|
|
370
|
+
|--- POST /mcp/linear (entry span)
|
|
371
|
+
| |
|
|
372
|
+
| |--- policies:inbound
|
|
373
|
+
| | |
|
|
374
|
+
| | |--- policy:auth0-managed-oauth
|
|
375
|
+
| | |
|
|
376
|
+
| | |--- policy:mcp-token-exchange-linear
|
|
377
|
+
| |
|
|
378
|
+
| |--- handler:McpProxyHandler
|
|
379
|
+
| | |
|
|
380
|
+
| | |--- tools/call (SERVER, gen_ai.tool.name=create_issue)
|
|
381
|
+
| | | |
|
|
382
|
+
| | | |--- tools/call (CLIENT, server.address=mcp.linear.app)
|
|
383
|
+
| | | | |
|
|
384
|
+
| | | | |--- POST https://mcp.linear.app/mcp
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
The MCP Gateway also passes the trace on to the upstream MCP server. It adds the
|
|
388
|
+
`CLIENT` span's `traceparent` and `tracestate` to the forwarded message's
|
|
389
|
+
`params._meta`, alongside the standard HTTP `traceparent` header, so an upstream
|
|
390
|
+
server that reads MCP trace context continues the same trace. The gateway adds
|
|
391
|
+
them only to sampled requests, and forwards the original bytes unchanged when
|
|
392
|
+
the body is larger than 256 KB or carries a body digest header such as
|
|
393
|
+
`Content-Digest`.
|
|
394
|
+
|
|
395
|
+
### Trace Context From MCP Clients
|
|
396
|
+
|
|
397
|
+
MCP clients can send trace context inside the request's `params._meta`
|
|
398
|
+
(`traceparent` and `tracestate`), separate from the HTTP headers. Zuplo uses it
|
|
399
|
+
as follows:
|
|
400
|
+
|
|
401
|
+
- When `params._meta.traceparent` belongs to the same trace as the HTTP request,
|
|
402
|
+
the MCP span becomes a child of the client's span, and the span it would
|
|
403
|
+
otherwise have had as a parent is attached as a link.
|
|
404
|
+
- When it belongs to a different trace, the MCP span stays in the HTTP request's
|
|
405
|
+
trace and links to the client's span. The link has the attribute
|
|
406
|
+
`mcp.context.source` set to `params._meta`.
|
|
407
|
+
|
|
408
|
+
The HTTP request's sampling decision always applies: trace context in
|
|
409
|
+
`params._meta` can't turn sampling on or off. Baggage in `params._meta` isn't
|
|
410
|
+
propagated to the requests that tool routes make.
|
|
411
|
+
|
|
412
|
+
### Capture Tool Call Content
|
|
413
|
+
|
|
414
|
+
By default, MCP spans don't record what a tool received or returned. To record
|
|
415
|
+
tool call content, set `telemetry.captureToolCallContent` to `true` in the
|
|
416
|
+
handler options of an MCP Server route or an MCP Gateway route.
|
|
417
|
+
|
|
418
|
+
On an MCP Server route:
|
|
419
|
+
|
|
420
|
+
```json title="config/routes.oas.json"
|
|
421
|
+
{
|
|
422
|
+
"handler": {
|
|
423
|
+
"export": "mcpServerHandler",
|
|
424
|
+
"module": "$import(@zuplo/runtime)",
|
|
425
|
+
"options": {
|
|
426
|
+
"name": "example-mcp-server",
|
|
427
|
+
"version": "1.0.0",
|
|
428
|
+
"telemetry": {
|
|
429
|
+
"captureToolCallContent": true
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
On an MCP Gateway route:
|
|
437
|
+
|
|
438
|
+
```json title="config/routes.oas.json"
|
|
439
|
+
{
|
|
440
|
+
"handler": {
|
|
441
|
+
"export": "McpProxyHandler",
|
|
442
|
+
"module": "$import(@zuplo/runtime/mcp-gateway)",
|
|
443
|
+
"options": {
|
|
444
|
+
"rewritePattern": "https://mcp.example.com/mcp",
|
|
445
|
+
"telemetry": {
|
|
446
|
+
"captureToolCallContent": true
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
With this option on, each sampled `tools/call` span records:
|
|
454
|
+
|
|
455
|
+
- `gen_ai.tool.call.arguments`: the arguments the client sent. On an MCP Server
|
|
456
|
+
route, they're recorded once they pass validation. A call without arguments
|
|
457
|
+
records `{}`.
|
|
458
|
+
- `gen_ai.tool.call.result`: the tool result, for successful calls only. A
|
|
459
|
+
result with `isError: true` isn't recorded.
|
|
460
|
+
|
|
461
|
+
Both are JSON strings capped at 8,192 characters.
|
|
462
|
+
|
|
463
|
+
On the MCP Gateway, both the `SERVER` and the `CLIENT` span of a forwarded
|
|
464
|
+
`tools/call` carry the attributes, and the result is the one the upstream MCP
|
|
465
|
+
server returned. A response the gateway builds itself, such as a request to
|
|
466
|
+
connect the upstream, is never recorded as a tool result. With the option on,
|
|
467
|
+
the gateway reads `tools/call` responses up to 1 MiB, instead of the usual 64
|
|
468
|
+
KiB, so it can record larger results. A result in a JSON response, or in the
|
|
469
|
+
event-stream event that carries it, larger than 1 MiB still reaches the client
|
|
470
|
+
but isn't recorded. The gateway turns capture on only for the boolean `true`.
|
|
471
|
+
Any other value, including the string `"true"`, leaves it off.
|
|
472
|
+
|
|
473
|
+
:::warning
|
|
474
|
+
|
|
475
|
+
Tool arguments and results often contain personal or otherwise sensitive data.
|
|
476
|
+
Turning on `captureToolCallContent` sends that data to Zuplo's trace storage and
|
|
477
|
+
to any backend you export to. When a tool handler throws, the exception message
|
|
478
|
+
and stack are recorded on the span whether this option is on or off, so keep
|
|
479
|
+
sensitive data out of the errors your tool handlers throw.
|
|
480
|
+
|
|
481
|
+
:::
|
|
482
|
+
|
|
483
|
+
### Query MCP Spans in Your Backend
|
|
484
|
+
|
|
485
|
+
Because the attributes follow the semantic conventions, you can query MCP
|
|
486
|
+
activity directly in any backend that receives your traces. For example:
|
|
487
|
+
|
|
488
|
+
- Find slow tool calls: filter on `gen_ai.operation.name = execute_tool` and
|
|
489
|
+
sort by duration, grouped by `gen_ai.tool.name`.
|
|
490
|
+
- Find failing tools: filter on `error.type = tool_error`.
|
|
491
|
+
- Compare protocol versions in use: group by `mcp.protocol.version`.
|
|
492
|
+
- Follow one client session: filter on `mcp.session.id`.
|
|
493
|
+
- Compare gateway overhead with upstream latency: compare a `SERVER` span's
|
|
494
|
+
duration with its `CLIENT` child's duration.
|
|
495
|
+
|
|
496
|
+
:::note
|
|
497
|
+
|
|
498
|
+
The OpenTelemetry semantic conventions also define the
|
|
499
|
+
`mcp.server.operation.duration` and `mcp.client.operation.duration` metrics. The
|
|
500
|
+
OpenTelemetry plugin exports traces and logs, not metrics, so use MCP span
|
|
501
|
+
durations to measure latency.
|
|
502
|
+
|
|
503
|
+
:::
|
|
504
|
+
|
|
236
505
|
## Performance and Sampling
|
|
237
506
|
|
|
238
507
|
Tracing isn't free. The plugin instruments every request: it opens spans for the
|
|
@@ -108,8 +108,88 @@ The MCP Server handler supports the following configuration options:
|
|
|
108
108
|
become top-level tool arguments. Flat tools accept the nested form too, so
|
|
109
109
|
switching to `flat` doesn't break existing clients. This option sets the
|
|
110
110
|
default for every tool on the server. A tool can override it with
|
|
111
|
-
`toolInputStyle` in its route's `x-zuplo-route.mcp` block.
|
|
112
|
-
|
|
111
|
+
`toolInputStyle` in its route's `x-zuplo-route.mcp` block. Any value other
|
|
112
|
+
than `flat` is read as `nested`. See
|
|
113
|
+
[Tool input schemas](../mcp-server/tools.mdx#tool-input-schemas) and the
|
|
114
|
+
[Flat tool input reference](../mcp-server/flat-tool-input.mdx).
|
|
115
|
+
- `telemetry.captureToolCallContent` (optional, default `false`) - Records tool
|
|
116
|
+
call arguments and results on the `tools/call` trace span as
|
|
117
|
+
`gen_ai.tool.call.arguments` and `gen_ai.tool.call.result`. Tool content often
|
|
118
|
+
contains sensitive data, so turn this on only when your trace destination is
|
|
119
|
+
allowed to store it. See
|
|
120
|
+
[MCP tracing](../articles/opentelemetry.mdx#capture-tool-call-content).
|
|
121
|
+
|
|
122
|
+
### Supported MCP protocol versions
|
|
123
|
+
|
|
124
|
+
The MCP Server handler accepts the `MCP-Protocol-Version` values `2024-10-07`
|
|
125
|
+
through `2025-11-25` on every compatibility date. From compatibility date
|
|
126
|
+
[`2026-11-06`](../programmable-api/compatibility-dates.mdx#2026-11-06), it also
|
|
127
|
+
serves `2026-07-28`. A request without the header is served as `2025-03-26`. Any
|
|
128
|
+
other value returns HTTP `400` with JSON-RPC error `-32000`, and so does
|
|
129
|
+
`2026-07-28` on an earlier compatibility date. Some behavior depends on the
|
|
130
|
+
version the client sends, such as refusing JSON-RPC batches from `2025-06-18`
|
|
131
|
+
and returning invalid tool arguments as tool results from `2025-11-25`. See
|
|
132
|
+
[JSON-RPC errors the handler returns](../mcp-server/troubleshooting.mdx#json-rpc-errors-the-handler-returns).
|
|
133
|
+
|
|
134
|
+
#### MCP protocol `2026-07-28`
|
|
135
|
+
|
|
136
|
+
From compatibility date `2026-11-06`, the handler serves a request on revision
|
|
137
|
+
`2026-07-28` when its `MCP-Protocol-Version` header names that revision.
|
|
138
|
+
Requests on `2025-11-25` and earlier get the same answers as before, apart from
|
|
139
|
+
the
|
|
140
|
+
[prompt message and batch changes](../programmable-api/compatibility-dates.mdx#mcp-server-handler-checks-prompt-messages-and-batch-answers)
|
|
141
|
+
the same date makes.
|
|
142
|
+
|
|
143
|
+
A `2026-07-28` client sees these differences:
|
|
144
|
+
|
|
145
|
+
- **Headers and envelope.** Each request sends the `MCP-Protocol-Version`,
|
|
146
|
+
`Mcp-Method`, and, for a tool, prompt, or resource, `Mcp-Name` headers, plus
|
|
147
|
+
the per-request `_meta` envelope in `params`. A request that names
|
|
148
|
+
`2026-07-28` only in `_meta`, without the `MCP-Protocol-Version` header,
|
|
149
|
+
returns HTTP `400` with `-32020`, because the header is required. A request
|
|
150
|
+
whose `_meta` names `2025-11-25` or an earlier revision the handler serves,
|
|
151
|
+
without a `2026-07-28` header, is served on that earlier revision.
|
|
152
|
+
- **Discovery instead of a handshake.** The client calls `server/discover`
|
|
153
|
+
instead of `initialize`. The reply lists `supportedVersions` (`2026-07-28`,
|
|
154
|
+
then `2025-11-25` through `2024-10-07`), the server's `capabilities`, and its
|
|
155
|
+
name and version in `_meta["io.modelcontextprotocol/serverInfo"]`. A client
|
|
156
|
+
can negotiate down to an earlier revision, which it opens with `initialize`.
|
|
157
|
+
- **Removed methods.** `initialize`, `ping`, `logging/setLevel`,
|
|
158
|
+
`resources/subscribe`, and `resources/unsubscribe` return HTTP `404` with
|
|
159
|
+
JSON-RPC error `-32601`.
|
|
160
|
+
- **Result fields.** Every result carries `resultType: "complete"` and the
|
|
161
|
+
server's name and version in `_meta["io.modelcontextprotocol/serverInfo"]`.
|
|
162
|
+
The `server/discover`, `tools/list`, `prompts/list`, `resources/list`,
|
|
163
|
+
`resources/templates/list`, and `resources/read` results also carry `ttlMs: 0`
|
|
164
|
+
and `cacheScope: "private"`, so a client treats them as stale right away and
|
|
165
|
+
doesn't share them with another caller.
|
|
166
|
+
- **Errors.** A missing envelope, headers that disagree with the body, and an
|
|
167
|
+
unsupported revision return HTTP `400` with `-32602`, `-32020`, and `-32022`.
|
|
168
|
+
An unknown tool, prompt, or resource returns `-32602` with the name or URI in
|
|
169
|
+
the message, such as `Tool nope not found`. `2026-07-28` has no JSON-RPC
|
|
170
|
+
batches, so a batch, like a posted JSON-RPC response, returns HTTP `400` with
|
|
171
|
+
`-32600`. The `406` for an `Accept` header that doesn't allow
|
|
172
|
+
`application/json` and the `415` for a non-JSON `Content-Type` also carry
|
|
173
|
+
`-32600`. See
|
|
174
|
+
[JSON-RPC errors on `2026-07-28`](../mcp-server/troubleshooting.mdx#json-rpc-errors-on-2026-07-28).
|
|
175
|
+
|
|
176
|
+
The handler doesn't serve these `2026-07-28` features: tools that ask the client
|
|
177
|
+
for input (`input_required` results, elicitation, sampling, and roots),
|
|
178
|
+
`subscriptions/listen` notifications, logging, tasks, and per-caller caching
|
|
179
|
+
hints.
|
|
180
|
+
|
|
181
|
+
If a [hook](../programmable-api/hooks.mdx) or policy answers or changes a
|
|
182
|
+
`tools/call` request before the handler runs it, update it for `2026-07-28`
|
|
183
|
+
clients:
|
|
184
|
+
|
|
185
|
+
- A response it returns itself must include `resultType: "complete"` in `result`
|
|
186
|
+
when the request's `MCP-Protocol-Version` header is `2026-07-28`, or the
|
|
187
|
+
client rejects it.
|
|
188
|
+
- If it rewrites the tool name in `params.name`, it must also set the `Mcp-Name`
|
|
189
|
+
header to the new name, or the handler returns HTTP `400` with `-32020`.
|
|
190
|
+
|
|
191
|
+
The [MCP Gateway](../mcp-gateway/reference.mdx#mcp-protocol-2026-07-28) also
|
|
192
|
+
supports `2026-07-28` from compatibility date `2026-11-06`.
|
|
113
193
|
|
|
114
194
|
### MCP `2025-06-18` Global Options
|
|
115
195
|
|
|
@@ -177,20 +177,41 @@ The full JSON-RPC error payload looks like:
|
|
|
177
177
|
"code": -32042,
|
|
178
178
|
"message": "Connect Linear to continue.",
|
|
179
179
|
"data": {
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
"elicitations": [
|
|
181
|
+
{
|
|
182
|
+
"mode": "url",
|
|
183
|
+
"message": "Connect Linear to continue.",
|
|
184
|
+
"elicitationId": "connect:linear-mcp-server:linear:linear:user-oauth",
|
|
185
|
+
"url": "https://gateway.example.com/__zuplo/auth/connections/linear/connect?browserTicket=eyJ...&operationId=linear-mcp-server",
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
"connectRequired": {
|
|
189
|
+
"state": "authenticating",
|
|
190
|
+
"upstreamServerId": "linear",
|
|
191
|
+
"operationId": "linear-mcp-server",
|
|
192
|
+
"authUrl": "https://gateway.example.com/__zuplo/auth/connections/linear/connect?browserTicket=eyJ...&operationId=linear-mcp-server",
|
|
193
|
+
"message": "Connect Linear to continue.",
|
|
194
|
+
"nextAction": "redirect",
|
|
195
|
+
"authProfileId": "linear:user-oauth",
|
|
196
|
+
},
|
|
186
197
|
},
|
|
187
198
|
},
|
|
188
199
|
}
|
|
189
200
|
```
|
|
190
201
|
|
|
191
202
|
The `-32042` error code is MCP's `URLElicitationRequiredError`. Clients that
|
|
192
|
-
support URL elicitation open
|
|
193
|
-
|
|
203
|
+
support URL elicitation open the URL directly; others render the message and let
|
|
204
|
+
the user open `data.connectRequired.authUrl` manually.
|
|
205
|
+
|
|
206
|
+
From compatibility date
|
|
207
|
+
[`2026-11-06`](../../programmable-api/compatibility-dates.mdx#2026-11-06), the
|
|
208
|
+
gateway sends `-32042` only to an `initialize` on MCP protocol `2025-11-25` that
|
|
209
|
+
declares URL elicitation (`capabilities.elicitation.url`). Every other request
|
|
210
|
+
gets JSON-RPC error `-32603` with the same `data.connectRequired` payload, so a
|
|
211
|
+
client reads the connect link from `data.connectRequired.authUrl`. On MCP
|
|
212
|
+
protocol `2026-07-28`, a tool call, prompt, or resource read gets an
|
|
213
|
+
`input_required` result with the connect link instead. See
|
|
214
|
+
[Gateway answers follow the MCP specification](../code-config/compatibility-dates.mdx#gateway-answers-follow-the-mcp-specification).
|
|
194
215
|
|
|
195
216
|
## Refresh and 401 retry
|
|
196
217
|
|
|
@@ -201,6 +222,27 @@ upstream credential and retries the upstream fetch once. If the refresh fails or
|
|
|
201
222
|
produces another connect-required state, the gateway returns the JSON-RPC
|
|
202
223
|
connect-required to the client and the user sees the reconsent flow.
|
|
203
224
|
|
|
225
|
+
When the upstream's token endpoint can't answer a refresh, because it returns a
|
|
226
|
+
`5xx` or `429` error or doesn't respond, the gateway keeps the stored connection
|
|
227
|
+
and returns HTTP `503` with an `application/problem+json` body whose `code` is
|
|
228
|
+
`upstream_token_refresh_unavailable`. The client can retry the request later,
|
|
229
|
+
and the next request refreshes again. A rejection such as `invalid_grant` still
|
|
230
|
+
returns `reconsent_required`.
|
|
231
|
+
|
|
232
|
+
When the upstream's token endpoint no longer recognizes the gateway's client,
|
|
233
|
+
even with a non-standard error such as
|
|
234
|
+
`422 {"message":"Unrecognized client_id"}`, the gateway treats it as
|
|
235
|
+
`invalid_client`. In auto registration mode, it discards the stored client
|
|
236
|
+
registration and registers a new client before it sends the user to reconnect,
|
|
237
|
+
so the reconnect succeeds.
|
|
238
|
+
|
|
239
|
+
From compatibility date
|
|
240
|
+
[`2026-11-06`](../../programmable-api/compatibility-dates.mdx#2026-11-06), if
|
|
241
|
+
the upstream still answers `401` after the retry, or answers `403` with a
|
|
242
|
+
`WWW-Authenticate` challenge, the gateway answers with JSON-RPC error `-32603`
|
|
243
|
+
and the upstream's status in `data.upstreamStatus`, instead of passing the
|
|
244
|
+
upstream's response and its challenge to the client.
|
|
245
|
+
|
|
204
246
|
Stored refresh tokens stay valid as long as the upstream provider honors them.
|
|
205
247
|
When an upstream's policy revokes a refresh token — for example, because the
|
|
206
248
|
user revoked the connection from the upstream's dashboard — the next request
|
|
@@ -34,3 +34,99 @@ to existing projects being upgraded to use the MCP Gateway.
|
|
|
34
34
|
|
|
35
35
|
For background on Zuplo's compatibility-date system in general, see
|
|
36
36
|
[Compatibility dates](../../programmable-api/compatibility-dates.mdx).
|
|
37
|
+
|
|
38
|
+
## MCP protocol `2026-07-28`
|
|
39
|
+
|
|
40
|
+
Set `compatibilityDate` to `2026-11-06` or later to turn on support for MCP
|
|
41
|
+
protocol revision `2026-07-28`:
|
|
42
|
+
|
|
43
|
+
```jsonc
|
|
44
|
+
// zuplo.jsonc
|
|
45
|
+
{
|
|
46
|
+
"version": 1,
|
|
47
|
+
"compatibilityDate": "2026-11-06",
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
With this date, the MCP Gateway handles requests that name `2026-07-28` in the
|
|
52
|
+
`MCP-Protocol-Version` header as that revision requires:
|
|
53
|
+
|
|
54
|
+
- Upstream readiness checks fall back to `server/discover` when an upstream
|
|
55
|
+
refuses `initialize`.
|
|
56
|
+
- The gateway answers `server/discover` itself for a caller that hasn't
|
|
57
|
+
connected the upstream yet, and adds the configured server icons to its reply.
|
|
58
|
+
The reply lists the protocol versions the upstream serves once the gateway has
|
|
59
|
+
seen them, and `2026-07-28` plus `2025-11-25` and earlier until then.
|
|
60
|
+
- A caller that hasn't connected the upstream gets an `input_required` result
|
|
61
|
+
with a connect link for `tools/call`, `prompts/get`, and `resources/read` (or
|
|
62
|
+
a `-32021` error when the client doesn't support URL elicitation), instead of
|
|
63
|
+
the `-32042` error that `2026-07-28` clients can't act on. The list methods
|
|
64
|
+
return an empty list, the methods `2026-07-28` removed return HTTP `404` with
|
|
65
|
+
`-32601`, and other requests return `-32603` with the connect link in
|
|
66
|
+
`data.connectRequired`.
|
|
67
|
+
- Before the gateway answers a request itself, it refuses one that a
|
|
68
|
+
`2026-07-28` server refuses, such as a request without a required
|
|
69
|
+
`MCP-Protocol-Version`, `Mcp-Method`, or `Mcp-Name` header (`-32020`).
|
|
70
|
+
- On `subscriptions/listen`, the request timeout limits only the wait for
|
|
71
|
+
response headers, so the stream can stay open. A client disconnect cancels the
|
|
72
|
+
upstream request.
|
|
73
|
+
|
|
74
|
+
Requests on `2025-11-25` and earlier also get the changes in
|
|
75
|
+
[Gateway answers follow the MCP specification](#gateway-answers-follow-the-mcp-specification),
|
|
76
|
+
and these project-wide changes:
|
|
77
|
+
|
|
78
|
+
- The gateway's OAuth authorization responses include the RFC 9207 `iss`
|
|
79
|
+
parameter, and its authorization server metadata advertises
|
|
80
|
+
`authorization_response_iss_parameter_supported`.
|
|
81
|
+
- The configured server icons are also added to an `initialize` reply that the
|
|
82
|
+
upstream sends as an event stream.
|
|
83
|
+
- On Managed Edge and in local development, `request.signal` aborts when the
|
|
84
|
+
client disconnects. This applies to all code in the project, not only the MCP
|
|
85
|
+
Gateway.
|
|
86
|
+
|
|
87
|
+
On an earlier compatibility date, the MCP Gateway relays `2026-07-28` traffic
|
|
88
|
+
without handling it as that revision.
|
|
89
|
+
|
|
90
|
+
The same date also turns on `2026-07-28` support in the
|
|
91
|
+
[MCP Server handler](../../handlers/mcp-server.mdx#mcp-protocol-2026-07-28),
|
|
92
|
+
along with other handler changes. See
|
|
93
|
+
[2026-11-06](../../programmable-api/compatibility-dates.mdx#2026-11-06) for
|
|
94
|
+
every change it includes.
|
|
95
|
+
|
|
96
|
+
## Gateway answers follow the MCP specification
|
|
97
|
+
|
|
98
|
+
From compatibility date `2026-11-06`, the answers the MCP Gateway builds itself
|
|
99
|
+
follow the MCP specification in several error and edge cases. Most of them
|
|
100
|
+
affect a caller that hasn't connected the upstream yet, on MCP protocol
|
|
101
|
+
`2025-11-25` and earlier:
|
|
102
|
+
|
|
103
|
+
| Request from a caller that hasn't connected the upstream | Before `2026-11-06` | From `2026-11-06` |
|
|
104
|
+
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
105
|
+
| `initialize` on `2025-11-25` that declares `capabilities.elicitation.url` | `-32042` URL-elicitation error | `-32042` URL-elicitation error |
|
|
106
|
+
| Any other request, such as `tools/call` | `-32042`, or `-32600` when only an administrator can connect the upstream | `-32603` with the connect link in `data.connectRequired` |
|
|
107
|
+
| `ping` | `-32042` | An empty result |
|
|
108
|
+
| Notification or JSON-RPC response | `-32042` error without an `id` | HTTP `202` with no body |
|
|
109
|
+
| Empty body, or a body that isn't JSON | `-32042` | HTTP `400` with `-32700` |
|
|
110
|
+
| Message that isn't valid JSON-RPC | `-32042` | HTTP `400` with `-32600` |
|
|
111
|
+
| `MCP-Protocol-Version` that the route doesn't serve | `-32042` | HTTP `400` with `-32000` |
|
|
112
|
+
| JSON-RPC batch on `2025-06-18` or later | `-32042` | HTTP `400` with `-32600` |
|
|
113
|
+
| JSON-RPC batch on `2025-03-26` or without a version header | One `-32042` error | One answer for each message |
|
|
114
|
+
| `GET` or `DELETE` | HTTP `200` with a `-32042` error | HTTP `405` with `Allow: POST` |
|
|
115
|
+
|
|
116
|
+
A client that relied on `-32042` for a `tools/call` reads the connect link from
|
|
117
|
+
`data.connectRequired.authUrl` instead.
|
|
118
|
+
|
|
119
|
+
On a route with the `mcp-token-exchange-inbound` policy, the date also changes
|
|
120
|
+
what the client gets when the upstream rejects the credential the gateway sent.
|
|
121
|
+
When the upstream still answers `401` after the gateway refreshed its
|
|
122
|
+
credential, or answers `403` with a `WWW-Authenticate` challenge, the gateway
|
|
123
|
+
answers each request with JSON-RPC error `-32603` and the message
|
|
124
|
+
`The upstream MCP server rejected the gateway's credential.`, with the
|
|
125
|
+
upstream's status in `data.upstreamStatus`. Before `2026-11-06`, the client gets
|
|
126
|
+
the upstream's response, including its `WWW-Authenticate` challenge, and reads
|
|
127
|
+
the `401` as its own gateway token failing. A route without the policy relays
|
|
128
|
+
the upstream's response on every date.
|
|
129
|
+
|
|
130
|
+
On a `2026-07-28` request, the methods that `2026-07-28` removed, such as `ping`
|
|
131
|
+
and `logging/setLevel`, get HTTP `404` with `-32601` from the gateway instead of
|
|
132
|
+
a connect-required answer.
|
|
@@ -112,6 +112,28 @@ When set, the upstream fetch uses mutual TLS with the specified client
|
|
|
112
112
|
certificate. Most MCP upstreams don't require mTLS; leave this unset unless you
|
|
113
113
|
specifically need it.
|
|
114
114
|
|
|
115
|
+
### `telemetry.captureToolCallContent` (optional)
|
|
116
|
+
|
|
117
|
+
Type: `boolean`. Default: `false`.
|
|
118
|
+
|
|
119
|
+
When `true`, the OpenTelemetry spans of each forwarded `tools/call` record the
|
|
120
|
+
arguments the client sent as `gen_ai.tool.call.arguments` and, when the upstream
|
|
121
|
+
returns a result without `isError: true`, that result as
|
|
122
|
+
`gen_ai.tool.call.result`. Both the gateway's `SERVER` and `CLIENT` spans carry
|
|
123
|
+
them, as JSON strings capped at 8,192 characters. Only the boolean `true` turns
|
|
124
|
+
capture on.
|
|
125
|
+
|
|
126
|
+
```jsonc
|
|
127
|
+
{
|
|
128
|
+
"rewritePattern": "https://mcp.linear.app/mcp",
|
|
129
|
+
"telemetry": { "captureToolCallContent": true },
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Tool arguments and results often contain personal or otherwise sensitive data,
|
|
134
|
+
so turn this on only when your trace destination is allowed to store it. See
|
|
135
|
+
[Capture tool call content](../../articles/opentelemetry.mdx#capture-tool-call-content).
|
|
136
|
+
|
|
115
137
|
## Behavior
|
|
116
138
|
|
|
117
139
|
### GET returns 405
|
|
@@ -162,6 +162,24 @@ session affinity — any node can serve any request. Stateful MCP features
|
|
|
162
162
|
(long-running subscriptions, server-initiated sampling) aren't supported through
|
|
163
163
|
the gateway today.
|
|
164
164
|
|
|
165
|
+
### Streamed responses
|
|
166
|
+
|
|
167
|
+
An upstream can answer a POST with a single JSON body or with an event stream
|
|
168
|
+
(`text/event-stream`). The gateway relays an event stream to the client as the
|
|
169
|
+
upstream sends it, without buffering it to the end, so progress notifications
|
|
170
|
+
and partial results reach the client right away.
|
|
171
|
+
|
|
172
|
+
If the upstream's event stream ends or fails before it answers a request, the
|
|
173
|
+
gateway sends a JSON-RPC `-32603` error for each unanswered request, so the
|
|
174
|
+
client isn't left waiting. The error message says whether the gateway's request
|
|
175
|
+
timeout ended the stream or the upstream did.
|
|
176
|
+
|
|
177
|
+
For a request on MCP protocol `2026-07-28`, with
|
|
178
|
+
[`2026-07-28` support](./reference.mdx#mcp-protocol-2026-07-28) turned on, a
|
|
179
|
+
client that disconnects or closes the response stream cancels the upstream
|
|
180
|
+
request. On `2025-11-25` and earlier, MCP doesn't treat a disconnect as a
|
|
181
|
+
cancellation, so a request the gateway has already sent upstream keeps running.
|
|
182
|
+
|
|
165
183
|
## Configuration model
|
|
166
184
|
|
|
167
185
|
The MCP Gateway is configured the same way as the rest of a Zuplo project: an
|
|
@@ -245,8 +263,9 @@ to the upstream URL, and emits capability analytics events.
|
|
|
245
263
|
|
|
246
264
|
A few capabilities are intentionally out of scope, at least today:
|
|
247
265
|
|
|
248
|
-
- **No stateful sessions.** The gateway doesn't open SSE
|
|
249
|
-
`MCP-Session-Id`, and doesn't proxy server-initiated
|
|
266
|
+
- **No stateful sessions.** The gateway doesn't open server-initiated SSE
|
|
267
|
+
streams, doesn't track `MCP-Session-Id`, and doesn't proxy server-initiated
|
|
268
|
+
requests.
|
|
250
269
|
- **No `tools/list` caching.** Every request goes upstream. If an upstream is
|
|
251
270
|
slow to list capabilities, callers feel it.
|
|
252
271
|
- **No prompt-injection or PII scanning at the policy level.** These belong in a
|