feat: add Streamable HTTP transport for MCP server#27
Merged
Conversation
Add `otto mcp serve-http` alongside the existing stdio server (now `otto mcp serve`), sharing tool registration via registerOttoTools(). The HTTP endpoint uses StreamableHTTPServerTransport with per-session transports, bearer-token auth (OTTO_MCP_API_KEY), and origin validation. Update `otto agent install` to the `mcp serve` path, point ChatGPT setup at the HTTP endpoint, fix MCP serverInfo version resolution, and refresh the command docs.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Streamable HTTP transport to Otto's MCP server alongside the existing stdio transport, mirroring the integration path Ideon recently shipped. Both transports expose the identical tool set via a shared
registerOttoTools().otto mcp serve— stdio (unchanged behavior; previously the top-levelotto mcp)otto mcp serve-http --api-key <key> [--port 3001] [--host 127.0.0.1] [--endpoint /mcp]— Streamable HTTPThe HTTP endpoint uses
StreamableHTTPServerTransportwith per-session transports keyed byMcp-Session-Id, bearer-token auth (OTTO_MCP_API_KEY), and allowed-origin validation.Changes
packages/cli/src/mcp/http-middleware.ts—createBearerAuthMiddleware+createOriginValidator.packages/cli/src/mcp/http-server.ts— Express app, session map,startOttoMcpHttpServer.mcp/server.ts— extractregisterOttoTools()(shared by both transports); fixserverInfo.versionresolution (was reporting0.0.0).index.ts—otto mcp→serve/serve-httpsubcommands.mcp serve; ChatGPT setup points at the HTTP endpoint.otto mcp serve/serve-httpacross the command reference and agent guides.express,cors(+ types).Test plan
npm run check,npm run lint,npm run test:coverageall green (lines 92.61% / branches 90.47%, exit 0).mcp-http-server.test.ts).serve-http:401, wrong token →403, badOrigin→403, valid →200+Mcp-Session-Id.400; GET w/o or unknown session →400; GET SSE w/ session →200;DELETE→200.tools/call otto_statusreturns structured content;tools/list→ all 25 tools over both HTTP and stdio.Notes
otto agent install; HTTP is the manual option for ChatGPT / remote / container hosts (mirrors Ideon).http-server.tsis transport glue (binds a port), so — like the existingmcp/server.ts— it's covered by manual/integration testing rather than the unit-coverage gate.🤖 Generated with Claude Code