You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(transport): add Streamable HTTP transport mode (#84)
Adds the http (Streamable HTTP, MCP rev 2025-03-26) transport mode alongside stdio and legacy sse. Includes new CLI flags and config, per-session isolation, DNS-rebinding/Origin defenses, MCP SDK 1.29.0, and full test coverage. Bumps version to 1.3.0 and updates CHANGELOG.
- Config support: `transport.httpHost`, `transport.httpPort`, `transport.httpAllowedOrigins` with validation and serialization
10
+
- Stateful, isolated sessions: each session gets its own server instance seeded from the primary session's working directory
11
+
-**`sse` (HTTP/SSE) transport mode** for the MCP server (#83)
12
+
- New CLI flags: `--transport sse`, `--sse-host`, `--sse-port` (default `127.0.0.1:9444`)
13
+
- Config file support via the `transport` section
14
+
- New integration and unit test suites for the Streamable HTTP transport: handshake/lifecycle, sessions, resources, security, and tool execution
15
+
- README documentation for the `http` transport mode, a no-config-file CLI recipe, and a UAT plan
16
+
17
+
### Changed
18
+
19
+
- Upgraded MCP SDK to 1.29.0 for `StreamableHTTPServerTransport`
20
+
- Refactored shared HTTP logic (origin validation, CORS echo, socket tracking, graceful close) from `transport.ts` into `httpShared.ts`; `closeSseServer` is now a thin wrapper over `closeHttpServer`, so existing SSE callers are unaffected
|`--transport`| string | stdio | Transport protocol: `stdio` or `sse`|
501
-
|`--sse-host`| string | 127.0.0.1 | Host address for SSE transport |
502
-
|`--sse-port`| number | 9444 | Port for SSE transport |
503
-
|`--sse-allowed-origins`| string | (none) | Comma-separated browser origins allowed in addition to loopback hosts and the bind host (e.g. `https://app.example.com,192.168.1.10`). Only the host component is compared. Required for browser clients on a wildcard (`0.0.0.0`) bind. |
504
-
505
-
When SSE mode is active, clients connect via `GET /sse` to open an SSE
506
-
stream and send messages via `POST /messages?sessionId=<id>`. The server
507
-
logs the bind address and port on startup. To mitigate DNS-rebinding
508
-
attacks, the server validates the request `Origin` header: requests whose
509
-
`Origin` is not a loopback host, the configured bind host, or one of the
510
-
configured `--sse-allowed-origins` are rejected with `403 Forbidden`, while
511
-
non-browser clients that send no `Origin` are allowed.
512
-
513
-
>**Security:** This transport has no built-in authentication and exposes
514
-
> command-execution tools. Keep it bound to `127.0.0.1` (the default) for
515
-
>local use. Binding to `0.0.0.0` or any non-loopback address exposes those
516
-
> tools to every host that can reach the port; only do so behind an
517
-
> authenticated reverse proxy or equivalent access control. Origin validation
518
-
> alone does not authenticate non-browser clients.
514
+
|`--transport`| string | stdio | Transport protocol: `stdio`, `http` (Streamable HTTP), or `sse` (legacy HTTP+SSE) |
515
+
|`--http-host`| string | 127.0.0.1 | Host address for the Streamable HTTP transport (`http` mode) |
516
+
|`--http-port`| number | 9444 | Port for the Streamable HTTP transport (`http` mode) |
517
+
|`--http-allowed-origins`| string | (none) | Comma-separated browser origins allowed for`http` mode,in addition to loopback hosts and the bind host (e.g. `https://app.example.com,192.168.1.10`). Only the host component is compared. Required for browser clients on a wildcard (`0.0.0.0`) bind. |
518
+
|`--sse-host`| string | 127.0.0.1 | Host address for the legacy SSE transport (`sse` mode) |
519
+
|`--sse-port`| number | 9444 | Port for the legacy SSE transport (`sse` mode) |
520
+
|`--sse-allowed-origins`| string | (none) | Comma-separated browser origins allowed for`sse` mode,in addition to loopback hosts and the bind host. Only the host component is compared. Required for browser clients on a wildcard (`0.0.0.0`) bind. |
521
+
522
+
When `http` mode is active, clients use a single `/mcp` endpoint:
523
+
524
+
- `POST /mcp` carries client-to-server JSON-RPC messages. An `initialize`
525
+
request with no session id starts a new session; the server returns the
526
+
assigned id in the `Mcp-Session-Id` response header, and the client must
527
+
send that header on every subsequent request.
528
+
- `GET /mcp` opens the optional server-to-client SSE stream for an existing
529
+
session.
530
+
- `DELETE /mcp` terminates an existing session.
531
+
532
+
Sessions are stateful and isolated: each session has its own active working
533
+
directory, so one client's `set_current_directory` cannot affect another.
534
+
Requests carrying an unknown or terminated `Mcp-Session-Id` are rejected with
535
+
`404 Not Found`. The server logs the bind address and port on startup (with
536
+
`--debug`).
537
+
538
+
When `sse` mode is active, clients instead connect via `GET /sse` to open an
539
+
SSE stream and send messages via `POST /messages?sessionId=<id>`.
540
+
541
+
**Configuring Streamable HTTP entirely with CLI parameters (no config file).**
542
+
Every transport and operational setting can be supplied as an input parameter,
543
+
so the server can run as a Streamable HTTP server without any config file:
0 commit comments