@procedures/mcp-server 0.47.1 → 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,15 @@
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
+
3
13
  ## 0.47.1
4
14
 
5
15
  ### Patch Changes
@@ -129,7 +139,7 @@
129
139
 
130
140
  - A caller that reads the code of a 413 from the HTTP handler compares it with `PAYLOAD_TOO_LARGE`, not `INVALID_REQUEST`.
131
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.
132
- - 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`.
133
143
  - Updated dependencies [55d1e4d]
134
144
  - @procedures/client@0.39.0
135
145
  - @procedures/mcp@0.39.0
@@ -158,7 +168,7 @@
158
168
 
159
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`.
160
170
  - A reader of the ecosystem scan that splits a `key` on `.` uses `keyToPath(key)`.
161
- - 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 `%`.
162
172
  - Updated dependencies [c6fba49]
163
173
  - @procedures/client@0.38.0
164
174
  - @procedures/mcp@0.38.0
@@ -230,7 +240,7 @@
230
240
 
231
241
  Migration:
232
242
 
233
- - 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.
234
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> = ...`.
235
245
  - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
236
246
  - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
@@ -462,13 +472,13 @@
462
472
  - A face of your own that gives `mcpFace()` a handler of its own: give the handler `admission: (credentials) => server.admission(credentials)`.
463
473
  - An MCP client that a request hook refuses gets 401 at `initialize`. Give it valid credentials for each HTTP request.
464
474
  - The site: no change. It has no MCP host, and it used no function of `peer/security.ts`.
465
- - MiniMongo: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
466
- - 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`.
467
- - 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`.
468
- - 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.
469
- - 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.
470
- - Graph: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
471
- - 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.
472
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.
473
483
 
474
484
  ### Patch Changes
@@ -543,9 +553,9 @@
543
553
  - A test that expects `retryable: false` for such an end before the first item: expect the flag of the code.
544
554
  - A custom `errorOf` of `writeNdjsonStream`: read its second parameter to give the same rule.
545
555
  - The site: no change is necessary. The lab simulates its server with explicit flags. The streams of the journey do not fail.
546
- - 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.
547
- - Graph: no change is necessary. Its handlers give `UNAVAILABLE` with an explicit flag, and it serves no stream procedure of its own.
548
- - 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.
549
559
 
550
560
  ### Patch Changes
551
561
 
@@ -561,7 +571,7 @@
561
571
 
562
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".
563
573
 
564
- `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.
565
575
  - Updated dependencies [75bff3b]
566
576
  - Updated dependencies [16562ee]
567
577
  - @procedures/client@0.25.0
@@ -582,7 +592,7 @@
582
592
 
583
593
  `WIRE-PROTOCOL.md` (section "Error codes") and the doc comments of `errorResponse`, `defaultNdjsonError`, `errorStatus` and `streamErrorMeta` have the deprecation notes.
584
594
 
585
- The site, MiniMongo, Graph and jarvis: no change in this release.
595
+ Apps: no change in this release.
586
596
  - Updated dependencies [2735505]
587
597
  - @procedures/client@0.24.1
588
598
  - @procedures/mcp@0.24.1
@@ -619,9 +629,9 @@
619
629
 
620
630
  Migration:
621
631
 
622
- - The site and MiniMongo: no change. They have no MCP host.
623
- - Graph: no change. Its MCP hosts have no task store.
624
- - 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.
625
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 })`.
626
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()`.
627
637
 
@@ -665,9 +675,9 @@
665
675
 
666
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>`.
667
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()`.
668
- - The site and MiniMongo: no change. They have no MCP host.
669
- - 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 })`.
670
- - 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.
671
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 })`.
672
682
  - polite-crawler-mcp also gives the deprecated option `mount: true`, which has no effect. Remove it when it moves to the new range.
673
683
 
@@ -716,9 +726,9 @@
716
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.
717
727
  - Code that calls `server.handle()` of a server with a token or a request hook gives `credentials: LOCAL_CREDENTIALS`.
718
728
  - The site: no change. Its servers have no token and no request hook, and its workers serve over `PortTransport`, which sets the marker.
719
- - 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.
720
- - 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.
721
- - 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.
722
732
 
723
733
  ### Patch Changes
724
734
 
@@ -800,7 +810,7 @@
800
810
 
801
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.
802
812
  - A caller of `startDevToolsServer()`: call `runDevToolsServer(config)`.
803
- - 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.
804
814
 
805
815
  ### Patch Changes
806
816
 
@@ -843,7 +853,7 @@
843
853
  principalOf,
844
854
  limits: [
845
855
  {
846
- name: "graph.writes",
856
+ name: "app.writes",
847
857
  key: { claim: "tenant" },
848
858
  covers: { writes: true },
849
859
  policy: { type: "sliding-window", limit: { value: 120, unit: "count" }, window: { value: 1, unit: "min" } },
@@ -909,7 +919,7 @@
909
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.
910
920
  - `startDevToolsServer()` of `@procedures/mcp-dev-tools`. Use `runDevToolsServer()`.
911
921
 
912
- 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.
913
923
  - Updated dependencies [85999c1]
914
924
  - Updated dependencies [fc968f6]
915
925
  - Updated dependencies [dc7a462]
@@ -949,9 +959,9 @@
949
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.
950
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.
951
961
  - The site: no change is necessary. Its code does not read the code of a cut, or the HTTP status 503.
952
- - MiniMongo: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
953
- - 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.
954
- - 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`.
955
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`.
956
966
  - Updated dependencies [217a90f]
957
967
  - @procedures/client@0.14.0
@@ -1035,9 +1045,9 @@
1035
1045
 
1036
1046
  Migration steps:
1037
1047
 
1038
- - The site and MiniMongo: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
1039
- - The MCP host of Graph: no change is necessary. To share the port of the Graph host, mount `mcpFace()` on its listener.
1040
- - 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.
1041
1051
  - A caller of `createPeer()` with a different token for each transport: give one token.
1042
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.
1043
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