@procedures/mcp-server 0.46.0 → 0.47.2

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,40 @@
1
1
  # @procedures/mcp-server
2
2
 
3
+ ## 0.47.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0650616]
8
+ - Updated dependencies [ae1e3fd]
9
+ - Updated dependencies [f1ece74]
10
+ - @procedures/client@0.47.2
11
+ - @procedures/mcp@0.47.2
12
+
13
+ ## 0.47.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [f845c6d]
18
+ - @procedures/client@0.47.1
19
+ - @procedures/mcp@0.47.1
20
+
21
+ ## 0.47.0
22
+
23
+ ### Patch Changes
24
+
25
+ - e913014: Each module imports zod with `import * as z from "zod"`, not `import { z } from "zod"`. With the old form, an esbuild bundle got each locale of zod: 264 kB of minified code (esbuild metafile of the journey worker of the site). The Vite build of the site gives the same worker files with both forms. The procedure scaffolder writes the new form in `types.ts`. The API and the behavior stay the same.
26
+ - Updated dependencies [c9125a8]
27
+ - Updated dependencies [335728b]
28
+ - Updated dependencies [d987202]
29
+ - Updated dependencies [45a737f]
30
+ - Updated dependencies [d77e9e8]
31
+ - Updated dependencies [e913014]
32
+ - Updated dependencies [2f0c7b0]
33
+ - Updated dependencies [ad70c38]
34
+ - Updated dependencies [47819c6]
35
+ - @procedures/client@0.47.0
36
+ - @procedures/mcp@0.47.0
37
+
3
38
  ## 0.46.0
4
39
 
5
40
  ### Patch Changes
@@ -104,7 +139,7 @@
104
139
 
105
140
  - A caller that reads the code of a 413 from the HTTP handler compares it with `PAYLOAD_TOO_LARGE`, not `INVALID_REQUEST`.
106
141
  - A caller of `WebSocketTransport` that retries each failed call stops at `retryable: false`. A call above the limit of the server fails the same way each time.
107
- - The site, MiniMongo, Graph and jarvis: no step, unless one of them compares the code of a refused large request with `INVALID_REQUEST`.
142
+ - Apps: no step, unless one of them compares the code of a refused large request with `INVALID_REQUEST`.
108
143
  - Updated dependencies [55d1e4d]
109
144
  - @procedures/client@0.39.0
110
145
  - @procedures/mcp@0.39.0
@@ -133,7 +168,7 @@
133
168
 
134
169
  - A caller of `cli-kit` with a `format` hook for a path with a dotted segment writes the key in the encoded form, for example `a.b%2Ec`.
135
170
  - A reader of the ecosystem scan that splits a `key` on `.` uses `keyToPath(key)`.
136
- - The site, MiniMongo, Graph and jarvis: no step, if their procedure paths have no segment with `.` or `%`.
171
+ - Apps: no step, if their procedure paths have no segment with `.` or `%`.
137
172
  - Updated dependencies [c6fba49]
138
173
  - @procedures/client@0.38.0
139
174
  - @procedures/mcp@0.38.0
@@ -205,7 +240,7 @@
205
240
 
206
241
  Migration:
207
242
 
208
- - The site, MiniMongo, Graph and jarvis: no change at this time. The deprecated names work until the next MINOR.
243
+ - Apps: no change at this time. The deprecated names work until the next MINOR.
209
244
  - Before the next MINOR, replace `zodAdapter<T>(schema)` with `schema`. To keep the check of a schema against a type, write `const schema: z.ZodType<T> = ...`.
210
245
  - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
211
246
  - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
@@ -437,13 +472,13 @@
437
472
  - A face of your own that gives `mcpFace()` a handler of its own: give the handler `admission: (credentials) => server.admission(credentials)`.
438
473
  - An MCP client that a request hook refuses gets 401 at `initialize`. Give it valid credentials for each HTTP request.
439
474
  - The site: no change. It has no MCP host, and it used no function of `peer/security.ts`.
440
- - MiniMongo: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
441
- - Graph: its `mcpFace()` on the procedures host uses `graphPrincipalOf` for each HTTP request. In the accounts mode, a request without a session gets `ANONYMOUS`. Thus an MCP client without a session gets no 401 at `initialize`.
442
- - Graph: in the mode `on` (`AUTH_MODE=on`), a request without a tenant token gets 401 at `initialize`. Before, the client opened a session and listed the tools, and each tool call got `UNAUTHORIZED`.
443
- - Graph: accounts that are not ready (the error `UNAVAILABLE` of the hook) give 401 at `initialize`, with `WWW-Authenticate: Bearer`. Before, `initialize` passed, and each tool call got `UNAUTHORIZED`. An MCP client can start its OAuth discovery on this 401.
444
- - Graph: outside the accounts mode, the policy has `allowedOrigins: "*"`. The MCP face takes it, as the HTTP face does. A request with a cookie still needs a named origin. With the default `ambientCredentials: "always"` of its request hook, `"*"` permits no other origin.
445
- - Graph: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
446
- - jarvis: no change. Its procedures host has only the HTTP face, and its MCP host has only stdio and SDK faces.
475
+ - An app: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
476
+ - An app: its `mcpFace()` on the procedures host uses a session hook for each HTTP request. In the accounts mode, a request without a session gets `ANONYMOUS`. Thus an MCP client without a session gets no 401 at `initialize`.
477
+ - An app: in the mode `on` (`AUTH_MODE=on`), a request without a tenant token gets 401 at `initialize`. Before, the client opened a session and listed the tools, and each tool call got `UNAUTHORIZED`.
478
+ - An app: accounts that are not ready (the error `UNAVAILABLE` of the hook) give 401 at `initialize`, with `WWW-Authenticate: Bearer`. Before, `initialize` passed, and each tool call got `UNAUTHORIZED`. An MCP client can start its OAuth discovery on this 401.
479
+ - An app: outside the accounts mode, the policy has `allowedOrigins: "*"`. The MCP face takes it, as the HTTP face does. A request with a cookie still needs a named origin. With the default `ambientCredentials: "always"` of its request hook, `"*"` permits no other origin.
480
+ - An app: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
481
+ - An app: no change. Its procedures host has only the HTTP face, and its MCP host has only stdio and SDK faces.
447
482
  - `mark mcp --http --token` and `@procedures/mcp-dev-tools`: no change for a client. The token is the token of the server, and the server checks each HTTP request one time.
448
483
 
449
484
  ### Patch Changes
@@ -518,9 +553,9 @@
518
553
  - A test that expects `retryable: false` for such an end before the first item: expect the flag of the code.
519
554
  - A custom `errorOf` of `writeNdjsonStream`: read its second parameter to give the same rule.
520
555
  - The site: no change is necessary. The lab simulates its server with explicit flags. The streams of the journey do not fail.
521
- - MiniMongo: no change is necessary. Its browser client has the retry middleware, but its procedures throw no `UNAVAILABLE`, `CONNECTION_CLOSED` or `RATE_LIMITED` without a flag.
522
- - Graph: no change is necessary. Its handlers give `UNAVAILABLE` with an explicit flag, and it serves no stream procedure of its own.
523
- - jarvis: no change is necessary. The cuts of its host have their own flag, and it uses no retry middleware.
556
+ - An app: no change is necessary. Its browser client has the retry middleware, but its procedures throw no `UNAVAILABLE`, `CONNECTION_CLOSED` or `RATE_LIMITED` without a flag.
557
+ - An app: no change is necessary. Its handlers give `UNAVAILABLE` with an explicit flag, and it serves no stream procedure of its own.
558
+ - An app: no change is necessary. The cuts of its host have their own flag, and it uses no retry middleware.
524
559
 
525
560
  ### Patch Changes
526
561
 
@@ -536,7 +571,7 @@
536
571
 
537
572
  The doc comments of these options, of `guardMcpRequest` and of `McpHostFaces.http` have the deprecation notes. The README of the package has the section "Deprecated token options".
