@procedures/mcp-server 0.18.0 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @procedures/mcp-server
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5cb934d: Breaking: a `ProcedureServer` with a token or a request hook (`principalOf`) refuses a request without credentials (CLI-1). The error code is `UNAUTHORIZED`, and the hook does not run for it. Before, such a request skipped the token check and the request hook. Thus a face that set no credentials, for example a custom transport, went around the authentication.
8
+
9
+ New: the local marker `LOCAL_CREDENTIALS`, with `isLocalCredentials()` and its key `LOCAL_MARKER`. A local face sets it. Only a local request skips the token and the request hook.
10
+
11
+ The server examines a request in one of three ways:
12
+
13
+ - A local request skips the token and the request hook.
14
+ - A request without credentials gets `UNAUTHORIZED` when the server has a token or a request hook.
15
+ - A request with credentials goes through the request hook and the token check, as before.
16
+
17
+ - The local faces are MCP over stdio, an SDK transport of `McpServerTransport` and `PortTransport`. The peer of stdio is the parent process. Only the holder of the other end of a port can send to it.
18
+ - A network face never sets the marker: HTTP, WebSocket and MCP over Streamable HTTP. The key of the marker is a symbol. JSON, structured clone, a header, a cookie and a query cannot carry it.
19
+ - The calls of a WebSocket server to the `serve` handler of its client are not local. Their credentials are empty, so a `serve` server with a token refuses them.
20
+ - `PortTransport` has the new option `credentials`. Give `{}` for a port that a part outside the application can reach, for example a `Window`.
21
+ - The nested calls of a procedure do not go through the token check. They keep the principal of their caller.
22
+
23
+ Migration:
24
+
25
+ - A custom transport or face that sends no credentials to a server with a token or a request hook now gets `UNAUTHORIZED`. Set the credentials of its request (`requestCredentials()`), or `LOCAL_CREDENTIALS` for a face in this process.
26
+ - Code that calls `server.handle()` of a server with a token or a request hook gives `credentials: LOCAL_CREDENTIALS`.
27
+ - The site: no change. Its servers have no token and no request hook, and its workers serve over `PortTransport`, which sets the marker.
28
+ - MiniMongo: no change. `scripts/dev.ts` starts a server without a token and without a request hook. Its HTTP and WebSocket faces set the credentials of each request.
29
+ - Graph: no change. The procedure host (`packages/server/graph-host.ts`) has a request hook (`graphPrincipalOf` of `packages/server/graph-procedures.ts`) and no token. All its faces send credentials: HTTP, WebSocket and MCP over Streamable HTTP (`mcpFace`). No code of Graph calls `handle()` directly. The MCP host (`packages/mcp/src/host.ts`) operates over stdio, which is local.
30
+ - jarvis: no change. The loopback server and the remote server of `packages/http/src/procedures.ts` have a request hook (`principalOf`), and the remote server has a token. `makeProcedureHandler` mounts `procedureHandler`, which sends the credentials of each request. A test that calls `handle()` of such a server gives `LOCAL_CREDENTIALS`, or credentials with the token.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [5cb934d]
35
+ - @procedures/client@0.19.0
36
+ - @procedures/mcp@0.19.0
37
+
38
+ ## 0.18.1
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [d69c8cb]
43
+ - Updated dependencies [0379278]
44
+ - @procedures/client@0.18.1
45
+ - @procedures/mcp@0.18.1
46
+
3
47
  ## 0.18.0
4
48
 
5
49
  ### Patch Changes
package/README.md CHANGED
@@ -109,7 +109,7 @@ Each face is one `McpServerTransport` on the server of the host. A host can have
109
109
 
110
110
  When the client closes the input of stdio, the host stops, and `closed` resolves.
111
111
 
112
- Each tool call over Streamable HTTP carries the credentials of its HTTP request: the bearer token, the cookies, the headers and the query. Thus the request hook of the policy (`principalOf`) and the token check of the server apply to each call. When the server reads cookies, the face trusts a request with a cookie only from a named origin (CSRF). A call over stdio comes from this process and has no credentials.
112
+ Each tool call over Streamable HTTP carries the credentials of its HTTP request: the bearer token, the cookies, the headers and the query. Thus the request hook of the policy (`principalOf`) and the token check of the server apply to each call. When the server reads cookies, the face trusts a request with a cookie only from a named origin (CSRF). A call over stdio or over a given SDK transport is local: it has the local marker `LOCAL_CREDENTIALS` (CLI-1). The peer of stdio is the parent process. Thus a host with a token serves the calls of its stdio face.
113
113
 
114
114
  The Streamable HTTP face checks each request with `guardMcpRequest` before the request reaches the MCP SDK. The owner of another listener calls the same function.
115
115