Summary
This issue documents the addition of a minimal Python MCP integration layer that allows the Reactome Chatbot to communicate with the reactome-mcp server over the JSON-RPC stdio protocol.
A pull request implementing this will be opened shortly.
Background
The reactome-mcp repository exposes 53 tools for interacting with the Reactome knowledgebase - search, pathway queries, enrichment analysis, entity lookup, diagram export, and more. However, the chatbot currently has no Python client capable of communicating with the MCP server.
This integration addresses that gap and lays the groundwork for future query routing between ChromaDB (static embeddings) and live MCP tool calls.
Implementation
A small MCP module is added under src/mcp/:
src/mcp/
├── __init__.py
├── mcp_process_manager.py
└── mcp_client.py
MCPProcessManager - manages the lifecycle of the MCP server subprocess:
- Spawns
node dist/index.js via asyncio.create_subprocess_exec
- Detects startup failures by checking process return code and reading stderr
- Graceful shutdown with
terminate(), falls back to kill() after 5 seconds
- Implements async context manager for safe lifecycle handling
MCPClient - minimal JSON-RPC client over stdin/stdout:
- Constructs and sends JSON-RPC requests
- Reads and parses responses from stdout
- Timeout on
readline() so the chatbot never hangs indefinitely
- Handles JSON-RPC error responses explicitly
call_tool() convenience method for cleaner tool invocation
Development Setup
The MCP server was cloned as a sibling directory alongside the chatbot project and built with:
npm install
npm run build
Project structure used during development:
PycharmProjects/
├── reactome_chatbot/
│ └── src/
│ └── mcp/
│ ├── mcp_process_manager.py
│ └── mcp_client.py
└── reactome-mcp/
└── dist/
└── index.js
Testing
Tested locally by starting the server programmatically, calling tools/list and reactome_search via both call() and call_tool().
tools/list confirmed all 53 tools are accessible, including reactome_search, reactome_analyze_identifiers, reactome_get_pathway, reactome_export_diagram, and others.
reactome_search output via call_tool():
Search Results for "TP53"
Found: 3420 results
- TP53 (R-HSA-69488) - ReferenceGeneProduct, Homo sapiens
- TP53 (R-HSA-8869337) - ReferenceGeneProduct, Homo sapiens
- Unfolded TP53 (R-HSA-6813797) - ReferenceGeneProduct, Homo sapiens
...
Showing 25 of 3420 results
This confirms the server starts and stops correctly from Python, JSON-RPC communication works over stdin/stdout, and tool arguments are passed and parsed correctly.
Summary
This issue documents the addition of a minimal Python MCP integration layer that allows the Reactome Chatbot to communicate with the
reactome-mcpserver over the JSON-RPC stdio protocol.A pull request implementing this will be opened shortly.
Background
The
reactome-mcprepository exposes 53 tools for interacting with the Reactome knowledgebase - search, pathway queries, enrichment analysis, entity lookup, diagram export, and more. However, the chatbot currently has no Python client capable of communicating with the MCP server.This integration addresses that gap and lays the groundwork for future query routing between ChromaDB (static embeddings) and live MCP tool calls.
Implementation
A small MCP module is added under
src/mcp/:MCPProcessManager- manages the lifecycle of the MCP server subprocess:node dist/index.jsviaasyncio.create_subprocess_execterminate(), falls back tokill()after 5 secondsMCPClient- minimal JSON-RPC client over stdin/stdout:readline()so the chatbot never hangs indefinitelycall_tool()convenience method for cleaner tool invocationDevelopment Setup
The MCP server was cloned as a sibling directory alongside the chatbot project and built with:
Project structure used during development:
Testing
Tested locally by starting the server programmatically, calling
tools/listandreactome_searchvia bothcall()andcall_tool().tools/listconfirmed all 53 tools are accessible, includingreactome_search,reactome_analyze_identifiers,reactome_get_pathway,reactome_export_diagram, and others.reactome_searchoutput viacall_tool():This confirms the server starts and stops correctly from Python, JSON-RPC communication works over stdin/stdout, and tool arguments are passed and parsed correctly.