Skip to content

feat: integrate Reactome MCP tools into LangGraph agent via LangChain tool wrappers #136

@GovindhKishore

Description

@GovindhKishore

Summary

This issue tracks the implementation of LangChain tool wrappers around the Reactome MCP server, building on the MCP client foundation added in #127.

Background

PR #127 introduced the low-level MCP client (MCPClient) and process manager (MCPProcessManager) that handle JSON-RPC communication with the reactome-mcp Node.js server. However, those components are not yet connected to the LangGraph agent, so the chatbot cannot use them to answer questions.

Proposed Changes

New file - src/mcp/mcp_tools.py

  • create_mcp_tools() async factory function that starts the MCP server and returns LangChain StructuredTool wrappers
  • Five tools wrapping the most impactful MCP server capabilities:
    • search_reactome - search for pathways, proteins, and genes
    • get_pathway - retrieve detailed pathway information by stable ID
    • analyze_identifiers - run pathway enrichment analysis on a gene/protein list
    • get_database_info - get current Reactome database version
    • get_species - list all species available in Reactome

Modified - src/agent/graph.py

  • MCP server started in initialize() via MCP_SERVER_PATH environment variable
  • Graphs built individually per profile so React-to-Me receives mcp_tools and Cross-Database is unaffected
  • MCP server stopped cleanly in close_pool() on app shutdown

Modified - src/agent/profiles/react_to_me.py

  • create_reactome_graph() and ReactToMeGraphBuilder accept optional mcp_tools parameter
  • Tools bound to LLM once at init time via bind_tools()
  • call_model implements tool-calling loop - LLM decides whether to call MCP tools or answer directly
  • Falls back to existing reactome_rag behaviour when no tools provided - zero behaviour change for existing deployments

Behaviour

When MCP_SERVER_PATH is not set the chatbot works exactly as before. When set the LLM gains access to live Reactome API data and can choose between ChromaDB retrieval and MCP tool calls depending on the question.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions