@procedures/mcp-server 0.58.2 → 0.59.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 +30 -0
- package/README.md +1 -1
- package/dist/face.d.ts +1 -1
- package/dist/face.d.ts.map +1 -1
- package/dist/transport/guard.d.ts +3 -3
- package/dist/transport/guard.d.ts.map +1 -1
- package/dist/transport/guard.js +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +4 -4
- package/src/face.ts +1 -1
- package/src/transport/guard.ts +3 -3
- package/src/types.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @procedures/mcp-server
|
|
2
2
|
|
|
3
|
+
## 0.59.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8f8e5b2: **Breaking change:** each listener examines the `Host` header. By default, only `localhost`, `127.0.0.1`, `[::1]` and IP addresses pass. Give each other name with `--allowed-host` or `allowedHosts`.
|
|
8
|
+
|
|
9
|
+
The browser checks examine the `Host` header on each listener. Before, they examined it only on a loopback address. A server on a LAN address (`0.0.0.0`) accepted each host name.
|
|
10
|
+
|
|
11
|
+
A request must name one of these hosts in its `Host` header:
|
|
12
|
+
|
|
13
|
+
- A loopback name: `localhost`, `127.0.0.1` or `[::1]`.
|
|
14
|
+
- An IP address, for example `192.168.1.20` or `[fe80::1]`.
|
|
15
|
+
- A name of `browser.allowedHosts` of the host policy, with any letter case.
|
|
16
|
+
|
|
17
|
+
A request with another name gets `FORBIDDEN` (403) with the reason `host-header-not-allowed`. A request without a `Host` header gets it too. The message of the refusal names `allowedHosts` and `--allowed-host`. `browser.allowedHosts: "*"` turns the check off.
|
|
18
|
+
|
|
19
|
+
The server command and `mark --server` get the option `--allowed-host <names>`. Repeat the option, or separate the names with commas. `@procedures/server` exports `parseAllowedHosts`.
|
|
20
|
+
|
|
21
|
+
Migration steps:
|
|
22
|
+
|
|
23
|
+
- A server that a LAN, a proxy or a container network reaches by a name: give the name in `browser.allowedHosts` of `hostPolicy()`. Or start the server with `--allowed-host <name>`.
|
|
24
|
+
- An MCP face on HTTP that clients reach by a name: give the name in `http.allowedHosts` of the face, or in `browser.allowedHosts` of the policy.
|
|
25
|
+
- A server that clients reach by `localhost` or by an IP address: no change.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [8f8e5b2]
|
|
30
|
+
- @procedures/client@0.59.0
|
|
31
|
+
- @procedures/mcp@0.59.0
|
|
32
|
+
|
|
3
33
|
## 0.58.2
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ When the server reads cookies, the face trusts a request with a cookie only from
|
|
|
115
115
|
|
|
116
116
|
The Streamable HTTP face checks each request before the request reaches the MCP SDK. The face has no token check of its own.
|
|
117
117
|
|
|
118
|
-
- The browser checks come first, with `guardMcpRequest`.
|
|
118
|
+
- The browser checks come first, with `guardMcpRequest`. Each request must name a loopback host, an IP address or a host of `allowedHosts` (the default is `browser.allowedHosts` of the policy) in its `Host` header, on each listener. Thus DNS rebinding cannot reach the tools. An `Origin` header must name the server or a permitted origin (the default is `browser.allowedOrigins` of the policy).
|
|
119
119
|
- Then the admission of the server checks the credentials. 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 refused request gets 401 with a `WWW-Authenticate` header.
|
|
120
120
|
- The token of a host is the token of its policy. A `token` of the HTTP face of `createMcpHost` becomes the token of the policy, and two different tokens stop the host with an error. `McpServerTransport` refuses a token in its HTTP options: give the token to the server. Refer to [Deprecated token options](#deprecated-token-options).
|
|
121
121
|
- `guardMcpRequest` refuses a `token` option. The first call with it throws a `TypeError` that names the migration. Each later call with it gives a refusal with the status 500, without an error. Thus each request stays refused, and the log gets one error.
|
package/dist/face.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface McpFaceOptions extends Omit<McpServerTransportOptions, "transpo
|
|
|
40
40
|
* function. The default is `browser.allowedOrigins` of the policy.
|
|
41
41
|
*/
|
|
42
42
|
readonly allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
43
|
-
/** The host names that a request
|
|
43
|
+
/** The host names that a request can name, besides the loopback names and the IP addresses. The default is `browser.allowedHosts` of the policy. */
|
|
44
44
|
readonly allowedHosts?: readonly string[] | "*" | undefined;
|
|
45
45
|
/** The most sessions at one time (CLI-35). The default is 256 (CLI-51). `Infinity` turns the limit off. */
|
|
46
46
|
readonly maxSessions?: number | undefined;
|
package/dist/face.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../src/face.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAEf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAkB,MAAM,8BAA8B,CAAC;AAClF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,kGAAkG;AAClG,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,yBAAyB,EAAE,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,CAAC;IACzJ,uDAAuD;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,C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ACrG;AAED,kGAAkG;AAClG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,yFAAyF;AACzF,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;IACzE,QAAQ,CAAC,KAAK,EAAE;QACd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,UAAU,IAAI,IAAI,CAAC;QACnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,QAAQ,IAAI,MAAM,CAAC;QACnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7F,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;CACxC;AAkCD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CA6D1F"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* The `handle` of the face calls `guardMcpRequest` before a request reaches the MCP SDK. The face
|
|
5
5
|
* mounts on more than one kind of listener, so the listener adds no second check for its path.
|
|
6
6
|
*
|
|
7
|
-
* - The checks of a web browser (`checkBrowserRequest` of the core):
|
|
8
|
-
*
|
|
7
|
+
* - The checks of a web browser (`checkBrowserRequest` of the core): each request names a loopback
|
|
8
|
+
* host, an IP address or an allowed host (DNS rebinding), and an `Origin` header names
|
|
9
9
|
* the server or a permitted origin. A request with cookies needs a named origin (CSRF).
|
|
10
10
|
* - The credentials are not checked here (CLI-2b). After the browser checks, the face gives each
|
|
11
11
|
* request to the admission of its server (`admission()` of the handler): the request hook, the
|
|
@@ -47,7 +47,7 @@ export declare const MCP_HTTP_LIMITS: {
|
|
|
47
47
|
export interface McpRequestGuardOptions {
|
|
48
48
|
/** The browser origins that can call the face, besides its own origin. */
|
|
49
49
|
readonly allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
50
|
-
/** The host names that a request
|
|
50
|
+
/** The host names that a request can name, besides the loopback names and the IP addresses. */
|
|
51
51
|
readonly allowedHosts?: BrowserGuardOptions["allowedHosts"];
|
|
52
52
|
/** True when the server trusts cookies for the request: then only a named origin can call (CSRF). */
|
|
53
53
|
readonly ambient?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/transport/guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAuC,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEnG,gHAAgH;AAChH,eAAO,MAAM,eAAe,EAAE;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;CAK/B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAChE
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/transport/guard.ts"],"names":[],"mappings":"AAAA;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;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,CAejJ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,IAAI,CAG1E"}
|
package/dist/transport/guard.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* The `handle` of the face calls `guardMcpRequest` before a request reaches the MCP SDK. The face
|
|
5
5
|
* mounts on more than one kind of listener, so the listener adds no second check for its path.
|
|
6
6
|
*
|
|
7
|
-
* - The checks of a web browser (`checkBrowserRequest` of the core):
|
|
8
|
-
*
|
|
7
|
+
* - The checks of a web browser (`checkBrowserRequest` of the core): each request names a loopback
|
|
8
|
+
* host, an IP address or an allowed host (DNS rebinding), and an `Origin` header names
|
|
9
9
|
* the server or a permitted origin. A request with cookies needs a named origin (CSRF).
|
|
10
10
|
* - The credentials are not checked here (CLI-2b). After the browser checks, the face gives each
|
|
11
11
|
* request to the admission of its server (`admission()` of the handler): the request hook, the
|
package/dist/types.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ export interface HttpTransportOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
70
70
|
/**
|
|
71
|
-
* The host names that a request
|
|
72
|
-
* the
|
|
71
|
+
* The host names that a request can name in its `Host` header, besides the loopback names and
|
|
72
|
+
* the IP addresses (`browser.allowedHosts` of the host policy). `"*"` turns the check off.
|
|
73
73
|
*/
|
|
74
74
|
allowedHosts?: readonly string[] | "*" | undefined;
|
|
75
75
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/mcp-server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.59.0",
|
|
5
5
|
"description": "Model Context Protocol server transport: serve typed procedures as MCP tools to Claude and other MCP clients, with streaming progress, list_changed and an expose policy.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mcp",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
67
|
-
"@procedures/mcp": "0.
|
|
67
|
+
"@procedures/mcp": "0.59.0",
|
|
68
68
|
"zod": "^4.6.5",
|
|
69
69
|
"@mark1russell7/text": "^0.0.5"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@procedures/client": "^0.
|
|
72
|
+
"@procedures/client": "^0.59.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"typescript": "^7.0.2",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"@mark1russell7/cue": "^2.1.1",
|
|
78
78
|
"vitest": "^5.0.3",
|
|
79
|
-
"@procedures/client": "0.
|
|
79
|
+
"@procedures/client": "0.59.0",
|
|
80
80
|
"@mark1russell7/service": "^0.8.3"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
package/src/face.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface McpFaceOptions extends Omit<McpServerTransportOptions, "transpo
|
|
|
53
53
|
* function. The default is `browser.allowedOrigins` of the policy.
|
|
54
54
|
*/
|
|
55
55
|
readonly allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
56
|
-
/** The host names that a request
|
|
56
|
+
/** The host names that a request can name, besides the loopback names and the IP addresses. The default is `browser.allowedHosts` of the policy. */
|
|
57
57
|
readonly allowedHosts?: readonly string[] | "*" | undefined;
|
|
58
58
|
/** The most sessions at one time (CLI-35). The default is 256 (CLI-51). `Infinity` turns the limit off. */
|
|
59
59
|
readonly maxSessions?: number | undefined;
|
package/src/transport/guard.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* The `handle` of the face calls `guardMcpRequest` before a request reaches the MCP SDK. The face
|
|
5
5
|
* mounts on more than one kind of listener, so the listener adds no second check for its path.
|
|
6
6
|
*
|
|
7
|
-
* - The checks of a web browser (`checkBrowserRequest` of the core):
|
|
8
|
-
*
|
|
7
|
+
* - The checks of a web browser (`checkBrowserRequest` of the core): each request names a loopback
|
|
8
|
+
* host, an IP address or an allowed host (DNS rebinding), and an `Origin` header names
|
|
9
9
|
* the server or a permitted origin. A request with cookies needs a named origin (CSRF).
|
|
10
10
|
* - The credentials are not checked here (CLI-2b). After the browser checks, the face gives each
|
|
11
11
|
* request to the admission of its server (`admission()` of the handler): the request hook, the
|
|
@@ -54,7 +54,7 @@ export const MCP_HTTP_LIMITS: {
|
|
|
54
54
|
export interface McpRequestGuardOptions {
|
|
55
55
|
/** The browser origins that can call the face, besides its own origin. */
|
|
56
56
|
readonly allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
57
|
-
/** The host names that a request
|
|
57
|
+
/** The host names that a request can name, besides the loopback names and the IP addresses. */
|
|
58
58
|
readonly allowedHosts?: BrowserGuardOptions["allowedHosts"];
|
|
59
59
|
/** True when the server trusts cookies for the request: then only a named origin can call (CSRF). */
|
|
60
60
|
readonly ambient?: boolean | undefined;
|
package/src/types.ts
CHANGED
|
@@ -75,8 +75,8 @@ export interface HttpTransportOptions {
|
|
|
75
75
|
*/
|
|
76
76
|
allowedOrigins?: BrowserGuardOptions["allowedOrigins"];
|
|
77
77
|
/**
|
|
78
|
-
* The host names that a request
|
|
79
|
-
* the
|
|
78
|
+
* The host names that a request can name in its `Host` header, besides the loopback names and
|
|
79
|
+
* the IP addresses (`browser.allowedHosts` of the host policy). `"*"` turns the check off.
|
|
80
80
|
*/
|
|
81
81
|
allowedHosts?: readonly string[] | "*" | undefined;
|
|
82
82
|
/**
|