Skip to content

feat: HTTP server and client support (Streamable HTTP transport) - #5

Merged
jkyberneees merged 1 commit into
mainfrom
feat/http-transport
Oct 4, 2026
Merged

jkyberneees merged 1 commit into
mainfrom
feat/http-transport

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

  • MCP Streamable HTTP transport for the server: Handler(), ListenAndServe(addr), Serve(l) — one JSON-RPC message per POST, JSON or SSE responses, 202 for notifications, request-size caps, and HTTP server timeouts (slowloris-safe). Zero new dependencies.
  • Optional HTTP auth: SetAuthToken (constant-time Bearer check, 401 + WWW-Authenticate) and SetAllowedOrigins (403 on off-list Origins). Both off by default; stdio unaffected.
  • MCP client package: single Client interface with NewHTTPClient/NewHTTPClientWithToken (remote servers) and NewStdioClient (subprocess over pipes) — concurrency-safe, timeout-safe stream handling, protocol version validation.
  • Fully backward compatible: additive API only, stdio dispatch loop unchanged, all auth checks default-off.
  • Tests: 102 total, 91.9% statement coverage, green with -race. RED-first throughout; includes loopback E2E and subprocess tests.
  • Docs: README, AGENTS.md, and landing page updated.

Adversarially reviewed (3 reviewers) with all findings fixed and independently verified.

- Server: Handler(), ListenAndServe(addr), Serve(l) — MCP Streamable HTTP
  over net/http, zero new dependencies. One JSON-RPC message per POST,
  JSON or SSE response per Accept, 202 for notifications, 405/415 for
  bad method/content-type, MaxRequestBytes caps via MaxBytesReader.
- Auth: optional SetAuthToken (constant-time Bearer check, 401 +
  WWW-Authenticate challenge) and SetAllowedOrigins (403 on off-list
  Origins, DNS-rebinding defense). Both off by default; stdio unaffected.
- Client: Client interface with NewHTTPClient(url) and NewStdioClient
  (subprocess over pipes) — Initialize, ListTools, CallTool,
  ListResources, ReadResource, ListPrompts, GetPrompt, Close.
- Tests: RED-first; httptest server suite, client suites (HTTP + real
  subprocess), loopback E2E covering tools, resources, and prompts.
- Docs: README API reference and AGENTS.md code map updated.
@jkyberneees
jkyberneees merged commit 75d5f00 into main Oct 4, 2026
6 checks passed
@jkyberneees
jkyberneees deleted the feat/http-transport branch October 4, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant