zuplo 7.14.6 → 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.
@@ -66,7 +66,7 @@ request:
66
66
  - `upstreamServerId` — the upstream id from the token exchange policy, populated
67
67
  once the upstream is resolved.
68
68
  - `subjectId` — the authenticated user's stable subject id, populated once the
69
- bearer token is validated.
69
+ token exchange policy resolves the user.
70
70
 
71
71
  These fields make it trivial to filter a log provider by route, upstream, or
72
72
  user without scanning message bodies. The same three identifiers also appear on
@@ -141,6 +141,30 @@ logs in OTLP format. Traces include spans for the request, every inbound policy
141
141
  (`mcp-*-inbound`), the handler, and the upstream fetch; logs export the same
142
142
  structured entries described above with their `event` field preserved.
143
143
 
144
+ For every MCP message it proxies, the gateway also records two spans that follow
145
+ the OpenTelemetry semantic conventions for MCP:
146
+
147
+ - A `SERVER` span for the message as the gateway received it from the MCP
148
+ client, for example `tools/call`, with attributes such as `mcp.method.name`,
149
+ `gen_ai.tool.name`, `mcp.session.id`, `mcp.protocol.version`, and the client's
150
+ IP address as `client.address`.
151
+ - A `CLIENT` span, its child, for the message as the gateway forwarded it to the
152
+ upstream MCP server, with the upstream's `server.address` and `server.port`.
153
+ The upstream fetch nests under it.
154
+
155
+ Failed operations carry an `error.type`, such as `tool_error`, a JSON-RPC error
156
+ code, an HTTP status code, or `cancelled`. The gateway also adds the `CLIENT`
157
+ span's trace context to the forwarded message's `params._meta`, so an upstream
158
+ server that reads it continues the same trace. See
159
+ [MCP tracing](../../articles/opentelemetry.mdx#mcp-tracing) for the full span
160
+ and attribute reference and an example trace.
161
+
162
+ To also record tool call arguments and results on both spans, set
163
+ `telemetry.captureToolCallContent` to `true` in the route's
164
+ [`McpProxyHandler` options](../code-config/mcp-proxy-handler.mdx). It's off by
165
+ default. See
166
+ [Capture tool call content](../../articles/opentelemetry.mdx#capture-tool-call-content).
167
+
144
168
  Registering both plugins is a small addition to `modules/zuplo.runtime.ts`:
145
169
 
146
170
  ```ts title="modules/zuplo.runtime.ts"
@@ -116,11 +116,11 @@ DCR requests that include any other scope value are rejected with
116
116
 
117
117
  ### Required on requests to MCP routes
118
118
 
119
- | Header | Required | Notes |
120
- | --------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------- |
121
- | `Authorization: Bearer <token>` | Yes (after initial 401) | Opaque access token issued by `/__zuplo/oauth/token`. Tokens in query strings are rejected. |
122
- | `Accept: application/json, text/event-stream` | Yes | Per the Streamable HTTP transport spec. The gateway forwards the body as-is. |
123
- | `MCP-Protocol-Version: 2025-11-25` | Yes after `initialize` | Per the MCP spec. The gateway tracks the current MCP protocol revision. |
119
+ | Header | Required | Notes |
120
+ | --------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
121
+ | `Authorization: Bearer <token>` | Yes (after initial 401) | Opaque access token issued by `/__zuplo/oauth/token`. Tokens in query strings are rejected. |
122
+ | `Accept: application/json, text/event-stream` | Yes | Per the Streamable HTTP transport spec. The gateway forwards the body as-is. |
123
+ | `MCP-Protocol-Version` | Yes after `initialize` | The version the client negotiated, for example `2025-11-25`. See [Supported MCP protocol versions](#supported-mcp-protocol-versions). |
124
124
 
125
125
  ### Honored when present
126
126
 
@@ -138,6 +138,87 @@ or CDN propagates one of those headers correctly.
138
138
  Inbound auth headers don't leak to the upstream — the gateway sets its own
139
139
  upstream `Authorization` header.
140
140
 
141
+ ## Supported MCP protocol versions
142
+
143
+ The gateway implements MCP protocol revision `2025-11-25`. It advertises that
144
+ version as `mcp_protocol_version` in Protected Resource Metadata and uses it for
145
+ the readiness check it sends to each upstream.
146
+
147
+ The gateway doesn't pick the protocol version for a session. The client and the
148
+ upstream MCP server negotiate it in `initialize`, and the gateway relays
149
+ requests on any earlier revision the two agree on, such as `2025-06-18` or
150
+ `2025-03-26`. Send the negotiated version in the `MCP-Protocol-Version` header
151
+ on every request after `initialize`.
152
+
153
+ ### MCP protocol `2026-07-28`
154
+
155
+ Support for revision `2026-07-28` starts with compatibility date
156
+ [`2026-11-06`](../programmable-api/compatibility-dates.mdx#2026-11-06). A
157
+ request counts as a `2026-07-28` request when its `MCP-Protocol-Version` header
158
+ or its `params._meta` envelope names `2026-07-28` or a later revision.
159
+ `2026-07-28` has no JSON-RPC batches.
160
+
161
+ From compatibility date `2026-11-06`, the gateway handles `2026-07-28` requests
162
+ as that revision requires:
163
+
164
+ - `2026-07-28` removes the `initialize` handshake, and clients call
165
+ `server/discover` instead. The gateway answers `server/discover` itself for a
166
+ caller that hasn't connected the upstream yet, and forwards it once the caller
167
+ has. Its own reply lists the protocol versions the upstream serves, once the
168
+ gateway has seen the upstream's list, and `2026-07-28` plus `2025-11-25` and
169
+ earlier until then.
170
+ - The gateway already adds the configured server icons (`serverInfo.icons`) to a
171
+ JSON `initialize` reply that has none. From compatibility date `2026-11-06`,
172
+ it also adds them to `server/discover` replies and to replies the upstream
173
+ sends as an event stream.
174
+ - Upstream readiness checks fall back to `server/discover` when an upstream
175
+ refuses `initialize`.
176
+ - For a caller that hasn't connected the upstream, the gateway answers these
177
+ requests itself:
178
+ - `tools/call`, `prompts/get`, and `resources/read` get an `input_required`
179
+ result with a connect link, or a `-32021` error when the client doesn't
180
+ support URL elicitation.
181
+ - `tools/list`, `prompts/list`, `resources/list`, and
182
+ `resources/templates/list` get an empty list with `ttlMs: 0` and
183
+ `cacheScope: "private"`, so the client lists again after it connects.
184
+ - The methods `2026-07-28` removed, such as `ping` and `logging/setLevel`, get
185
+ HTTP `404` with `-32601`.
186
+ - A notification gets HTTP `202` with no body. Any other request gets JSON-RPC
187
+ error `-32603` with the connect link in `data.connectRequired`.
188
+ - Before it answers, the gateway checks the request as a `2026-07-28` server
189
+ does. A missing or malformed `_meta` envelope gets HTTP `400` with `-32602`,
190
+ a missing `MCP-Protocol-Version`, `Mcp-Method`, or `Mcp-Name` header, or one
191
+ that disagrees with the body, gets `-32020`, and an unsupported revision
192
+ gets `-32022`. A JSON-RPC batch gets `-32600`.
193
+ - A client that closes the response stream of a `2026-07-28` request cancels the
194
+ upstream request. On `subscriptions/listen`, the request timeout limits only
195
+ the wait for response headers, so the stream can stay open.
196
+ - The gateway's OAuth authorization responses include the RFC 9207 `iss`
197
+ parameter.
198
+
199
+ On earlier compatibility dates, the gateway relays `2026-07-28` traffic without
200
+ handling it as that revision. An upstream that answers only `server/discover` is
201
+ reported as unavailable, and a caller that hasn't connected the upstream gets
202
+ the `-32042` URL-elicitation error, which `2026-07-28` clients can't act on.
203
+
204
+ From compatibility date `2026-11-06`, requests on `2025-11-25` and earlier also
205
+ see the project-wide changes above (the readiness fallback, the `iss` parameter,
206
+ and icons on event-stream `initialize` replies) and the changes in
207
+ [Gateway answers follow the MCP specification](./code-config/compatibility-dates.mdx#gateway-answers-follow-the-mcp-specification).
208
+ See [MCP Gateway compatibility dates](./code-config/compatibility-dates.mdx) for
209
+ the full list of changes and
210
+ [Compatibility dates](../programmable-api/compatibility-dates.mdx#2026-11-06)
211
+ for the other changes the same date makes.
212
+
213
+ :::note
214
+
215
+ The [MCP Server handler](../handlers/mcp-server.mdx#mcp-protocol-2026-07-28)
216
+ also serves `2026-07-28` from compatibility date `2026-11-06`. On an earlier
217
+ compatibility date, it serves `2024-10-07` through `2025-11-25` and answers any
218
+ other `MCP-Protocol-Version` with HTTP `400`.
219
+
220
+ :::
221
+
141
222
  ## Compatibility date
142
223
 
143
224
  MCP Gateway features require `compatibilityDate >= 2026-03-01` in `zuplo.jsonc`:
@@ -70,7 +70,11 @@ client to re-request.
70
70
  **Symptom.** The first tool call after authentication returns a JSON-RPC error
71
71
  with `code: -32042` and a payload containing `"state": "authenticating"` and an
72
72
  `authUrl`. The MCP client either opens a browser tab (modern clients) or
73
- surfaces the URL for the user to copy (older clients).
73
+ surfaces the URL for the user to copy (older clients). From compatibility date
74
+ [`2026-11-06`](../programmable-api/compatibility-dates.mdx#2026-11-06), the
75
+ error code is `-32603`, with the same `data.connectRequired` payload, unless the
76
+ request is an `initialize` that declares URL elicitation. See
77
+ [Connect-required states](./auth/upstream-oauth.mdx#connect-required-states).
74
78
 
75
79
  **Likely cause.** This is expected behavior. The gateway requires each user to
76
80
  complete the upstream OAuth flow once per upstream. After the first connection,