@procedures/mcp-server 0.47.1 → 0.48.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,31 @@
1
1
  # @procedures/mcp-server
2
2
 
3
+ ## 0.48.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 17a18ec: The source now uses only syntax that a type stripper erases, so the setting `erasableSyntaxOnly` of `@mark1russell7/cue` 2.1.1 stays on. Each enum is now a constant object with a type of the same name. Each parameter property is now a field and an assignment in the constructor.
8
+
9
+ **Breaking.** MINOR before 1.0.0: `ErrorCategory`, `ErrorSeverity` and `WebSocketState` are now constant objects. Their names and values stay the same, and each member stays usable as a type. A member is no longer a constant expression: `enum E { A = ErrorSeverity.WARNING }` gives TS18033, and a `const enum` gives TS2474. Also, a string with the value of a member now fits the type of the set.
10
+
11
+ **Migration.** In an enum initializer, write the value in place of the member, for example `"warning"`, or use a constant object. Other uses need no change. The site and the known apps need no change.
12
+ - Updated dependencies [17a18ec]
13
+ - Updated dependencies [06088f9]
14
+ - Updated dependencies [71f9c6e]
15
+ - Updated dependencies [c839add]
16
+ - @procedures/client@0.48.0
17
+ - @procedures/mcp@0.48.0
18
+
19
+ ## 0.47.2
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [0650616]
24
+ - Updated dependencies [ae1e3fd]
25
+ - Updated dependencies [f1ece74]
26
+ - @procedures/client@0.47.2
27
+ - @procedures/mcp@0.47.2
28
+
3
29
  ## 0.47.1
4
30
 
5
31
  ### Patch Changes
@@ -129,7 +155,7 @@
129
155
 
130
156
  - A caller that reads the code of a 413 from the HTTP handler compares it with `PAYLOAD_TOO_LARGE`, not `INVALID_REQUEST`.
131
157
  - 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`.
158
+ - Apps: no step, unless one of them compares the code of a refused large request with `INVALID_REQUEST`.
133
159
  - Updated dependencies [55d1e4d]
134
160
  - @procedures/client@0.39.0
135
161
  - @procedures/mcp@0.39.0
@@ -158,7 +184,7 @@
158
184
 
159
185
  - 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
186
  - 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 `%`.
187
+ - Apps: no step, if their procedure paths have no segment with `.` or `%`.
162
188
  - Updated dependencies [c6fba49]
163
189
  - @procedures/client@0.38.0
164
190
  - @procedures/mcp@0.38.0
@@ -230,7 +256,7 @@
230
256
 
231
257
  Migration:
232
258
 
233
- - The site, MiniMongo, Graph and jarvis: no change at this time. The deprecated names work until the next MINOR.
259
+ - Apps: no change at this time. The deprecated names work until the next MINOR.
234
260
  - 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
261
  - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
236
262
  - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
@@ -462,13 +488,13 @@
462
488
  - A face of your own that gives `mcpFace()` a handler of its own: give the handler `admission: (credentials) => server.admission(credentials)`.
463
489
  - An MCP client that a request hook refuses gets 401 at `initialize`. Give it valid credentials for each HTTP request.
464
490
  - 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.
491
+ - 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.
492
+ - 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`.
493
+ - 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`.
494
+ - 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.
495
+ - 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.
496
+ - An app: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
497
+ - An app: no change. Its procedures host has only the HTTP face, and its MCP host has only stdio and SDK faces.
472
498
  - `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
499
 
474
500
  ### Patch Changes
@@ -543,9 +569,9 @@
543
569
  - A test that expects `retryable: false` for such an end before the first item: expect the flag of the code.
544
570
  - A custom `errorOf` of `writeNdjsonStream`: read its second parameter to give the same rule.
545
571
  - 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.
