biothings-mcp

biothings-mcp

Provides a Model Context Protocol server for accessing and querying biomedical data from BioThings services, including gene, variant, chemical, and taxon annotations.

Category
访问服务器

README

MseeP.ai Security Assessment Badge

biothings-mcp

Tests PyPI version

MCP (Model Context Protocol) server for Biothings.io

This server implements the Model Context Protocol (MCP) for BioThings, providing a standardized interface for accessing and manipulating biomedical data. MCP enables AI assistants and agents to access specialized biomedical knowledge through structured interfaces to authoritative data sources. Supported BioThings data sources include:

If you want to understand more what is Model Context Protocol and how to use it more efficiently you can take DeepLearning AI Course or just search for MCP videos on YouTube.

About MCP (Model Context Protocol)

MCP is a protocol that bridges the gap between AI systems and specialized domain knowledge. It enables:

  • Structured Access: Direct connection to authoritative biomedical data sources
  • Natural Language Queries: Simplified interaction with specialized databases
  • Type Safety: Strong typing and validation through biothings-typed-client
  • AI Integration: Seamless integration with AI assistants and agents

Available API Interfaces

This server provides dedicated API interfaces for different BioThings data types, leveraging the biothings-typed-client library. These interfaces are implemented using the following tool handlers:

  • Gene Interface: GeneTools (wraps GeneClientAsync)
  • Variant Interface: VariantTools (wraps VariantClientAsync)
  • Chemical Interface: ChemTools (wraps ChemClientAsync)
  • Taxon Interface: TaxonTools (wraps TaxonClientAsync)
  • Download Interface: DownloadTools (provides file download and sequence analysis capabilities)

Local File Saving Features

The server includes local file saving capabilities through the DownloadTools interface, which provides:

Download Tools

  • download_entrez_data: Download data from NCBI Entrez databases (returns content as string)
  • download_entrez_data_local: Download data from NCBI Entrez databases and save to local file

Output Directory Management

  • Default Location: Files are saved to biothings_output/ directory in the current working directory
  • Custom Location: Use --output-dir parameter to specify a custom output directory
  • Automatic Creation: Output directories are created automatically if they don't exist
  • Unique Filenames: Auto-generated filenames include UUID prefixes to avoid conflicts

Supported File Formats

  • FASTA: .fasta extension for sequence data
  • GenBank: .gb extension for GenBank format data
  • Alignment: .aln extension for alignment results
  • JSON: .json extension for structured data
  • Text: .txt extension for general text data

Quick Start

Installing uv

# Download and install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Verify installation
uv --version
uvx --version

uvx is a very nice tool that can run a python package installing it if needed.

Running with uvx

You can run the biothings-mcp server directly using uvx without cloning the repository:

STDIO Mode (for MCP clients that require stdio, can be useful when you want to save files)

# Run the server in STDIO mode (default mode)
uvx biothings-mcp

# Or explicitly specify stdio mode
uvx --from biothings-mcp stdio

# With custom output directory
uvx --from biothings-mcp stdio --output-dir ./my_data

HTTP Streamable Mode (Web Server)

# Run the server in streamable HTTP mode on default port (3001)
uvx --from biothings-mcp server run

# Run on a custom port
uvx --from biothings-mcp server run --port 8000

# Run on custom host and port
uvx --from biothings-mcp server run --host 0.0.0.0 --port 8000

# With custom output directory
uvx --from biothings-mcp server run --output-dir ./my_data

SSE Mode (Server-Sent Events)

# Run the server in SSE mode on default port (3001)
uvx --from biothings-mcp sse

# Run on a custom port
uvx --from biothings-mcp sse --port 8000

The HTTP streamable mode will start a web server that you can access at http://localhost:3001/mcp (with documentation at http://localhost:3001/docs). The STDIO mode is designed for MCP clients that communicate via standard input/output, while SSE mode uses Server-Sent Events for real-time communication.

Configuring your (Anthropic Claude Desktop, Cursor, Windsurf, etc.)

We provide stdio configuration using the proxy (might need npx to run):

  • mcp-config-remote.json - for remote configuration
  • mcp-config-stdio.json - stdio configuration for localhost for MCP clients which do not support

Inspecting Biothings MCP server

If you want to inspect the methods provided by the MCP use npx (you may need to install nodejs and npm)

Test your MCP setup with the MCP Inspector.

If you want to inspect local streamable-http server you use:

npx @modelcontextprotocol/inspector --config mcp-config.json --server biothings-mcp

Add -remote suffix for the remote server.

If you want to inspect stdio local server you should use

npx @modelcontextprotocol/inspector --config mcp-config-stdio.json --server biothings-mcp

You can also run inspector manually and put server parameters in the interface:

npx @modelcontextprotocol/inspector

After that you can explore its methods with MCP Inspector at http://127.0.0.1:6274

Repository setup

# Clone the repository
git clone https://github.com/longevity-genie/biothings-mcp.git
cd biothings-mcp
uv sync

Running the MCP Server

If you already cloned the repo you can run the server with uv

# Start the MCP server in HTTP streamable mode (default port 3001)
uv run server run

# Run in STDIO mode
uv run stdio

# Run in SSE mode
uv run sse

# Run with custom port
uv run server run --port 8000

# Run with custom output directory
uv run server run --output-dir ./my_data

Integration with AI Systems

To integrate this server with your MCP-compatible AI client, you can use one of the preconfigured JSON files provided in this repository:

  • For connecting to a locally running server: Use mcp-config.json. Ensure the server is running first, either via uv run server (see Running the MCP Server) or docker-compose up (see Docker Deployment).
  • For connecting to the publicly hosted server: Use mcp-config-remote.json. This connects to https://biothings.longevity-genie.info/mcp and doesn't require you to run anything locally.

Simply point your AI client (like Cursor, Windserve, ClaudeDesktop, VS Code with Copilot, or others) to use the appropriate configuration file.

Here's an example of how the tools might appear in an MCP client like Cursor after configuration:

Cursor Usage Example

KNOWN ISSUES

The library is beta-quality. The major problem right now is that LLM-s are often stupid and do not know how to put valid gene and gene variant symbols. We plan to mitigrate it by extending comments and providing additional method for entity resolution.

Testing & Verification

Run tests for the API endpoint:

uv run pytest -vvv -s

You can use MCP inspector with locally build MCP server same way as with uvx

Note: Using the MCP Inspector is optional. Most MCP clients (like Cursor, Windsurv, etc.) will automatically display the available tools from this server once configured. However, the Inspector can be useful for detailed testing and exploration.

If you choose to use the Inspector via npx, ensure you have Node.js and npm installed. Using nvm (Node Version Manager) is recommended for managing Node.js versions.

This opens a web interface where you can explore and test all available tools.

Documentation

For detailed documentation about the MCP protocol and its implementation, refer to:

License

This project is licensed under the MIT License.

Acknowledgments

  • BioThings for the REST API and original client library

  • MCP Protocol for the protocol specification

  • Pydantic for the data validation framework

  • FastAPI-MCP for the MCP server implementation

  • This project is part of the Longevity Genie organization, which develops open-source AI assistants and libraries for health, genetics, and longevity research.

We are supported by:

HEALES

HEALES - Healthy Life Extension Society

and

IBIMA

IBIMA - Institute for Biostatistics and Informatics in Medicine and Ageing Research

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选