Skip to content

Commit 311c0fd

Browse files
cliffhallclaude
andcommitted
feat: serve Streamable HTTP from every reference server
Every server already served stdio, and only everything served Streamable HTTP. Now filesystem, memory, sequential-thinking, fetch, git and time take --transport streamable-http and serve one /mcp endpoint for 2026-07-28 and 2025-era clients alike, on HOST:PORT (127.0.0.1:3001 by default). The TypeScript servers serve their existing factory through the SDK's createMcpHandler (stateless for 2025-era clients) behind a localhost Origin check; the Python servers run the SDK's Streamable HTTP app. Over HTTP, filesystem requires command-line directories (Roots cannot reach it), memory publishes graph changes on the handler's listen bus, and sequential-thinking keeps one history per process. The boot smoke now boots each server over Streamable HTTP as well. Closes #576 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent 6cfff62 commit 311c0fd

49 files changed

Lines changed: 2200 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/576-streamable-http.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@modelcontextprotocol/server-filesystem": minor
3+
"@modelcontextprotocol/server-memory": minor
4+
"@modelcontextprotocol/server-sequential-thinking": minor
5+
---
6+
7+
Serve Streamable HTTP as well as stdio (#576). `--transport streamable-http` serves the server on one `/mcp` endpoint, for 2026-07-28 and 2025-era clients alike, at `HOST`:`PORT` (`127.0.0.1:3001` by default); stdio stays the default. Over HTTP the filesystem server requires its allowed directories on the command line, since it cannot ask a client for its Roots, and the sequential-thinking history belongs to the server process rather than to one connection.

‎.claude/skills/local-dev/SKILL.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ streams: HTTP+SSE writes everything to stderr, while Streamable HTTP writes its
7979
request and session messages to stdout and its listening line (which names
8080
the bound `host:port`) and errors to stderr.
8181

82+
The other six servers serve Streamable HTTP too (#576), selected with a flag
83+
rather than an argument, on the same `PORT`, `HOST` and `/mcp` path:
84+
85+
```sh
86+
node src/memory/dist/index.js --transport streamable-http
87+
node src/filesystem/dist/index.js --transport streamable-http /tmp/scratch # directories required over HTTP
88+
(cd src/time && uv run mcp-server-time --transport streamable-http)
89+
```
90+
91+
Each one's endpoint is stateless for 2025-era clients (a fresh server per
92+
request; GET and DELETE answer 405), so nothing the server asks of the client
93+
mid-session (filesystem's Roots) reaches it over HTTP.
94+
8295
## Run the local package the way a user would
8396

8497
A user starts these servers with `npx` or `uvx`. Both accept a path in place of

‎.claude/skills/project-structure/SKILL.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ includes the tests) and `vitest.config.ts`.
2929
| Server | Layout | Where its features are registered |
3030
| --- | --- | --- |
3131
| `everything` | `index.ts` picks a transport from `argv`; `server/` holds the factory; `tools/`, `resources/`, `prompts/` hold one file per feature plus an `index.ts`; `transports/` holds one file per transport; `version.ts` reads the package version; `docs/` is shipped | Each feature file exports a `register…` function, wired into its area's `index.ts` (`registerTools`, `registerResources`, `registerPrompts`), which `server/index.ts` calls from `createServer()` |
32-
| `filesystem` | `index.ts` is the stdio entry point (argv → allowed directories, `main()`); `server.ts` exports `createServer(allowedDirectories)`; `lib.ts` holds the file operations and path validation, with the allow-list passed in rather than held globally; `path-utils.ts`, `path-validation.ts` and `roots-utils.ts` are focused helpers, and `pinned-directory.ts` runs the write operations inside their verified directory; `version.ts` reads the package version | Inline in `createServer()` in `server.ts`, with `server.registerTool(...)` |
33-
| `memory` | `index.ts` holds the `KnowledgeGraphManager`, `createServer(memoryFilePath)` and the stdio `main()`; `version.ts` reads the package version | Inline in `createServer()`; the resource and its subscription handlers are exported `register…` functions in the same file |
34-
| `sequentialthinking` | `index.ts` holds `createServer()` and the stdio `main()`; `lib.ts` holds `SequentialThinkingServer`, the logic; `version.ts` reads the package version | Inline in `createServer()` |
32+
| `filesystem` | `index.ts` is the entry point (argv → transport and allowed directories, `main()`); `http.ts` serves the factory over Streamable HTTP; `server.ts` exports `createServer(allowedDirectories)`; `lib.ts` holds the file operations and path validation, with the allow-list passed in rather than held globally; `path-utils.ts`, `path-validation.ts` and `roots-utils.ts` are focused helpers, and `pinned-directory.ts` runs the write operations inside their verified directory; `version.ts` reads the package version | Inline in `createServer()` in `server.ts`, with `server.registerTool(...)` |
33+
| `memory` | `index.ts` holds the `KnowledgeGraphManager`, `createServer(memoryFilePath)`, the stdio `main()` and `run()`, which picks the transport; `http.ts` serves the factory over Streamable HTTP; `version.ts` reads the package version | Inline in `createServer()`; the resource and its subscription handlers are exported `register…` functions in the same file |
34+
| `sequentialthinking` | `index.ts` holds `createServer()`, the stdio `main()` and `run()`, which picks the transport; `http.ts` serves the factory over Streamable HTTP; `lib.ts` holds `SequentialThinkingServer`, the logic; `version.ts` reads the package version | Inline in `createServer()` |
3535

3636
Three things about `everything` that the table cannot hold:
3737

@@ -69,6 +69,7 @@ src/<server>/
6969
├── src/mcp_server_<name>/
7070
│ ├── __init__.py main(): the command-line flags, then asyncio.run(serve(...))
7171
│ ├── __main__.py python -m mcp_server_<name>
72+
│ ├── transport.py --transport: stdio, or Streamable HTTP on $HOST:$PORT
7273
│ └── server.py everything else
7374
└── tests/ pytest suite, driving serve() in-process
7475
```

‎.claude/skills/testing/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ connection harness does (`__tests__/harness.ts` in `everything`,
4040

4141
| Server | How its tests reach the code |
4242
| --- | --- |
43-
| `everything`, `filesystem`, `memory`, `sequentialthinking` | An SDK `Client` connected to the server's `createServer()` over `InMemoryTransport`, in the vitest process, through the server's own harness, plus unit tests of helper modules such as `lib.ts`. `everything` drives its stdio, SSE and Streamable HTTP transports in-process too; the other three have one thin spawn smoke of the built `dist/index.js` |
43+
| `everything`, `filesystem`, `memory`, `sequentialthinking` | An SDK `Client` connected to the server's `createServer()` over `InMemoryTransport`, in the vitest process, through the server's own harness, plus unit tests of helper modules such as `lib.ts`. `everything` drives its stdio, SSE and Streamable HTTP transports in-process too; the other three drive their `http.ts` in-process over a free loopback port, and have one thin spawn smoke of the built `dist/index.js` |
4444
| `fetch`, `git`, `time` | A `ClientSession` linked in-process to the real `serve()` over in-memory streams (below), plus direct calls on the pure functions in `server.py` |
4545

4646
No TypeScript test uses an in-memory transport yet.

‎AGENTS.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,11 @@ look before retrying.
688688
2026-07-28 request lives under a handle the server mints. Ask a client for
689689
input (elicitation, sampling, roots) by returning `inputRequired(...)`,
690690
which the SDK's legacy shim also serves to 2025-era clients.
691-
- **Transports**: stdio is the default and every server supports it.
692-
`everything` also serves Streamable HTTP and HTTP+SSE. **HTTP+SSE is
691+
- **Transports**: stdio is the default and every server supports it. Every
692+
server also serves Streamable HTTP on `/mcp` at `HOST`:`PORT`
693+
(loopback:3001 by default), which `everything` selects with its
694+
`streamableHttp` argument and the others with `--transport
695+
streamable-http`; `everything` alone also serves HTTP+SSE. **HTTP+SSE is
693696
deprecated**: keep what exists working, and never make it the default or the
694697
recommended option in new code or docs.
695698
- **Tool annotations**: every tool you add or change sets `readOnlyHint`,

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ An MCP server talks to its client over a **transport**. The protocol defines two
135135
| **stdio** | The client launches the server as a subprocess and talks to it over the process's stdin and stdout. The server opens no port. | A `command` and `args` in the client's configuration, as in the examples above |
136136
| **Streamable HTTP** | The server runs on its own as an HTTP service, and can serve many clients | A URL, such as `http://localhost:3001/mcp` |
137137

138-
**Every server in this repository serves stdio, and only [Everything](src/everything) also serves Streamable HTTP** (its README shows how to start it that way, and covers its deprecated HTTP+SSE transport too). So when you run `uvx mcp-server-git` or `npx -y @modelcontextprotocol/server-memory` in a terminal, it opens no port, prints at most a one-line startup notice, and then appears to hang. That is expected: it is waiting for a client to send it messages on stdin. You do not normally start a stdio server yourself; your MCP client starts it from its configuration and stops it when it is done.
138+
**Every server in this repository serves stdio by default, and every one can also serve Streamable HTTP** on `http://127.0.0.1:3001/mcp` (set `PORT` and `HOST` to move it): [Everything](src/everything) with its `streamableHttp` argument (its README also covers its deprecated HTTP+SSE transport), and the others with `--transport streamable-http`, as each server's README shows. Started without one, a server uses stdio, so when you run `uvx mcp-server-git` or `npx -y @modelcontextprotocol/server-memory` in a terminal, it opens no port, prints at most a one-line startup notice, and then appears to hang. That is expected: it is waiting for a client to send it messages on stdin. You do not normally start a stdio server yourself; your MCP client starts it from its configuration and stops it when it is done.
139139

140140
To try a server without setting up a client, use the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). Given a stdio server's command, it launches the server for you and lets you browse and call its tools; given a URL, it connects to a running Streamable HTTP server:
141141

