Talk to the MCP over HTTP, because stdio cannot work where this runs - #219
Merged
Merged
Conversation
The live destination spawns `node` and speaks over a pipe. That works on a
developer's machine and cannot work in the deployed container:
$ docker exec biochat_beta_guest sh -c 'command -v node || echo NO NODE'
NO NODE
$ docker inspect ... --format '{{range .HostConfig.Binds}}...'
/home/awright/git/reactome_chatbot/config.yml:/app/config.yml
/home/awright/git/reactome_chatbot/embeddings:/app/embeddings
The image is Python, it has no node, and it does not mount reactome-mcp.
`REACTOME_MCP_SERVER` can never be satisfied there. The feature worked on every
machine it was tested on and none that it ships to -- the same shape as the
streaming bug fixed yesterday, found the same way: by asking where it actually
runs rather than where it was written.
reactome-mcp gained Streamable HTTP, which is what a sibling container or a
hosted instance offers. `REACTOME_MCP_URL` uses it, and wins over
`REACTOME_MCP_SERVER` when both are set. stdio stays for local development,
where the repo and node both exist.
Two protocol details are pinned by tests, because both are easy to get wrong
and neither fails in a way that points at the cause:
- the session id arrives in the `mcp-session-id` **response header** of
initialize and must be resent on every later request; omit it and the
server answers 400.
- replies come back **SSE-framed** (`event: message` / `data: {...}`) rather
than as bare JSON, even for a single reply to a POST. Parsing the body as
JSON gets a decode error on text that is perfectly valid. The last data
line wins, since a stream may carry progress notifications first.
`create_mcp_tools` already took a `ToolCaller` Protocol, so the HTTP client
drops in beside the stdio one with no change to the tools or the graph.
Verified against a real server, end to end and through the graph:
tools over HTTP : 5
species : **Total:** 96
answer : Reactome covers a total of 96 species...
streamed : 46 tokens
Eight tests against a mock transport, and the full suite passes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The live destination spawns
nodeand speaks over a pipe. That works on a developer's machine and cannot work in the deployed container:The image is Python, has no node, and doesn't mount reactome-mcp.
REACTOME_MCP_SERVERcan never be satisfied there.The feature worked on every machine it was tested on and none that it ships to — the same shape as the streaming bug fixed in #218, and found the same way: by asking where it actually runs rather than where it was written.
Two transports
REACTOME_MCP_URLREACTOME_MCP_SERVERnodeREACTOME_MCP_URLwins when both are set. stdio stays for local development, where the repo and node both exist.create_mcp_toolsalready took aToolCallerProtocol, so the HTTP client drops in beside the stdio one with no change to the tools or the graph.Two protocol details, both pinned by tests
Easy to get wrong, and neither fails in a way that points at the cause:
mcp-session-idresponse header of initialize and must be resent on every later request. Omit it and the server answers 400.event: message/data: {...}) rather than as bare JSON, even for a single reply to a POST. Parsing the body as JSON gets a decode error on text that is perfectly valid. The lastdata:line wins, since a stream may carry progress notifications first.Verified against a real server
End to end, and through the compiled graph with a callback handler:
8 tests against
httpx.MockTransport; full suite passes;ruff,ruff format,mypyclean across 103 files.What this unblocks
Beta can now have the live destination. Run reactome-mcp as a sibling container and set
REACTOME_MCP_URL— no node in the chatbot image, nothing mounted, no change to how the chatbot is built.🤖 Generated with Claude Code