zuplo 7.14.8 → 7.15.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/LICENSE.txt +5 -78
- package/README.md +17 -0
- package/docs/articles/logging.mdx +8 -1
- package/docs/articles/opentelemetry.mdx +269 -0
- package/docs/concepts/project-structure.mdx +1 -1
- 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 +262 -3
- package/docs/programmable-api/logger.mdx +3 -0
- package/docs/programmable-api/runtime-extensions.mdx +14 -0
- package/docs/programmable-api/telemetry-redaction.mdx +308 -0
- package/docs/programmable-api/zuplo-json.mdx +2 -2
- package/package.json +6 -6
package/LICENSE.txt
CHANGED
|
@@ -1,80 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) Zuplo, Inc. All rights reserved.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"Software").
|
|
3
|
+
Use of this software is governed by the Zuplo Terms of Service at
|
|
4
|
+
https://zuplo.com/legal/terms, or by a separate agreement your company has
|
|
5
|
+
signed with Zuplo.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
by the terms of this Agreement. If you do not agree, do not install or use the
|
|
10
|
-
Software.
|
|
11
|
-
|
|
12
|
-
## 1. License Grant
|
|
13
|
-
|
|
14
|
-
Subject to the terms of this Agreement, Zuplo grants you a limited,
|
|
15
|
-
non-exclusive, non-transferable, non-sublicensable license to use the Software
|
|
16
|
-
**solely for internal local development purposes** and **only if you are an
|
|
17
|
-
active customer of Zuplo**.
|
|
18
|
-
|
|
19
|
-
## 2. Restrictions
|
|
20
|
-
|
|
21
|
-
You may **not**:
|
|
22
|
-
|
|
23
|
-
- Distribute, sublicense, lease, rent, or otherwise make the Software available
|
|
24
|
-
to any third party;
|
|
25
|
-
- Use the Software for any commercial purpose other than in connection with your
|
|
26
|
-
authorized use of Zuplo services;
|
|
27
|
-
- Reverse engineer, decompile, disassemble, or attempt to derive the source code
|
|
28
|
-
of the Software;
|
|
29
|
-
- Use the Software if you are not a current customer of Zuplo.
|
|
30
|
-
|
|
31
|
-
## 3. Intellectual Property Ownership
|
|
32
|
-
|
|
33
|
-
All intellectual property rights in and to the Software — including but not
|
|
34
|
-
limited to all code, documentation, interfaces, design, and trademarks — are and
|
|
35
|
-
shall remain the exclusive property of Zuplo and its licensors.
|
|
36
|
-
This Agreement does not grant you any rights, title, or interest in or to any
|
|
37
|
-
trademarks, trade secrets, copyrights, patents, or other intellectual property
|
|
38
|
-
owned by Zuplo, except for the limited license expressly set forth in Section 1.
|
|
39
|
-
|
|
40
|
-
Any feedback, suggestions, or improvements you provide regarding the Software
|
|
41
|
-
may be freely used by Zuplo without any obligation to you.
|
|
42
|
-
|
|
43
|
-
## 4. Open Source Software Notice
|
|
44
|
-
|
|
45
|
-
The Software may include or rely on components that are subject to separate open
|
|
46
|
-
source licenses. These components are not governed by this Agreement but instead
|
|
47
|
-
by their respective licenses.
|
|
48
|
-
|
|
49
|
-
Copies of the applicable open source licenses are provided in the distribution
|
|
50
|
-
of the Software.
|
|
51
|
-
|
|
52
|
-
## 5. Termination
|
|
53
|
-
|
|
54
|
-
This license is effective until terminated. It will automatically terminate
|
|
55
|
-
without notice if you cease to be a customer of Zuplo or fail to comply with any
|
|
56
|
-
term of this Agreement. Upon termination, you must immediately cease all use of
|
|
57
|
-
the Software and destroy all copies.
|
|
58
|
-
|
|
59
|
-
## 6. No Warranty
|
|
60
|
-
|
|
61
|
-
The Software is provided "**as is**," without warranty of any kind, express or
|
|
62
|
-
implied, including but not limited to the implied warranties of merchantability
|
|
63
|
-
or fitness for a particular purpose.
|
|
64
|
-
|
|
65
|
-
## 7. Limitation of Liability
|
|
66
|
-
|
|
67
|
-
In no event shall Zuplo be liable for any indirect, incidental, special, or
|
|
68
|
-
consequential damages, or damages for loss of profits, revenue, data, or use,
|
|
69
|
-
incurred by you or any third party, whether in an action in contract or tort,
|
|
70
|
-
arising from your use of the Software.
|
|
71
|
-
|
|
72
|
-
## 8. Governing Law
|
|
73
|
-
|
|
74
|
-
This Agreement is governed by and construed in accordance with the laws of the
|
|
75
|
-
State of Delaware, without regard to its conflict of law principles.
|
|
76
|
-
|
|
77
|
-
## 9. Entire Agreement
|
|
78
|
-
|
|
79
|
-
This Agreement constitutes the entire agreement between the parties with respect
|
|
80
|
-
to the Software and supersedes all prior or contemporaneous understandings.
|
|
7
|
+
See https://zuplo.com/legal/eula for more information.
|
package/README.md
CHANGED
|
@@ -20,3 +20,20 @@ This package includes offline documentation and policy reference content in the
|
|
|
20
20
|
```
|
|
21
21
|
node_modules/zuplo/docs/
|
|
22
22
|
```
|
|
23
|
+
|
|
24
|
+
## Usage data
|
|
25
|
+
|
|
26
|
+
The Zuplo CLI included in this package sends usage data and error reports to
|
|
27
|
+
Zuplo. Usage data includes the command you run, your Zuplo user ID (or, when you
|
|
28
|
+
aren't logged in, an identifier derived from your machine), the account and
|
|
29
|
+
project names you pass, whether it runs in CI, and your Node.js version,
|
|
30
|
+
operating system, CPU architecture, and package manager. To turn this off, set
|
|
31
|
+
`ZUPLO_DO_NOT_TRACK=1`. For how Zuplo handles this data, see the
|
|
32
|
+
[Zuplo Privacy Policy](https://zuplo.com/legal/privacy-policy).
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
Copyright (c) Zuplo, Inc. All rights reserved. Use of this package is governed
|
|
37
|
+
by the [Zuplo Terms of Service](https://zuplo.com/legal/terms), or by a separate
|
|
38
|
+
agreement your company has signed with Zuplo. See `LICENSE.txt` and
|
|
39
|
+
[zuplo.com/legal/eula](https://zuplo.com/legal/eula).
|
|
@@ -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
|