Skip to content

feat(mcp): add minimal Python MCP client for reactome-mcp integration#127

Open
GovindhKishore wants to merge 1 commit intoreactome:mainfrom
GovindhKishore:feat/mcp-client
Open

feat(mcp): add minimal Python MCP client for reactome-mcp integration#127
GovindhKishore wants to merge 1 commit intoreactome:mainfrom
GovindhKishore:feat/mcp-client

Conversation

@GovindhKishore
Copy link
Copy Markdown

Summary

Adds a minimal Python MCP integration layer under src/mcp/ that allows the Reactome Chatbot to communicate with the reactome-mcp server over JSON-RPC stdio.

Closes #126


Motivation

The reactome-mcp server exposes 53 live tools covering search, pathway queries, enrichment analysis, entity lookup, and more. These tools query Reactome APIs directly, meaning they always return current data regardless of when embeddings were last built. The chatbot currently has no way to talk to this server. This PR adds the foundation that makes all future MCP-based features possible.

This PR does not wire MCP into the LangGraph agent or add query routing - that is follow-up work. The sole purpose here is a working, tested communication layer between Python and the MCP server.


Changes

mcp_process_manager.py

  • Spawns the MCP server as a subprocess via asyncio.create_subprocess_exec
  • Validates server path at init time with a clear error if missing
  • Detects startup failures by reading stderr
  • Graceful shutdown with terminate(), falls back to kill() after 5 seconds
  • Async context manager support so the server is always stopped cleanly

mcp_client.py

  • Constructs and sends JSON-RPC requests over stdin
  • Reads responses from stdout with a configurable timeout
  • Handles malformed JSON and JSON-RPC error responses explicitly
  • call_tool() convenience method for cleaner tool invocation

Testing

Tested locally by starting the server programmatically and calling tools/list and reactome_search.

tools/list confirmed all 53 tools are accessible.

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

AI Usage Transparency

AI tools were used during development and drafting. All code was manually reviewed and tested locally.

@GovindhKishore
Copy link
Copy Markdown
Author

Hi @adamjohnwright , this PR adds a minimal Python MCP client as a foundation for integrating the reactome-mcp server into the chatbot. It's a prototype at this stage. The next steps would be wiring it into the LangGraph agent and adding query routing. Would appreciate your thoughts on the approach before building further on top of it.

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.

Add minimal Python MCP client for reactome-mcp integration

1 participant