GenePattern MCP Server

GenePattern MCP Server

Bridge any AI coding assistant directly to GenePattern — run bioinformatics modules, manage cloud jobs, and stream results, all through natural language.

Category
访问服务器

README

<h1 align="center">GenePattern MCP Server</h1>

<div align="center"> <em>Bridge any AI coding assistant directly to GenePattern — run bioinformatics modules, manage cloud jobs, and stream results, all through natural language.</em>

Python License: BSD-3 Powered by GenePattern

</div>


Why GenePattern MCP?

Modern AI assistants are extraordinarily good at reasoning — but they can't run a gene expression pipeline or execute bioinformatics on their own. We built GenePattern MCP to close that gap.

By implementing the Model Context Protocol (MCP), this server exposes the full GenePattern REST API as a set of structured, type-safe tools that any MCP-compatible AI client (Claude, Cursor, GitHub Copilot, and more) can call directly. The result: your AI assistant can now:

  • 🧬 Search, inspect, and execute hundreds of peer-reviewed genomic analysis modules
  • 🤖 Chain bioinformatic tasks into multi-step AI-driven workflows — no manual API calls required
  • ☁️ Scale effortlessly on GenePattern's cloud infrastructure at cloud.genepattern.org
  • 📊 Guarantee reproducibility — every job is tracked by LSID and stored with full provenance

From raw expression data to publication-ready insights — powered by a conversation.


Feature Highlights

Feature Description
🧬 Genomic Integration Access 200+ curated modules: differential expression, pathway analysis, single-cell, proteomics, and more
🤖 AI/ML Workflows Let your LLM orchestrate multi-step pipelines end-to-end via natural language prompts
☁️ Cloud Scalability Jobs run on GenePattern's managed cloud — no local compute needed
📊 Reproducible Science Every module is versioned by LSID; every job is logged and retrievable
🔌 Multi-Transport stdio for local clients, streamable-http / SSE for remote or containerized deployments
🔐 Flexible Auth Pluggable AuthHandler system — env-var token, HTTP Bearer header, or bring your own
🐳 Docker-Ready Official image at genepattern/mcp; zero-config cloud deployment

Prerequisites

  • Python 3.11+
  • A GenePattern API token (see Get a Token below)
  • pip or uv

Installation

With pip:

pip install -r requirements.txt

With uv:

uv venv && source .venv/bin/activate
uv pip install -r requirements.txt

Get a GenePattern Token

You need a Bearer token to authenticate with GenePattern.

Option A — You already have a token:

export GENEPATTERN_KEY="YOUR_TOKEN"

Option B — Generate one with the included helper:

python get-token.py -s https://cloud.genepattern.org/gp \
                    -u YOUR_USERNAME \
                    -p YOUR_PASSWORD
# Follow the printed instructions to export GENEPATTERN_KEY

Quick Start

1. Start the server (local stdio — recommended for AI clients)

export GENEPATTERN_KEY="YOUR_TOKEN"
python server.py --transport stdio

2. Run a bioinformatic analysis via your AI assistant

Once connected, ask your AI assistant something like:

"Run PreprocessDataset on all_aml_test.gct, threshold at 20/1500, and download the result."

The MCP server will:

  1. Look up the PreprocessDataset module LSID automatically
  2. Submit the job to GenePattern cloud
  3. Poll for completion and return the output file paths

3. Explore available tools interactively

mcp dev server.py

Running the Server

The server supports three transport modes via FastMCP.

Mode Command
stdio (local AI clients) python server.py --transport stdio
HTTP (remote / Docker) python server.py --transport streamable-http --host 0.0.0.0 --port 3000
SSE python server.py --transport sse --host 0.0.0.0 --port 3000

Testing with GenePattern Copilot:

python server.py --transport streamable-http --host 0.0.0.0 --port 3000 \
    --auth-handler genepattern_mcp._shared.HeaderAuthHandler

Docker

Pull and run the official image in seconds:

docker pull genepattern/mcp

Run in HTTP mode:

docker run --rm \
  -e GENEPATTERN_URL=https://cloud.genepattern.org/gp \
  -e GENEPATTERN_KEY=YOUR_TOKEN \
  -e FASTMCP_TRANSPORT=streamable-http \
  -e FASTMCP_HOST=0.0.0.0 \
  -e FASTMCP_PORT=3000 \
  -p 3000:3000 \
  genepattern/mcp

Using Authorization header instead of an env token (stateless, multi-user HTTP):

docker run --rm -p 3000:3000 \
  -e AUTH_HANDLER=genepattern_mcp._shared.HeaderAuthHandler \
  -e FASTMCP_TRANSPORT=streamable-http \
  genepattern/mcp
