@modelcontextprotocol/server-everything 2.2.1 → 2.3.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/README.md CHANGED
@@ -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";
@@ -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.0",
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": {