Skip to main content

MCP server for the KEGG bioinformatics database REST API

Project description

kegg-mcp-server-python

PyPI Python 3.11–3.14 License: MIT CI

An unofficial Python Model Context Protocol (MCP) server for the KEGG bioinformatics database. It exposes 33 tools, 8 resource templates, and 3 guided prompts to any MCP-compatible client (Claude Desktop, Claude Code, Cursor, etc.).

Built with FastMCP, returns structured Pydantic JSON (not raw text), and includes per-operation TTL caching, request retry with exponential backoff, KEGG-friendly concurrency limits, structured JSON stderr logging, and batch helpers out of the box. No API key required -- uses the free KEGG REST API.

Responses are token-aware by default: get_*_info tools return a compact EntrySummary (entry id, name, class, description, counts of linked entities) unless you pass detail_level="full". Errors are returned as a typed ErrorResult the model can reason about, not raised as exceptions.

Note: This is a community non-official project and is not affiliated with or endorsed by KEGG or Kanehisa Laboratories.


Quick start

With uvx (no install)

uvx kegg-mcp-server

With pip

pip install kegg-mcp-server
kegg-mcp-server

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "kegg": {
      "command": "uvx",
      "args": ["kegg-mcp-server"]
    }
  }
}
Config file locations
OS Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

Claude Code

claude mcp add kegg-mcp-server -- uvx kegg-mcp-server

MCPB bundle (Claude Desktop, no Python required)

Download the latest .mcpb from the releases page and drag it onto Claude Desktop. The bundle vendors all Python dependencies and runs with Claude Desktop's embedded Python.


What's included

33 Tools

Category Tools Examples
Database get_database_info, list_organisms Get KEGG release stats, list all ~26k organisms
Pathways search_pathways, get_pathway_info, get_pathway_genes, get_pathway_compounds, get_pathway_reactions Search by keyword, get full pathway details
Genes search_genes, get_gene_info, get_gene_orthologs Find genes in any organism, cross-species orthologs
Compounds search_compounds, get_compound_info, get_compound_reactions Search by name/formula/mass, find reactions
Reactions search_reactions, get_reaction_info Equation, enzymes, pathways for any reaction
Enzymes search_enzymes, get_enzyme_info EC number lookup, substrates, genes
Diseases search_diseases, get_disease_info Disease genes, drugs, pathways
Drugs search_drugs, get_drug_info, get_drug_interactions Drug targets, DDI screening
Modules search_modules, get_module_info Functional module definitions
Orthology search_ko_entries, get_ko_info KEGG Orthology entries
Glycans search_glycans, get_glycan_info Glycan composition, reactions
BRITE search_brite, get_brite_info Functional hierarchies
Cross-database batch_entry_lookup, convert_identifiers, find_related_entries Bulk fetch (up to 50), ID mapping (UniProt, NCBI, ChEBI, PubChem)

8 Resource Templates

Direct URI-based access to KEGG entities:

kegg://pathway/{pathway_id}      e.g. kegg://pathway/hsa00010
kegg://gene/{gene_id}            e.g. kegg://gene/hsa:1956
kegg://compound/{compound_id}    e.g. kegg://compound/C00002
kegg://reaction/{reaction_id}    e.g. kegg://reaction/R00756
kegg://disease/{disease_id}      e.g. kegg://disease/H00004
kegg://drug/{drug_id}            e.g. kegg://drug/D00001
kegg://organism/{org_code}       e.g. kegg://organism/hsa
kegg://search/{database}/{query} e.g. kegg://search/compound/glucose

3 Guided Prompts

Prompt Arguments What it does
pathway_enrichment_analysis gene_list, organism Maps a gene list to KEGG IDs, aggregates pathway associations, identifies enriched pathways
drug_target_investigation drug_name Drug lookup, target identification, pathway mapping, DDI screening
metabolic_pathway_comparison pathway_id, organisms Compares gene/compound content of a pathway across species

Transport options

# stdio (default -- for Claude Desktop, Claude Code, uvx)
kegg-mcp-server

# Streamable HTTP (for web/API deployment)
kegg-mcp-server --transport streamable-http --host 0.0.0.0 --port 8080

# python -m also works
python -m kegg_mcp_server

Development

git clone https://github.com/Lucas-Servi/kegg-mcp-server-python
cd kegg-mcp-server-python
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Lint
ruff check src/ tests/

# Debug with MCP Inspector
mcp dev kegg-mcp-server

Project structure

src/kegg_mcp_server/
  server.py       FastMCP instance, lifespan (httpx client + TTL cache), CLI
  client.py       KEGGClient: async KEGG REST with retry/backoff + KEGG-politeness semaphore
  cache.py        Per-op TTL cache (info 24h, list 1h, entry ops 5min)
  parsers.py      KEGG flat-file and tab-delimited response parsers + summarize_flat_entry
  errors.py       KEGGAPIError exception type
  logging.py      JSON stderr logger (stdout is reserved for MCP stdio framing)
  resources.py    8 MCP resource templates
  prompts.py      3 bioinformatics workflow prompts
  models/         Pydantic models for all KEGG entity types + EntrySummary + ErrorResult
  tools/          13 tool modules, each with a register(mcp) function; _common.py has the
                  @kegg_tool error-boundary decorator and shared READ_ONLY annotations

Author

Developed by Lucas Servi (lucasservi@gmail.com) at Elytron Biotech using Claude Code.

Acknowledgments

License

MIT -- see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kegg_mcp_server-0.2.0.tar.gz (107.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kegg_mcp_server-0.2.0-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file kegg_mcp_server-0.2.0.tar.gz.

File metadata

  • Download URL: kegg_mcp_server-0.2.0.tar.gz
  • Upload date:
  • Size: 107.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kegg_mcp_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 547c3c09a92bea5f862346d0733a980d32b385b4e79a8791dc76b835d199d9ac
MD5 bcfa22b06cc63e3ba4e5f523eafea7ea
BLAKE2b-256 33c19e7e09a596d0fc311b4490b32494a1add21f806339de8d8819bb75872771

See more details on using hashes here.

Provenance

The following attestation bundles were made for kegg_mcp_server-0.2.0.tar.gz:

Publisher: publish.yml on Lucas-Servi/kegg-mcp-server-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kegg_mcp_server-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kegg_mcp_server-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kegg_mcp_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3eeb438fbb10b8f92dc21d55816d545995c7f444d47e8fa4df8460ce482b169
MD5 072b9326edcef813a4b7d126b61fc08d
BLAKE2b-256 bb4ad8b1cd630835704b420ede4bced9e6c3f0efa3d92aa77b3a21de52c1da43

See more details on using hashes here.

Provenance

The following attestation bundles were made for kegg_mcp_server-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Lucas-Servi/kegg-mcp-server-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page