538
573
 
539
- `mark mcp --http --token` and `@procedures/mcp-dev-tools`: no change for a client. The site, MiniMongo, Graph and jarvis: no change in this release.
574
+ `mark mcp --http --token` and `@procedures/mcp-dev-tools`: no change for a client. Apps: no change in this release.
540
575
  - Updated dependencies [75bff3b]
541
576
  - Updated dependencies [16562ee]
542
577
  - @procedures/client@0.25.0
@@ -557,7 +592,7 @@
557
592
 
558
593
  `WIRE-PROTOCOL.md` (section "Error codes") and the doc comments of `errorResponse`, `defaultNdjsonError`, `errorStatus` and `streamErrorMeta` have the deprecation notes.
559
594
 
560
- The site, MiniMongo, Graph and jarvis: no change in this release.
595
+ Apps: no change in this release.
561
596
  - Updated dependencies [2735505]
562
597
  - @procedures/client@0.24.1
563
598
  - @procedures/mcp@0.24.1
@@ -594,9 +629,9 @@
594
629
 
595
630
  Migration:
596
631
 
597
- - The site and MiniMongo: no change. They have no MCP host.
598
- - Graph: no change. Its MCP hosts have no task store.
599
- - jarvis: no change. Its MCP host has no tasks.
632
+ - The site and an app: no change. They have no MCP host.
633
+ - An app: no change. Its MCP hosts have no task store.
634
+ - An app: no change. Its MCP host has no tasks.
600
635
  - polite-crawler-mcp: no change. Each request has the host token, so each session is one client. A session with 100 tasks gets fewer tasks only when ten or more sessions are near the limit. To keep the rule of CLI-51, give `new McpTaskStore({ reserve: 0 })`.
601
636
  - A host whose clients each have many sessions under one principal: each client keeps at most `maxStored - reserve` tasks. To keep the rule of CLI-51, give `reserve: 0` in `tasks` of the host or in `new McpTaskStore()`.
602
637
 
@@ -640,9 +675,9 @@
640
675
 
641
676
  - A host with more than 256 clients at one time: give a larger `maxSessions`, or `maxSessions: Infinity` for no limit. Give it in `faces.http` of `createMcpHost()`, in `mcpFace()`, or with `mark mcp --http <port> --max-sessions <n>`.
642
677
  - A host that keeps more than 1000 tasks: give a larger `maxStored`, or `maxStored: Infinity`, in `tasks` of the host or in `new McpTaskStore()`.
643
- - The site and MiniMongo: no change. They have no MCP host.
644
- - Graph: no change. Its `mcpFace()` on the procedures host gets the limit of 256 sessions, and its MCP host over stdio has no HTTP face. To keep no limit, give `mcpFace({ maxSessions: Infinity })`.
645
- - jarvis: no change. Its MCP host has only stdio and SDK faces, and it has no tasks.
678
+ - The site and an app: no change. They have no MCP host.
679
+ - An app: no change. Its `mcpFace()` on the procedures host gets the limit of 256 sessions, and its MCP host over stdio has no HTTP face. To keep no limit, give `mcpFace({ maxSessions: Infinity })`.
680
+ - An app: no change. Its MCP host has only stdio and SDK faces, and it has no tasks.
646
681
  - polite-crawler-mcp: no change for the sessions, because it sets `maxSessions: 32`. Its `McpTaskStore` gets the limit of 1000 stored tasks. Before, 32 sessions of 100 tasks bounded the store at 3200 tasks. To keep that bound, give `new McpTaskStore({ maxStored: 3200 })`.
647
682
  - polite-crawler-mcp also gives the deprecated option `mount: true`, which has no effect. Remove it when it moves to the new range.
648
683
 
@@ -691,9 +726,9 @@
691
726
  - 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.
692
727
  - Code that calls `server.handle()` of a server with a token or a request hook gives `credentials: LOCAL_CREDENTIALS`.
693
728
  - The site: no change. Its servers have no token and no request hook, and its workers serve over `PortTransport`, which sets the marker.
694
- - 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.
695
- - 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.
696
- - 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.
729
+ - An app: 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.
730
+ - An app: no change. Its procedure host has a request hook and no token. All its faces send credentials: HTTP, WebSocket and MCP over Streamable HTTP (`mcpFace`). No code of the app calls `handle()` directly. Its MCP host operates over stdio, which is local.
731
+ - An app: no change. Its loopback server and its remote server 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.
697
732
 
698
733
  ### Patch Changes
699
734
 
@@ -775,7 +810,7 @@
775
810
 
776
811
  - A host with `faces.http: { port, host }`: give `faces.http: {}`. Mount `host.handleHttp` on a listener, for example an `httpTransport` of `@mark1russell7/service/http`, and declare the listener and the host on a service (`host.declare(svc)`). The README of `@procedures/mcp-server` has the example.
777
812
  - A caller of `startDevToolsServer()`: call `runDevToolsServer(config)`.
778
- - The site, MiniMongo, Graph and jarvis: no change. Graph mounts `mcpFace()` on its procedures host, and its stdio MCP host and the host of jarvis use stdio and SDK faces.
813
+ - Apps: no change. One app mounts `mcpFace()` on its procedures host, and its stdio MCP host and the host of another app use stdio and SDK faces.
779
814
 
780
815
  ### Patch Changes
781
816
 
@@ -818,7 +853,7 @@
818
853
  principalOf,
