@procedures/mcp-server 0.21.0 → 0.22.1
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 +44 -0
- package/README.md +4 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/face.d.ts +1 -1
- package/dist/face.d.ts.map +1 -1
- package/dist/host.d.ts +3 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js.map +1 -1
- package/dist/tasks.d.ts +29 -7
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +32 -8
- package/dist/tasks.js.map +1 -1
- package/dist/transport/guard.d.ts +11 -4
- package/dist/transport/guard.d.ts.map +1 -1
- package/dist/transport/guard.js +5 -3
- package/dist/transport/guard.js.map +1 -1
- package/dist/transport/http.d.ts +3 -2
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +2 -1
- package/dist/transport/http.js.map +1 -1
- package/dist/types.d.ts +5 -5
- package/package.json +4 -4
- package/src/face.ts +1 -1
- package/src/host.ts +3 -2
- package/src/tasks.ts +42 -8
- package/src/transport/guard.ts +12 -5
- package/src/transport/http.ts +3 -2
- package/src/types.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @procedures/mcp-server
|
|
2
2
|
|
|
3
|
+
## 0.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [c931188]
|
|
8
|
+
- @procedures/client@0.22.1
|
|
9
|
+
- @procedures/mcp@0.22.1
|
|
10
|
+
|
|
11
|
+
## 0.22.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 25822ee: The Streamable HTTP face of an MCP host keeps at most 256 sessions by default, and a task store keeps at most 1000 tasks (CLI-51). Before, the sessions had no limit by default. Thus one client could increase the memory of the host without a limit.
|
|
16
|
+
|
|
17
|
+
MINOR: a breaking change before 1.0. A new default limit changes a behavior that callers rely on (decision D13).
|
|
18
|
+
|
|
19
|
+
Changed:
|
|
20
|
+
|
|
21
|
+
- The default of `maxSessions` is 256, not `Infinity`. This default applies to `faces.http` of `createMcpHost()`, to `mcpFace()` and to `mark mcp --http`. `MCP_HTTP_LIMITS.maxSessions` is 256.
|
|
22
|
+
- A new session above the limit closes the session that was idle longest. When each session is busy, the new session gets 503 with a `Retry-After` header, as before with a limit.
|
|
23
|
+
- Each live client of the MCP SDK keeps its GET stream open, so the limit does not close its session. Thus the limit is much more than the clients of one host. Each live session also holds a socket, and 256 is much less than the usual limit of 1024 open files of a process.
|
|
24
|
+
- `maxSessions: Infinity` stays valid. It turns the limit off.
|
|
25
|
+
|
|
26
|
+
Added:
|
|
27
|
+
|
|
28
|
+
- The option `maxStored` of `McpTaskStore`, and of `tasks` of `createMcpHost()` and `mcpFace()`. It is the most tasks that the store keeps for all the sessions together. The default is 1000 (`MCP_TASK_LIMITS.maxStored`). Before, only the limit of 100 tasks for each session bounded the store.
|
|
29
|
+
- A new task removes the oldest task of its own session that ended. The store can be full, and the session can have no task that ended. Then the request of the new task gets the error `-32600` with the code `TASKS_FULL`. The store keeps nothing of that task. Thus a client cannot remove the results of another session. `maxStored: Infinity` turns the limit off.
|
|
30
|
+
- The flag `--max-sessions <n>` of `mark mcp`, and the variable `MCP_HTTP_MAX_SESSIONS` of `@procedures/mcp-dev-tools`. They set `maxSessions` of the HTTP face. `Infinity` turns the limit off.
|
|
31
|
+
|
|
32
|
+
Migration:
|
|
33
|
+
|
|
34
|
+
- 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>`.
|
|
35
|
+
- A host that keeps more than 1000 tasks: give a larger `maxStored`, or `maxStored: Infinity`, in `tasks` of the host or in `new McpTaskStore()`.
|
|
36
|
+
- The site and MiniMongo: no change. They have no MCP host.
|
|
37
|
+
- 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 })`.
|
|
38
|
+
- jarvis: no change. Its MCP host has only stdio and SDK faces, and it has no tasks.
|
|
39
|
+
- 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 })`.
|
|
40
|
+
- polite-crawler-mcp also gives the deprecated option `mount: true`, which has no effect. Remove it when it moves to the new range.
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- @procedures/client@0.22.0
|
|
45
|
+
- @procedures/mcp@0.22.0
|
|
46
|
+
|
|
3
47
|
## 0.21.0
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -116,7 +116,8 @@ The Streamable HTTP face checks each request with `guardMcpRequest` before the r
|
|
|
116
116
|
- A request on a loopback address must name a loopback host, or a host of `allowedHosts` (the default is `browser.allowedHosts` of the policy), in its `Host` header. Thus DNS rebinding cannot reach the tools. An `Origin` header must name the server or a permitted origin.
|
|
117
117
|
- With a token, each request sends `Authorization: Bearer <token>`. The scheme has any case, for example `bearer` (RFC 7235). The check is `tokenMatches` of the core: its time does not tell the token. A request without the token gets 401 with a `WWW-Authenticate` header.
|
|
118
118
|
- Only an `initialize` request starts a session. Thus a stray POST makes no MCP server. The body of each request has a limit of 4 MiB (`maxBodyBytes`).
|
|
119
|
-
- The
|
|
119
|
+
- The face keeps at most 256 sessions by default (`maxSessions`, CLI-51). A new session above the limit closes the session that was idle longest: no task in progress and no open response (a call or a GET stream). When each session is busy, the new session gets 503 with a `Retry-After` header. A client that sends to a closed session gets 404, and a client of the MCP specification then sends a new `initialize`.
|
|
120
|
+
- Each live client of the MCP SDK keeps its GET stream open. Thus the limit does not close the session of a live client, and 256 is much more than the clients of one host. To serve more clients, give a larger `maxSessions`. `maxSessions: Infinity` turns the limit off.
|
|
120
121
|
- `assertLoopbackBind(host, allowRemote)` refuses a listener on an address that is not loopback, unless `allowRemote` is true.
|
|
121
122
|
|
|
122
123
|
## A host under the runner
|
|
@@ -246,8 +247,9 @@ host.tasks?.running(); // the tasks that did not end, for a status page
|
|
|
246
247
|
- The tool list gives `execution.taskSupport` of each such tool. Without the option `tasks`, the list does not give it, and each call is a normal request.
|
|
247
248
|
- A progress of the procedure becomes the status message of its task, for example `2 of 5 done`. The message holds only the counts, so no text of the work leaves its envelopes. A client that sent a progress token also gets the progress notifications.
|
|
248
249
|
- A cancel of the task (`tasks/cancel`) aborts `ctx.signal` of the procedure. The close of a session cancels its tasks, and the stop of the host cancels each task.
|
|
249
|
-
- The store runs at most `maxRunning` tasks at one time (8 by default). A task holds its place until its procedure returns, also after a cancel. A task above the limit starts, and then fails at once.
|
|
250
|
+
- The store runs at most `maxRunning` tasks at one time (8 by default). A task holds its place until its procedure returns, also after a cancel. A task above the limit starts, and then fails at once. Thus the client gets a task, and the result of the task gives the reason. A full store is different: refer to `maxStored` below.
|
|
250
251
|
- The time to keep a task (`ttl`) starts when the task ends. The store does not remove a task whose procedure still runs.
|
|
252
|
+
- The store keeps at most 100 tasks for one session, and at most 1000 tasks for all the sessions together (`maxStored`, CLI-51). A new task removes the oldest task of its own session that ended. The store can be full, and the session can have no task that ended. Then the request of the new task gets the error `-32600`, and the store keeps nothing of it. Thus a client cannot remove the results of another session. `maxStored: Infinity` turns the total limit off.
|
|
251
253
|
- The call of a task cannot ask the person: the procedure gets no `ctx.elicit`.
|
|
252
254
|
- A normal call of an optional tool runs in the request, with the progress and the cancel of the request. A normal call of a tool with `taskSupport: "required"`, or a task for a tool without task support, gets the error `-32601`.
|
|
253
255
|
- To share one store with other parts, give `tasks: { store: new McpTaskStore({ maxRunning: 4 }) }`. The host closes only a store that it made.
|