@@ -144,7 +144,7 @@ To try a server without setting up a client, use the [MCP Inspector](https://git
144144
npx @modelcontextprotocol/inspector uvx mcp-server-git
145145

146146
# A Streamable HTTP server: start it first, then connect to its URL
147-
npx @modelcontextprotocol/server-everything streamableHttp
147+
npx @modelcontextprotocol/server-everything streamableHttp # or: uvx mcp-server-time --transport streamable-http
148148
npx @modelcontextprotocol/inspector --transport http --server-url http://localhost:3001/mcp
149149
```
150150

‎docs/quality-gate.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Notes on the stages:
105105
offline.
106106
- **`smoke` launches what a user launches**: the built `dist/index.js` for a
107107
TypeScript server, the console script through `uv run --no-sync` for a Python
108-
one. stdio for all seven; HTTP+SSE and Streamable HTTP as well for
108+
one. stdio and Streamable HTTP for all seven; HTTP+SSE as well for
109109
`everything`. The servers are given nothing outside the machine to talk to
110110
and none of your files: `fetch` is pointed at a page the smoke serves on the
111111
loopback interface, and the HTTP transports listen on a free port rather

‎package-lock.json‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/smoke-servers.mjs‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* npm run smoke # the root entry point (all)
99
*
1010
* For each server and transport it connects an MCP client, lists the tools,
11-
* and calls one of them: stdio for all seven servers, plus HTTP+SSE and
12-
* Streamable HTTP for `everything`, the only server that serves them.
11+
* and calls one of them: stdio and Streamable HTTP for all seven servers
12+
* (#576), plus HTTP+SSE for `everything`, the only server that serves it.
1313
*
1414
* Why it exists when every server has a test suite: the suites import the
1515
* source. Nothing in them runs the artifact a user actually launches, which is
@@ -40,8 +40,9 @@
4040
* 3001, so the smoke does not collide with a server the developer has running.
4141
* That port is not reserved between the probe and the server's own `listen`,
4242
* so a launch whose server reports the port taken is relaunched on a fresh
43-
* one. Both HTTP transports report it (`listenOrExit` in `everything`'s
44-
* `transports/listen.ts`).
43+
* one. Every HTTP launch reports it: `listenOrExit` in `everything`'s
44+
* `transports/listen.ts`, the other TypeScript servers' `http.ts` (through
45+
* their fatal-error line), and uvicorn under the Python servers.
4546
*
4647
* One server failing does not stop the rest: the run reports every target's
4748
* verdict and exits non-zero if any failed, so one run shows the whole picture.
@@ -122,22 +123,22 @@ export const SERVERS = [
122123
{
123124
name: "filesystem",
124125
language: "ts",
125-
transports: ["stdio"],
126+
transports: ["stdio", "streamableHttp"],
126127
args: (ctx) => [ctx.dir],
127128
call: () => ({ name: "list_allowed_directories", arguments: {} }),
128129
expect: (ctx) => path.basename(ctx.dir),
129130
},
130131
{
131132
name: "memory",
132133
language: "ts",
133-
transports: ["stdio"],
134+
transports: ["stdio", "streamableHttp"],
134135
env: (ctx) => ({ MEMORY_FILE_PATH: path.join(ctx.dir, "memory.jsonl") }),
135136
call: () => ({ name: "read_graph", arguments: {} }),
136137
},
137138
{
138139
name: "sequentialthinking",
139140
language: "ts",
140-
transports: ["stdio"],
141+
transports: ["stdio", "streamableHttp"],
141142
call: () => ({
142143
name: "sequentialthinking",
143144
arguments: {
@@ -151,7 +152,7 @@ export const SERVERS = [
151152
{
152153
name: "fetch",
153154
language: "py",
154-
transports: ["stdio"],
155+
transports: ["stdio", "streamableHttp"],
155156
// fetch refuses loopback addresses by default (#4838); the smoke page is
156157
// on loopback, so the guard is turned off for it.
157158
args: () => ["--allow-private-ips"],
@@ -167,22 +168,22 @@ export const SERVERS = [
167168
{
168169
name: "git",
169170
language: "py",
170-
transports: ["stdio"],
171+
transports: ["stdio", "streamableHttp"],
171172
args: (ctx) => ["--repository", ctx.dir],
172173
prepare: (ctx) => run("git", ["init", "--quiet", ctx.dir]),
173174
call: (ctx) => ({ name: "git_status", arguments: { repo_path: ctx.dir } }),
174175
},
175176
{
176177
name: "time",
177178
language: "py",
178-
transports: ["stdio"],
179+
transports: ["stdio", "streamableHttp"],
179180
args: () => ["--local-timezone", "UTC"],
180181
call: () => ({ name: "get_current_time", arguments: { timezone: "UTC" } }),
181182
expect: "UTC",
182183
},
183184
];
184185

185-
/** The argument that selects a transport; only `everything` takes one. */
186+
/** The path each HTTP transport is served on. */
186187
const TRANSPORT_ENDPOINT = { sse: "/sse", streamableHttp: "/mcp" };
187188

188189
/** Run a setup command to completion; throw with its output if it fails. */
@@ -289,9 +290,14 @@ export function launchSpec(
289290
* @returns {string[]}
290291
*/
291292
export function serverArguments(server, transport, ctx) {
292-
// `everything` picks its transport from its first argument; the others are
293-
// stdio-only and take none.
294-
const transportArg = server.transports.length > 1 ? [transport] : [];
293+
// `everything` picks its transport from its first argument; the others
294+
// default to stdio and take `--transport streamable-http` for HTTP (#576).
295+
const transportArg =
296+
server.name === "everything"
297+
? [transport]
298+
: transport === "streamableHttp"
299+
? ["--transport", "streamable-http"]
300+
: [];
295301
return [...transportArg, ...(server.args?.(ctx) ?? [])];
296302
}
297303

‎scripts/smoke-servers.test.mjs‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ test("findUnlistedServers names a server the table lacks, either language", (t)
4545
assert.deepEqual(findUnlistedServers(src), ["newpy", "newts"]);
4646
});
4747

48-
test("stdio for all seven; SSE and Streamable HTTP for everything only", () => {
48+
test("stdio and Streamable HTTP for all seven; SSE for everything only", () => {
4949
assert.equal(SERVERS.length, 7);
5050
for (const server of SERVERS) {
51-
assert.ok(server.transports.includes("stdio"), server.name);
5251
if (server.name !== "everything")
53-
assert.deepEqual(server.transports, ["stdio"], server.name);
52+
assert.deepEqual(
53+
server.transports,
54+
["stdio", "streamableHttp"],
55+
server.name,
56+
);
5457
}
5558
assert.deepEqual(byName("everything").transports, [
5659
"stdio",
@@ -60,7 +63,7 @@ test("stdio for all seven; SSE and Streamable HTTP for everything only", () => {
6063
});
6164

6265
test("selectTargets: no names means every server and transport", () => {
63-
assert.equal(selectTargets([]).length, 9);
66+
assert.equal(selectTargets([]).length, 15);
6467
});
6568

6669
test("selectTargets: named servers only, in the table's order", () => {
@@ -73,6 +76,7 @@ test("selectTargets: named servers only, in the table's order", () => {
7376
"everything/sse",
7477
"everything/streamableHttp",
7578
"time/stdio",
79+
"time/streamableHttp",
7680
],
7781
);
7882
});
@@ -102,6 +106,12 @@ test("launchSpec: a TypeScript server runs its built bin, with the transport whe
102106
);
103107
assert.equal(filesystem.command, bin("filesystem"));
104108
assert.deepEqual(filesystem.args, ["/tmp/x"]);
109+
// The other servers take the HTTP transport as a flag (#576).
110+
assert.deepEqual(
111+
launchSpec(byName("filesystem"), "streamableHttp", ctx, "/repo", "linux")
112+
.args,
113+
["--transport", "streamable-http", "/tmp/x"],
114+
);
105115
// Windows has no shebang: the file is handed to node.
106116
const win = launchSpec(byName("everything"), "sse", ctx, "/repo", "win32");
107117
assert.equal(win.command, process.execPath);

0 commit comments

Comments
 (0)