@goodtiming/baton-sdk 0.6.3 → 0.6.5

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/README.md CHANGED
@@ -36,7 +36,7 @@ Copy the DSN from **/account**. It packs four values: the collector to send to,
36
36
 
37
37
  **Installing changes what your server advertises.** Each tool handler is wrapped, one sentence is added below your server's own `instructions`, and a `user_goal` parameter is added to every tool's schema and stripped again before your handler sees it. With `reportMode: "on"`, an annotation tool is also registered, named from your server's own name (slugged, `<server-name>_annotate`, so `your-vendor-mcp_annotate` here), and the added text tells the agent when to report a problem with it. [What gets injected](https://goodtiming.ai/docs.html#injected-tools).
38
38
 
39
- With no DSN and no sink, events go to `StdoutSink`, which writes to stderr, so a stdio server's stdout stays clean and nothing goes over the network.
39
+ With no DSN, no `vendorId`, no `tenantId` and no sink, `withBaton` warns once and installs nothing: your server starts as usual and nothing is recorded. A setting with a value that is not valid still throws, and so does a `tenantId` or sink without a `vendorId`. With a `vendorId` and no DSN or sink, events go to `StdoutSink`, which writes to stderr, so a stdio server's stdout stays clean and nothing goes over the network.
40
40
 
41
41
  **If you distribute your server, put the DSN in your source.** A stdio server runs on your user's machine, spawned by their MCP client. The official client SDKs pass it a fixed six-variable allowlist (`HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, `USER`), plus whatever that user wrote in their own client config. Nothing from your `.env` is in either list, so a server configured that way captures nothing while appearing to work.
42
42
 
@@ -66,7 +66,7 @@ Call `await baton.aclose()` in your own shutdown path, after the HTTP server sto
66
66
 
67
67
  What a stateless server costs, with either function:
68
68
 
69
- - **Every request is its own session.** The protocol gives a stateless server no session id, so the SDK does not invent a join between two requests. To see one person's requests together, return a principal from `resolvePrincipal` ([Who is calling](#who-is-calling)): the Console lists sessions by person. If your HTTP handler has already authenticated the request, hand the user to the hook as `authInfo`. On `@modelcontextprotocol/sdk` 1.x that is `req.auth`, shown here; on `@modelcontextprotocol/server` 2.x pass `{ authInfo }` when you hand the request to the transport:
69
+ - **Every request is its own session**, unless the client sends an `mcp-session-id` header: then its requests share that session, and `createBaton` numbers them in order across requests. Without one, a stateless server has no session id, and the SDK does not invent a join between two requests. To see one person's requests together, return a principal from `resolvePrincipal` ([Who is calling](#who-is-calling)): the Console lists sessions by person. If your HTTP handler has already authenticated the request, hand the user to the hook as `authInfo`. On `@modelcontextprotocol/sdk` 1.x that is `req.auth`, shown here; on `@modelcontextprotocol/server` 2.x pass `{ authInfo }` when you hand the request to the transport:
70
70
 
71
71
  ```js
72
72
  const baton = createBaton({
@@ -85,7 +85,7 @@ What a stateless server costs, with either function:
85
85
  });
86
86
  ```
87
87
 
88
- Signals that need several calls in one session, such as a retry loop, do not fire across requests.
88
+ Without that header, signals that need several calls in one session, such as a retry loop, do not fire across requests.
89
89
  - **The client is named from its `User-Agent`.** A client states its name in the `initialize` handshake, and a per-request server never sees the handshake of the call it is serving. Each event still carries the request's `User-Agent` header in `client_observed`, and your dashboard names the client from that.
90
90
 
91
91
  ## Without MCP: the library API
@@ -259,8 +259,9 @@ Checking it worked: `handle.sink` is still an object, so finding one there is no
259
259
  None of it blocks the quickstart above.
260
260
 
261
261
  - Only the high-level `McpServer`. The low-level `Server` is not wrapped.
262
- - **Task-based tools are not wrapped, and are not left alone either.** A 1.x tool registered with an object at `.handler` rather than a function produces no `tool_call_*` events at all, and nothing reports that. It still gets the intent parameters added to its advertised schema, because injection runs before the wrap is skipped and the strip only happens inside the wrapper. So `user_goal` can arrive in your own handler's arguments. Tools on the same server registered the ordinary way are unaffected. ⚠ **The request-level seam above does not rescue this one**: it reports only on tools this package wrapped, so a task-based tool emits nothing even for a rejected argument, where an unknown tool now emits a `tool_call_error`.
262
+ - **Task-based tools are not wrapped.** A 1.x tool registered with an object at `.handler` rather than a function produces no `tool_call_*` events at all, and nothing reports that. It still advertises `user_goal`, which Baton removes from the call before your handler sees it, wherever it can reach the server's `tools/call` handler. Tools on the same server registered the ordinary way are unaffected. ⚠ **The request-level seam above does not rescue this one**: it reports only on tools this package wrapped, so a task-based tool emits nothing even for a rejected argument, where an unknown tool now emits a `tool_call_error`.
263
263
  - Intent parameters need a Zod schema. On the 2.x SDK a tool registered with a non-Zod standard schema is still wrapped and still emits `tool_call_*`; it just advertises no intent parameters.
264
+ - `resources/templates/list` sends no events.
264
265
  - v2's `createMcpHandler` is tested only for calls that pause for input. A server built per request by your own code is supported: see [A server per request](#a-server-per-request).
265
266
 
266
267
  ## Wire compatibility