572
+ - 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.
573
+ - An app: no change is necessary. Its handlers give `UNAVAILABLE` with an explicit flag, and it serves no stream procedure of its own.
574
+ - An app: no change is necessary. The cuts of its host have their own flag, and it uses no retry middleware.
549
575
 
550
576
  ### Patch Changes
551
577
 
@@ -561,7 +587,7 @@
561
587
 
562
588
  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
589
 
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.
590
+ `mark mcp --http --token` and `@procedures/mcp-dev-tools`: no change for a client. Apps: no change in this release.
565
591
  - Updated dependencies [75bff3b]
566
592
  - Updated dependencies [16562ee]
567
593
  - @procedures/client@0.25.0
@@ -582,7 +608,7 @@
582
608
 
583
609
  `WIRE-PROTOCOL.md` (section "Error codes") and the doc comments of `errorResponse`, `defaultNdjsonError`, `errorStatus` and `streamErrorMeta` have the deprecation notes.
584
610
 
585
- The site, MiniMongo, Graph and jarvis: no change in this release.
611
+ Apps: no change in this release.
586
612
  - Updated dependencies [2735505]
587
613
  - @procedures/client@0.24.1
588
614
  - @procedures/mcp@0.24.1
@@ -619,9 +645,9 @@
619
645
 
620
646
  Migration:
621
647
 
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.
648
+ - The site and an app: no change. They have no MCP host.
649
+ - An app: no change. Its MCP hosts have no task store.
650
+ - An app: no change. Its MCP host has no tasks.
625
651
  - 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
652
  - 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
653
 
@@ -665,9 +691,9 @@
665
691
 
666
692
  - 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
693
  - 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.
694
+ - The site and an app: no change. They have no MCP host.
695
+ - 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 })`.
696
+ - An app: no change. Its MCP host has only stdio and SDK faces, and it has no tasks.
671
697
  - 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
698
  - polite-crawler-mcp also gives the deprecated option `mount: true`, which has no effect. Remove it when it moves to the new range.
673
699
 
@@ -716,9 +742,9 @@
716
742
  - 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
743
  - Code that calls `server.handle()` of a server with a token or a request hook gives `credentials: LOCAL_CREDENTIALS`.
718
744
  - 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.
745
+ - 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.
746
+ - 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.
747
+ - 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
748
 
723
749
  ### Patch Changes
724
750
 
@@ -800,7 +826,7 @@
800
826
 
801
827
  - 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
828
  - 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.
829
+ - 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
830
 
805
831
  ### Patch Changes
806
832
 
@@ -843,7 +869,7 @@
843
869
  principalOf,
844
870
  limits: [
845
871
  {
846
- name: "graph.writes",
872
+ name: "app.writes",
847
873
  key: { claim: "tenant" },
848
874
  covers: { writes: true },
849
875
  policy: { type: "sliding-window", limit: { value: 120, unit: "count" }, window: { value: 1, unit: "min" } },
@@ -909,7 +935,7 @@
909
935
  - 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
936
  - `startDevToolsServer()` of `@procedures/mcp-dev-tools`. Use `runDevToolsServer()`.
911
937
 
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.
938
+ 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
939
  - Updated dependencies [85999c1]
914
940
  - Updated dependencies [fc968f6]
915
941
  - Updated dependencies [dc7a462]
@@ -949,9 +975,9 @@
949
975
  - 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
976
  - 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
977
  - 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`.
978
+ - An app: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
979
+ - 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.
980
+ - 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
981
  - 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
982
  - Updated dependencies [217a90f]
957
983
  - @procedures/client@0.14.0
@@ -1035,9 +1061,9 @@
1035
1061
 
1036
1062
  Migration steps:
1037
1063
 
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.
1064
+ - The site and an app: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
1065
+ - The MCP host of an app: no change is necessary. To share the port of its procedures host, mount `mcpFace()` on its listener.
1066
+ - 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
1067
  - A caller of `createPeer()` with a different token for each transport: give one token.
1042
1068
  - 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
1069
  - 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