@modelcontextprotocol/server-everything 2.2.1 → 2.3.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/README.md CHANGED
@@ -17,7 +17,7 @@ The resource collections (`demo://resource/collection/summer-specials`, and the
17
17
 
18
18
  The server info and every tool, prompt, resource and resource template carry a pair of [icons](docs/features.md#icons), one for a light theme and one for a dark theme, so a client can show the variant that suits its own background.
19
19
 
20
- The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment, such as `OPENAI_API_KEY`) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
20
+ The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (one with a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment between underscores, in any case: whole segments, not substrings, so `OPENAI_API_KEY` is masked and `APIKEY` is not) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
21
21
 
22
22
  ## Protocol versions
23
23
 
@@ -39,7 +39,7 @@ The `gzip-file-as-resource` tool fetches the URL it is given, so these environme
39
39
  | `GZIP_ALLOWED_DOMAINS` | empty (any name) | Comma-separated host names; a host must be one of them or a subdomain of one. Checked on the caller's URL and on every redirect hop |
40
40
  | `GZIP_ALLOW_PRIVATE_IPS` | off | Set to `1` or `true` to allow loopback, private (RFC 1918), CGNAT, link-local (cloud metadata) and other non-public addresses |
41
41
 
42
- By default the tool refuses a URL whose host resolves to a non-public address, and follows at most five redirects, checking each hop the same way. `GZIP_ALLOWED_DOMAINS` filters names, not addresses: a listed name that resolves to a private address is still refused unless `GZIP_ALLOW_PRIVATE_IPS` is set. The address is checked before the request and resolved again when it is made, so a DNS answer that changes in between (DNS rebinding) is not caught. `data:` URLs are not fetched, so neither check applies to them.
42
+ By default the tool refuses a URL whose host resolves to a non-public address, and follows at most five redirects, checking each hop the same way. An IPv6 address that wraps an IPv4 one (IPv4-mapped, IPv4-translated, or in the NAT64 prefix `64:ff9b::/96`) is judged by that IPv4, and any other IPv6 address outside global unicast (`2000::/3`) is refused. `GZIP_ALLOWED_DOMAINS` filters names, not addresses: a listed name that resolves to a private address is still refused unless `GZIP_ALLOW_PRIVATE_IPS` is set. The address is checked before the request and resolved again when it is made, so a DNS answer that changes in between (DNS rebinding) is not caught. `data:` URLs are not fetched, so neither check applies to them.
43
43
 
44
44
  ## Requirements
45
45
 
@@ -127,6 +127,13 @@ npm run start:streamableHttp
127
127
 
128
128
  The endpoint is `http://localhost:3001/mcp` (`PORT` overrides the port). It serves 2026-07-28 clients statelessly and 2025-era clients with sessions, from the same URL.
129
129
 
130
+ Both HTTP transports (Streamable HTTP and HTTP+SSE) listen on the loopback interface, `127.0.0.1`, by default, so only clients on the same machine can reach them. Set `HOST` to bind another address: `HOST=0.0.0.0` listens on every interface, which exposes the server's tools to every host that can reach the machine, so set it only on a network you trust. The listening line the server prints names the address and port it bound, such as `127.0.0.1:3001`.
131
+
132
+ | Variable | Default | Effect |
133
+ | --- | --- | --- |
134
+ | `PORT` | `3001` | The port the HTTP transport listens on |
135
+ | `HOST` | `127.0.0.1` | The address it binds; `0.0.0.0` (or `::`) for every interface |
136
+
130
137
  Both HTTP transports (Streamable HTTP and HTTP+SSE) accept browser requests only from a localhost origin: an `Origin` header whose host is `localhost`, `127.0.0.1` or `[::1]`, on any port, such as the MCP Inspector's. A request carrying any other `Origin` is refused with `403 Forbidden`. Clients that send no `Origin` header, which is every non-browser client, are unaffected.
131
138
 
132
139
  ## Running from source with [HTTP+SSE Transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) (deprecated as of [2025-03-26](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports))
@@ -195,7 +202,7 @@ docker run -i --rm mcp/everything
195
202
  docker run --rm -p 127.0.0.1:3001:3001 mcp/everything streamableHttp
196
203
  ```
197
204
 
198
- The endpoint is `http://localhost:3001/mcp`. The server listens on port 3001 on every interface inside the container; `127.0.0.1:` publishes it on the host's loopback only. To use another port, set `PORT` and publish that one (`-e PORT=8080 -p 127.0.0.1:8080:8080`). The localhost-only `Origin` check described above applies inside the container too. `docker stop` ends the server cleanly.
205
+ The endpoint is `http://localhost:3001/mcp`. The image sets `HOST=0.0.0.0`, so the server listens on port 3001 on every interface inside the container, which is what lets a published port reach it; `127.0.0.1:` publishes it on the host's loopback only. To use another port, set `PORT` and publish that one (`-e PORT=8080 -p 127.0.0.1:8080:8080`). The localhost-only `Origin` check described above applies inside the container too. `docker stop` ends the server cleanly.
199
206
 
200
207
  ## License
201
208
 
@@ -99,6 +99,6 @@ Logging is deprecated as of 2026-07-28 (SEP-2577) and remains available on both
99
99
  - `tasks/update`: the client's `inputResponses` to the outstanding input requests;
100
100
  - `tasks/cancel`: stop a task that has not finished.
101
101
 
102
- A task tool called by a client whose request does not declare the extension, or the capability its task asks for input with (`sampling` for `trigger-sampling-request-async`, form-mode `elicitation` for `trigger-elicitation-request-async`), is refused with `-32021` (missing required client capability), naming what is missing in `data.requiredCapabilities`; so is a `tasks/*` request from a client without the extension. An unknown or expired task, and a `tasks/update` whose answers exceed 64 KiB serialized, are refused with `-32602`. A `tasks/cancel` is acknowledged whatever the task's status (cancellation is cooperative), and a finished task stays as it ended. An update's answers to requests that are not outstanding (never issued, already answered, or sent while the task is not waiting for input) are ignored, as the extension asks. Each input request a task makes has its own key, never reused once answered, so a request asked again after an answer that does not fit gets a new key (`form-2`, `sampling-2`). The process keeps at most 100 tasks, each until its TTL; at that limit a new task is refused with a tool error. The task id is a server-minted UUID, so a task lives across requests (each 2026-07-28 HTTP request is served by a fresh server instance) and is reached only through its handle. A task's progress is computed from the clock when it is read, so nothing runs in the background.
102
+ A task tool called by a client whose request does not declare the extension, or the capability its task asks for input with (`sampling` for `trigger-sampling-request-async`, form-mode `elicitation` for `trigger-elicitation-request-async`), is refused with `-32021` (missing required client capability), naming what is missing in `data.requiredCapabilities`; so is a `tasks/*` request from a client without the extension. An unknown or expired task, and a `tasks/update` whose answers exceed 64 KiB serialized (counted in UTF-8 bytes), are refused with `-32602`. A `tasks/cancel` is acknowledged whatever the task's status (cancellation is cooperative), and a finished task stays as it ended. An update's answers to requests that are not outstanding (never issued, already answered, or sent while the task is not waiting for input) are ignored, as the extension asks. Each input request a task makes has its own key, never reused once answered, so a request asked again after an answer that does not fit gets a new key (`form-2`, `sampling-2`). The process keeps at most 100 tasks, each until its TTL; at that limit a new task is refused with a tool error. The task id is a server-minted UUID, so a task lives across requests (each 2026-07-28 HTTP request is served by a fresh server instance) and is reached only through its handle. A task's progress is computed from the clock when it is read, so nothing runs in the background.
103
103
 
104
104
  The 2025-11-25 core task methods (`tasks/result`, `tasks/list`, task-augmented requests) are not served: SDK v2 removed the experimental layer they were built on.
@@ -36,7 +36,8 @@ const tasks = new Map();
36
36
  */
37
37
  export const MAX_TASKS = 100;
38
38
  /**
39
- * The most bytes of answers, serialized, one `tasks/update` may hand a task.
39
+ * The most bytes of answers, serialized as JSON and counted in UTF-8, one
40
+ * `tasks/update` may hand a task.
40
41
  * A task keeps its answers until its TTL, and a transport accepts messages
41
42
  * far larger than any of these tasks needs (10 MiB on stdio), so with
42
43
  * `MAX_TASKS` this bounds what the store holds.
@@ -270,7 +271,10 @@ export function registerTasksExtension(server) {
270
271
  ? Object.keys(state.inputRequests)
271
272
  : [];
272
273
  const answered = Object.fromEntries(Object.entries(inputResponses).filter(([key]) => outstanding.includes(key)));
273
- const size = JSON.stringify(answered).length;
274
+ // The limit is in bytes, so count the UTF-8 encoding of the serialized
275
+ // answers: a string's length counts UTF-16 code units, which under-counts
276
+ // any non-ASCII text by up to 3x.
277
+ const size = Buffer.byteLength(JSON.stringify(answered), "utf8");
274
278
  if (size > MAX_ANSWER_BYTES) {
275
279
  throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid params for tasks/update: the answers are ${size} bytes, over the ${MAX_ANSWER_BYTES}-byte limit; the task is unchanged`);
276
280
  }
@@ -5,11 +5,12 @@ import { TOOL_ICONS } from "../server/icons.js";
5
5
  const GetResourceReferenceSchema = z.object({
6
6
  resourceType: z
7
7
  .enum([RESOURCE_TYPE_TEXT, RESOURCE_TYPE_BLOB])
8
- .default(RESOURCE_TYPE_TEXT),
8
+ .default(RESOURCE_TYPE_TEXT)
9
+ .describe("Whether to reference a text resource or a blob resource"),
9
10
  resourceId: z
10
11
  .number()
11
12
  .default(1)
12
- .describe("ID of the text resource to fetch"),
13
+ .describe("ID of the text or blob resource to fetch, a positive integer"),
13
14
  });
14
15
  // Tool configuration
15
16
  const name = "get-resource-reference";
@@ -45,9 +45,9 @@ const MAX_REDIRECTS = 5;
45
45
  const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
46
46
  // Addresses that are not public destinations: the IANA special-purpose ranges
47
47
  // the fetch server refuses (src/fetch's _NON_PUBLIC_NETWORKS), plus
48
- // multicast. BlockList judges an IPv4-mapped IPv6 address (::ffff:a.b.c.d) by
49
- // the IPv4 rules, so those need no ranges of their own. The well-known NAT64
50
- // prefix (64:ff9b::/96) is not unwrapped and so passes as public.
48
+ // multicast. An IPv6 address that carries an IPv4 destination is unwrapped
49
+ // and judged by that IPv4 first (see IPV4_CARRIERS), so these ranges need no
50
+ // IPv6 copies of the IPv4 ones.
51
51
  const NON_PUBLIC_ADDRESSES = new BlockList();
52
52
  for (const [network, prefix] of [
53
53
  ["0.0.0.0", 8], // "this network", including the unspecified address
@@ -69,15 +69,20 @@ for (const [network, prefix] of [
69
69
  NON_PUBLIC_ADDRESSES.addSubnet(network, prefix, "ipv4");
70
70
  }
71
71
  for (const [network, prefix] of [
72
- ["::", 128], // unspecified
73
- ["::1", 128], // loopback
72
+ // IPv4-compatible IPv6 (RFC 4291 2.5.5.1), deprecated and never routed;
73
+ // it also holds the unspecified (::) and loopback (::1) addresses.
74
+ ["::", 96],
74
75
  ["64:ff9b:1::", 48], // local-use NAT64
75
76
  ["100::", 64], // discard-only
76
77
  ["2001::", 23], // IETF protocol assignments (Teredo among them)
77
78
  ["2001:db8::", 32], // documentation
78
79
  ["2002::", 16], // 6to4
80
+ ["3fff::", 20], // documentation (RFC 9637)
79
81
  ["fc00::", 7], // unique local (AWS's fd00:ec2::254)
80
82
  ["fe80::", 10], // link-local
83
+ // Deprecated site-local (RFC 3879). Outside 2000::/3 as well, but listed so
84
+ // it is refused by name.
85
+ ["fec0::", 10],
81
86
  ["ff00::", 8], // multicast
82
87
  ]) {
83
88
  NON_PUBLIC_ADDRESSES.addSubnet(network, prefix, "ipv6");
@@ -97,11 +102,56 @@ for (const [network, prefix] of [
97
102
  ]) {
98
103
  PUBLIC_EXCEPTIONS.addSubnet(network, prefix, "ipv6");
99
104
  }
105
+ // IPv6 ranges whose low 32 bits are the IPv4 destination: IPv4-mapped
106
+ // (::ffff:0:0/96), IPv4-translated (RFC 6145, ::ffff:0:0:0/96), which a
107
+ // stateless translator forwards to that IPv4, and the well-known NAT64 prefix
108
+ // (RFC 6052, 64:ff9b::/96), which a NAT64 gateway forwards to it. An address
109
+ // in one is judged by the IPv4 it wraps, as the fetch server judges it, so a
110
+ // public IPv4 stays reachable through NAT64 and a private one is refused.
111
+ const IPV4_CARRIERS = new BlockList();
112
+ for (const network of ["::ffff:0:0", "::ffff:0:0:0", "64:ff9b::"]) {
113
+ IPV4_CARRIERS.addSubnet(network, 96, "ipv6");
114
+ }
115
+ // IPv6 global unicast (RFC 4291 2.4). The rest of the IPv6 space is reserved,
116
+ // unique or site-local, link-local or multicast, none of it a public
117
+ // destination, so an IPv6 address outside it is refused: a range missing from
118
+ // NON_PUBLIC_ADDRESSES cannot pass as public.
119
+ const IPV6_GLOBAL_UNICAST = new BlockList();
120
+ IPV6_GLOBAL_UNICAST.addSubnet("2000::", 3, "ipv6");
121
+ /**
122
+ * The IPv4 address held in the low 32 bits of a valid IPv6 address, as
123
+ * dotted quad.
124
+ */
125
+ function lowIPv4(address) {
126
+ // A resolver may spell those bits as a trailing dotted quad (::ffff:1.2.3.4)
127
+ const tail = address.slice(address.lastIndexOf(":") + 1);
128
+ if (tail.includes("."))
129
+ return tail;
130
+ const [head, rest] = address.split("::");
131
+ const groups = rest === undefined
132
+ ? head.split(":")
133
+ : [
134
+ ...(head ? head.split(":") : []),
135
+ ...Array(8).fill("0"),
136
+ ...(rest ? rest.split(":") : []),
137
+ ].slice(-8);
138
+ const high = parseInt(groups[6], 16);
139
+ const low = parseInt(groups[7], 16);
140
+ return [high >> 8, high & 255, low >> 8, low & 255].join(".");
141
+ }
100
142
  /** True when `address` is not a public destination. */
101
- function isNonPublic(address, family) {
102
- const type = family === 6 ? "ipv6" : "ipv4";
103
- return (!PUBLIC_EXCEPTIONS.check(address, type) &&
104
- NON_PUBLIC_ADDRESSES.check(address, type));
143
+ export function isNonPublic(address, family) {
144
+ if (family !== 6) {
145
+ return (!PUBLIC_EXCEPTIONS.check(address, "ipv4") &&
146
+ NON_PUBLIC_ADDRESSES.check(address, "ipv4"));
147
+ }
148
+ if (IPV4_CARRIERS.check(address, "ipv6")) {
149
+ return isNonPublic(lowIPv4(address), 4);
150
+ }
151
+ if (PUBLIC_EXCEPTIONS.check(address, "ipv6"))
152
+ return false;
153
+ return (NON_PUBLIC_ADDRESSES.check(address, "ipv6") ||
154
+ !IPV6_GLOBAL_UNICAST.check(address, "ipv6"));
105
155
  }
106
156
  /**
107
157
  * Settles as `promise` does, or rejects with the signal's reason as soon as it
@@ -8,12 +8,29 @@
8
8
  // does not hold: the listening line is printed only for a real bind, and a
9
9
  // failed one names the port and exits non-zero, which is what lets a launcher
10
10
  // (the boot smoke, `npm`) see the failure and retry or report it.
11
+ //
12
+ // It is also the one place that decides which interface they bind (#5371).
13
+ // With no host, `listen` binds every interface, which hands a developer's
14
+ // tools to every machine on the local network: the Origin check stops a
15
+ // foreign browser page, but a non-browser client sends no Origin. So the
16
+ // default is loopback, and `HOST` widens it deliberately (`HOST=0.0.0.0`, as
17
+ // the container image sets so a published port reaches the server).
18
+ /** The interface the HTTP transports bind when `HOST` is unset: loopback only. */
19
+ export const DEFAULT_HOST = "127.0.0.1";
20
+ /** The host to bind: `HOST` when it is set and not empty, else loopback. */
21
+ export function bindHost(env = process.env) {
22
+ return env.HOST || DEFAULT_HOST;
23
+ }
24
+ /** `host:port` for a log line, with an IPv6 literal in brackets (`[::1]:3001`). */
25
+ export function hostAndPort(host, port) {
26
+ return `${host.includes(":") ? `[${host}]` : host}:${port}`;
27
+ }
11
28
  /**
12
- * Start `app` on `port`. Prints `listeningMessage` once the port is bound; on a
13
- * bind failure prints why and exits the process with status 1.
29
+ * Start `app` on `port` of `host`. Prints `listeningMessage` once the port is
30
+ * bound; on a bind failure prints why and exits the process with status 1.
14
31
  */
15
- export function listenOrExit(app, port, listeningMessage) {
16
- const server = app.listen(port, (error) => {
32
+ export function listenOrExit(app, port, host, listeningMessage) {
33
+ const server = app.listen({ port, host }, (error) => {
17
34
  // A failed bind arrives here too; the `error` listener below reports it.
18
35
  if (error)
19
36
  return;
@@ -24,7 +41,7 @@ export function listenOrExit(app, port, listeningMessage) {
24
41
  ? err.code
25
42
  : undefined;
26
43
  if (code === "EADDRINUSE") {
27
- console.error(`Failed to start: Port ${port} is already in use. Set PORT to a free port or stop the conflicting process.`);
44
+ console.error(`Failed to start: Port ${port} is already in use on ${host}. Set PORT to a free port or stop the conflicting process.`);
28
45
  }
29
46
  else {
30
47
  console.error("HTTP server encountered an error while starting:", err);
@@ -16,7 +16,7 @@ import { localhostOriginValidation } from "@modelcontextprotocol/node";
16
16
  import express from "express";
17
17
  import { createServer } from "../server/index.js";
18
18
  import cors from "cors";
19
- import { listenOrExit } from "./listen.js";
19
+ import { bindHost, hostAndPort, listenOrExit } from "./listen.js";
20
20
  /**
21
21
  * Answer a request the transport cannot serve with a JSON-RPC error body, as
22
22
  * the Streamable HTTP transport does, so the client is not left waiting.
@@ -110,7 +110,7 @@ export function createApp() {
110
110
  }
111
111
  /**
112
112
  * Start the SSE server as the launcher does: build the app and bind it to
113
- * `PORT` (default 3001).
113
+ * `PORT` (default 3001) on `HOST` (default loopback).
114
114
  */
115
115
  export function startSseServer() {
116
116
  console.error("Starting SSE server...");
@@ -119,5 +119,6 @@ export function startSseServer() {
119
119
  const app = createApp();
120
120
  // Start the express server
121
121
  const PORT = process.env.PORT || 3001;
122
- return listenOrExit(app, PORT, `Server is running on port ${PORT}`);
122
+ const HOST = bindHost();
123
+ return listenOrExit(app, PORT, HOST, `Server is running on ${hostAndPort(HOST, PORT)}`);
123
124
  }
@@ -31,7 +31,7 @@ import express from "express";
31
31
  import { createServer } from "../server/index.js";
32
32
  import { randomUUID } from "node:crypto";
33
33
  import cors from "cors";
34
- import { listenOrExit } from "./listen.js";
34
+ import { bindHost, hostAndPort, listenOrExit } from "./listen.js";
35
35
  import { InMemoryEventStore } from "./in-memory-event-store.js";
36
36
  /** The most bytes of a refused POST's body read to find its request id. */
37
37
  const MAX_ID_BODY_BYTES = 64 * 1024;
@@ -322,14 +322,16 @@ export function createApp() {
322
322
  }
323
323
  /**
324
324
  * Start the Streamable HTTP server as the launcher does: build the app, bind
325
- * it to `PORT` (default 3001), and install its shutdown handler for SIGINT.
325
+ * it to `PORT` (default 3001) on `HOST` (default loopback), and install its
326
+ * shutdown handler for SIGINT.
326
327
  */
327
328
  export function startStreamableHttpServer() {
328
329
  console.log("Starting Streamable HTTP server...");
329
330
  const { app, shutdown } = createApp();
330
331
  // Start the server
331
332
  const PORT = process.env.PORT || 3001;
332
- const httpServer = listenOrExit(app, PORT, `MCP Streamable HTTP Server listening on port ${PORT}`);
333
+ const HOST = bindHost();
334
+ const httpServer = listenOrExit(app, PORT, HOST, `MCP Streamable HTTP Server listening on ${hostAndPort(HOST, PORT)}`);
333
335
  // Handle server shutdown
334
336
  process.on("SIGINT", shutdown);
335
337
  return httpServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
4
  "description": "MCP server that exercises all the features of the MCP protocol",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "mcpName": "io.github.modelcontextprotocol/server-everything",
@@ -41,8 +41,7 @@
41
41
  "@modelcontextprotocol/server": "^2.3.1",
42
42
  "@modelcontextprotocol/server-legacy": "^2.3.1",
43
43
  "cors": "^2.8.5",
44
- "express": "^5.2.1",
45
- "jszip": "^3.10.1",
44
+ "express": "^5.3.0",
46
45
  "zod": "^4.2.0"
47
46
  },
48
47
  "devDependencies": {