819
854
  limits: [
820
855
  {
821
- name: "graph.writes",
856
+ name: "app.writes",
822
857
  key: { claim: "tenant" },
823
858
  covers: { writes: true },
824
859
  policy: { type: "sliding-window", limit: { value: 120, unit: "count" }, window: { value: 1, unit: "min" } },
@@ -884,7 +919,7 @@
884
919
  - The listener of the Streamable HTTP face: the options `port`, `host` and `server` of `HttpTransportOptions`, and `McpHttpTransport.listen()`. Give `mount: true`, and mount `McpHost.handleHttp` on a listener of the service.
885
920
  - `startDevToolsServer()` of `@procedures/mcp-dev-tools`. Use `runDevToolsServer()`.
886
921
 
887
- Migration for the next MINOR: the site uses none of them. MiniMongo uses none of them. Graph mounts `mcpFace()` on its host, and its stdio host keeps `createMcpHost()` with `stdio`: no change. jarvis uses `createMcpHost()` with stdio and SDK faces: no change. A host with `faces.http: { port }` moves to `faces.http: { mount: true }` and a listener of the service.
922
+ Migration for the next MINOR: the site uses none of them. One app uses none of them. Another app mounts `mcpFace()` on its host, and its stdio host keeps `createMcpHost()` with `stdio`: no change. A third app uses `createMcpHost()` with stdio and SDK faces: no change. A host with `faces.http: { port }` moves to `faces.http: { mount: true }` and a listener of the service.
888
923
  - Updated dependencies [85999c1]
889
924
  - Updated dependencies [fc968f6]
890
925
  - Updated dependencies [dc7a462]
@@ -924,9 +959,9 @@
924
959
  - A caller that finds a cut by the code `INTERNAL_ERROR`: look for `UNAVAILABLE` in its place. Do not retry the call when `retryable` is false.
925
960
  - A handler that throws `UNAVAILABLE` with `retryable: false`: its HTTP status is 500 in place of 503. Without the flag, the error is retryable and gets 503. A retry middleware then sends the call again, so give `retryable: false` when the call can have had its effect.
926
961
  - The site: no change is necessary. Its code does not read the code of a cut, or the HTTP status 503.
927
- - MiniMongo: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
928
- - The procedures host of Graph (GRAPH-11): no change is necessary. Its code does not read `INTERNAL_ERROR`. Its error "the server has no AGENT_TOKEN" is `UNAVAILABLE` with `retryable: false`, so its HTTP status is 500 in place of 503. No code of Graph reads that status.
929
- - jarvis: no change is necessary. Its drain test already expects `UNAVAILABLE` with `retryable: false` for a cut procedure call (S6 A12). Its code reads only `NOT_FOUND` and `FORBIDDEN`.
962
+ - An app: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
963
+ - The procedures host of an app (APP-11): no change is necessary. Its code does not read `INTERNAL_ERROR`. Its error "the server has no AGENT_TOKEN" is `UNAVAILABLE` with `retryable: false`, so its HTTP status is 500 in place of 503. No code of the app reads that status.
964
+ - An app: no change is necessary. Its drain test already expects `UNAVAILABLE` with `retryable: false` for a cut procedure call (S6 A12). Its code reads only `NOT_FOUND` and `FORBIDDEN`.
930
965
  - The `mark` CLI and `procedure-server`: no change is necessary. The lifecycle test of CI-2 expects `UNAVAILABLE` for the cut of `lifecycle.ticksOnce`.
931
966
  - Updated dependencies [217a90f]
932
967
  - @procedures/client@0.14.0
@@ -1010,9 +1045,9 @@
1010
1045
 
1011
1046
  Migration steps:
1012
1047
 
1013
- - The site and MiniMongo: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
1014
- - The MCP host of Graph: no change is necessary. To share the port of the Graph host, mount `mcpFace()` on its listener.
1015
- - jarvis and Graph under `run()`: build the procedures with `createProcedureHost()`, and call `host.declare(svc)` in the service of the process. Give `listen` for a port of the host, or mount `host.handler` and `host.upgrade` on the listener of the app.
1048
+ - The site and an app: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
1049
+ - The MCP host of an app: no change is necessary. To share the port of its procedures host, mount `mcpFace()` on its listener.
1050
+ - Apps under `run()`: build the procedures with `createProcedureHost()`, and call `host.declare(svc)` in the service of the process. Give `listen` for a port of the host, or mount `host.handler` and `host.upgrade` on the listener of the app.
1016
1051
  - A caller of `createPeer()` with a different token for each transport: give one token.
1017
1052
  - A Docker `HEALTHCHECK` or a probe of Kubernetes that read `/health` of a peer: use the probes of the service. Give the service `probeServer({ port, server_retry_after })` on a port of its own, or mount `probeHandler(health, { prefix: "/health" })` on the port of the app. Both come from `@mark1russell7/service/http`, and they answer `/health/startup`, `/health/readiness` and `/health/liveness`. The lockfile check of a client calls `host.info` with the token of the lockfile.
1018
1053
  - A test that read `/health` of a peer: call `host.info` with the token, or check the status 404.
package/README.md CHANGED
@@ -43,10 +43,10 @@ import { createRegistry } from "@procedures/client";
43
43
  import { createMcpHost } from "@procedures/mcp-server";
44
44
 
45
45
  const host = createMcpHost({
46
- registry: createRegistry(graphModule),
47
- surface: { namespaces: ["graph"] },
46
+ registry: createRegistry(appModule),
47
+ surface: { namespaces: ["app"] },
48
48
  readOnly: process.argv.includes("--read-only"),
49
- name: "graph",
49
+ name: "app",
50
50
  version: "0.1.0",
51
51
  });
52
52
  await host.start();
@@ -375,9 +375,9 @@ import { mcpFace } from "@procedures/mcp-server";
375
375
 
376
376
  const faces = {
377
377
  http: true,
378
- mcp: mcpFace({ serverInfo: { name: "graph", version: "0.1.0" } }),
378
+ mcp: mcpFace({ serverInfo: { name: "app", version: "0.1.0" } }),
379
379
  // A read-only MCP face of the same server
380
- mcpRead: mcpFace({ path: "/mcp-read", serverInfo: { name: "graph", version: "0.1.0" }, narrowing: { effects: { writes: [] } } }),
380
+ mcpRead: mcpFace({ path: "/mcp-read", serverInfo: { name: "app", version: "0.1.0" }, narrowing: { effects: { writes: [] } } }),
381
381
  };
382
382
  ```
383
383