# Clients send: Authorization: Bearer YOUR_TOKEN

Note: stdio transport is impractical inside Docker containers. Use streamable-http when containerized.


Connect from MCP-Enabled Clients

Claude Code (VS Code)

Local stdio (recommended):

{
  "mcpServers": {
    "genepattern": {
      "command": "python",
      "args": ["server.py", "--transport", "stdio"],
      "env": {
        "GENEPATTERN_URL": "https://cloud.genepattern.org/gp",
        "GENEPATTERN_KEY": "${env:GENEPATTERN_KEY}"
      }
    }
  }
}

Remote HTTP server:

{
  "mcpServers": {
    "genepattern": {
      "type": "streamable-http",
      "url": "http://localhost:3000/mcp",
      "env": {
        "GENEPATTERN_URL": "https://cloud.genepattern.org/gp",
        "GENEPATTERN_KEY": "<GP API TOKEN>"
      }
    }
  }
}

Cursor

Add via Cursor Settings → MCP Servers:

{
  "mcpServers": {
    "genepattern": {
      "command": "python",
      "args": ["server.py", "--transport", "stdio"],
      "environment": {
        "GENEPATTERN_URL": "https://cloud.genepattern.org/gp",
        "GENEPATTERN_KEY": "YOUR_TOKEN"
      }
    }
  }
}

Other MCP Clients

  • stdio: invoke server.py --transport stdio
  • HTTP/SSE: connect to http://HOST:PORT using the appropriate transport
  • Multi-user HTTP: set AUTH_HANDLER=genepattern_mcp._shared.HeaderAuthHandler and pass Authorization: Bearer <token> per request

Configuration Reference

All CLI flags have a corresponding environment variable. Environment variables are applied before CLI arguments.

Flag Env Variable Default Description
--genepattern, -g GENEPATTERN_URL https://cloud.genepattern.org/gp GenePattern server URL (include /gp)
--key, -k GENEPATTERN_KEY None Your GenePattern API Bearer token
--auth-handler, -a AUTH_HANDLER EnvAuthHandler Full Python path to an AuthHandler class (see below)
--transport, -t FASTMCP_TRANSPORT streamable-http Transport protocol: streamable-http, stdio, or sse
--port, -p FASTMCP_PORT 3000 Port to listen on (HTTP/SSE only)
--host, -H FASTMCP_HOST 0.0.0.0 Host interface to bind (HTTP/SSE only)
--local-files, -l LOCAL_FILES_ENABLED True Enable local file upload/download tools

Auth Handlers

Class Behavior
genepattern_mcp._shared.EnvAuthHandler (default) Reads GENEPATTERN_KEY from environment
genepattern_mcp._shared.HeaderAuthHandler Reads Authorization: Bearer <token> from each HTTP request
custom Subclass AuthHandler and implement get_api_key(context)

Local File Tools

When --local-files is False, the following tools are disabled:

  • upload_whole_file
  • download_job_results
  • upload_file
  • upload_job_input_from_body
  • upload_job_input_from_form
  • upload_job_output

Security Notes

  • Treat GENEPATTERN_KEY like a password — prefer environment variables over hardcoding tokens.
  • When exposing the HTTP server to a network, put it behind a reverse proxy with TLS (e.g., nginx + Let's Encrypt).
  • For multi-user deployments, use HeaderAuthHandler so each user supplies their own token per request.

Contributing & Community

We believe the best bioinformatics tools are built by the community, for the community. All skill levels welcome — whether you're a genomics researcher, an ML engineer, or just someone who wants to ask an AI to run a pathway analysis.

Ways to get involved:

  • 🐛 Found a bug? Open an issue — we triage actively.
  • 💡 Have a feature idea? Start a Discussion — we love hearing about new use cases.
  • 🔧 Want to contribute code? Fork the repo, make your changes, and open a PR. Please include tests.
  • 💬 Need help? Reach out on the GenePattern Community Forum or tag us in an issue.
# Get started with development
git clone https://github.com/genepattern/genepattern-mcp.git
cd genepattern-mcp
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt
mcp dev server.py   # Explore all tools interactively

Citing This Work

If GenePattern MCP accelerates your research, please cite the underlying GenePattern platform:

Reich M, Liefeld T, Gould J, Lerner J, Tamayo P, Mesirov JP. GenePattern 2.0 Nature Genetics 38 no. 5 (2006): pp500-501 Google Scholar


License

Distributed under the BSD 3-Clause License. See LICENSE for details.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选