Biomart MCP
A Model Context Protocol server that interfaces with Biomart databases, allowing models to discover biological datasets, explore attributes/filters, retrieve biological data, and translate between different biological identifiers.
jzinno
Tools
list_marts
Lists all available Biomart marts (databases) from Ensembl. Biomart organizes biological data in a hierarchy: MART -> DATASET -> ATTRIBUTES/FILTERS. This function returns all available marts as a CSV string. Returns: str: CSV-formatted table of all marts with their display names and descriptions. Example: list_marts() >>> "name,display_name,description ENSEMBL_MART_ENSEMBL,Ensembl Genes,Gene annotation from Ensembl ENSEMBL_MART_MOUSE,Mouse strains,Strain-specific data for mouse ..."
list_datasets
Lists all available biomart datasets for a given mart. Each mart contains multiple datasets. This function returns all datasets available in the specified mart as a CSV string. Args: mart (str): The mart identifier to list datasets from. Valid values include: ENSEMBL_MART_ENSEMBL, ENSEMBL_MART_MOUSE, ENSEMBL_MART_ONTOLOGY, ENSEMBL_MART_GENOMIC, ENSEMBL_MART_SNP, ENSEMBL_MART_FUNCGEN Returns: str: CSV-formatted table of all datasets with their display names and descriptions. Example: list_datasets("ENSEMBL_MART_ENSEMBL") >>> "name,display_name,description hsapiens_gene_ensembl,Human genes,Human genes (GRCh38.p13) mmusculus_gene_ensembl,Mouse genes,Mouse genes (GRCm39) ..."
list_common_attributes
Lists commonly used attributes available for a given dataset. This function returns only the most frequently used attributes (defined in COMMON_ATTRIBUTES) to avoid overwhelming the model with too many options. For a complete list, use list_all_attributes. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") Returns: str: CSV-formatted table of common attributes with their display names and descriptions. Example: list_common_attributes("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl") >>> "name,display_name,description ensembl_gene_id,Gene stable ID,Ensembl stable ID for the gene external_gene_name,Gene name,The gene name ..."
list_all_attributes
Lists all available attributes for a given dataset with some filtering. This function returns a filtered list of all attributes available for the specified dataset. Some less commonly used attributes (homologs, microarray probes) are filtered out to reduce the response size. CAUTION: This function can return a large number of attributes and may be unstable for certain datasets. Consider using list_common_attributes first. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") Returns: str: CSV-formatted table of all filtered attributes. Example: list_all_attributes("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl")
list_filters
Lists all available filters for a given dataset. Filters are used to narrow down the results of a Biomart query. This function returns all filters that can be applied to the specified dataset. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") Returns: str: CSV-formatted table of all filters with their display names and descriptions. Example: list_filters("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl") >>> "name,description chromosome_name,Chromosome/scaffold name start,Gene start (bp) end,Gene end (bp) ..."
get_data
Queries Biomart for data using specified attributes and filters. This function performs the main data retrieval from Biomart, allowing you to query biological data by specifying which attributes to return and which filters to apply. Includes automatic retry logic for resilience. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") attributes (list[str]): List of attributes to retrieve (e.g., ["ensembl_gene_id", "external_gene_name"]) filters (dict[str, str]): Dictionary of filters to apply (e.g., {"chromosome_name": "1"}) Returns: str: CSV-formatted results of the query. Example: get_data( "ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl", ["ensembl_gene_id", "external_gene_name", "chromosome_name"], {"chromosome_name": "X", "biotype": "protein_coding"} ) >>> "ensembl_gene_id,external_gene_name,chromosome_name ENSG00000000003,TSPAN6,X ENSG00000000005,TNMD,X ..."
get_translation
Translates a single identifier from one attribute type to another. This function allows conversion between different identifier types, such as converting a gene symbol to an Ensembl ID. Results are cached to improve performance. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") from_attr (str): The source attribute name (e.g., "hgnc_symbol") to_attr (str): The target attribute name (e.g., "ensembl_gene_id") target (str): The identifier value to translate (e.g., "TP53") Returns: str: The translated identifier, or an error message if not found. Example: get_translation("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl", "hgnc_symbol", "ensembl_gene_id", "TP53") >>> "ENSG00000141510"
batch_translate
Translates multiple identifiers in a single batch operation. This function is more efficient than multiple calls to get_translation when you need to translate many identifiers at once. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") from_attr (str): The source attribute name (e.g., "hgnc_symbol") to_attr (str): The target attribute name (e.g., "ensembl_gene_id") targets (list[str]): List of identifier values to translate (e.g., ["TP53", "BRCA1", "BRCA2"]) Returns: dict: A dictionary containing: - translations: Dictionary mapping input IDs to translated IDs - not_found: List of IDs that could not be translated - found_count: Number of successfully translated IDs - not_found_count: Number of IDs that could not be translated Example: batch_translate("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl", "hgnc_symbol", "ensembl_gene_id", ["TP53", "BRCA1", "BRCA2"]) >>> {"translations": {"TP53": "ENSG00000141510", "BRCA1": "ENSG00000012048"}, "not_found": ["BRCA2"], "found_count": 2, "not_found_count": 1}
README
Biomart MCP
A MCP server to interface with Biomart
Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs developed by Anthropic. Here we use the MCP python-sdk to create a MCP server that interfaces with Biomart via the pybiomart package.
There is a short demo video showing the MCP server in action on Claude Desktop.
Installation
Clone the repository
git clone https://github.com/jzinno/biomart-mcp.git
cd biomart-mcp
Claude Desktop
uv run --with mcp[cli] mcp install --with pybiomart biomart-mcp.py
Cursor
Via Cusror's agent mode, other models can take advantage of MCP servers as well, such as those form OpenAI or DeepSeek. Click the cursor setting cogwheel and naviagate to Features
-> MCP Servers
-> Add new MCP Server
. Set the name to biomart
(or whatever you like) and Type
to command
.
Set the command to:
uv run --with mcp[cli] --with pybiomart mcp run /your/path/to/biomart-mcp.py
Glama
<a href="https://glama.ai/mcp/servers/v5a3mlxviu"> <img width="380" height="200" src="https://glama.ai/mcp/servers/v5a3mlxviu/badge" alt="Biomart MCP server" /> </a>
Development
# Create a virtual environment
uv venv
# MacOS/Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
uv sync #or uv add mcp[cli] pybiomart
# Run the server in dev mode
mcp dev biomart-mcp.py
Features
Biomart-MCP provides several tools to interact with Biomart databases:
- Mart and Dataset Discovery: List available marts and datasets to explore the Biomart database structure
- Attribute and Filter Exploration: View common or all available attributes and filters for specific datasets
- Data Retrieval: Query Biomart with specific attributes and filters to get biological data
- ID Translation: Convert between different biological identifiers (e.g., gene symbols to Ensembl IDs)
Contributing
Pull requests are welcome! Some small notes on development:
- We are only using
@mcp.tool()
here by design, this is to maximize compatibility with clients that support MCP as seen in the docs. - We are using
@lru_cache
to cache results of functions that are computationally expensive or make external API calls. - We need to be mindful to not blow up the context window of the model, for example you'll see
df.to_csv(index=False).replace("\r", "")
in many places. This csv style return is much more token efficient than something likedf.to_string()
where the majority of the tokens are whitespace. Also be mindful of the fact that pulling all genes from a chromosome or similar large request will also be too large for the context window.
Potential Future Features
There of course many more features that could be added, some maybe beyond the scope of the name biomart-mcp
. Here are some ideas:
- Add webscraping for resource sites with
bs4
, for example we got the Ensembl gene ID for NOTCH1 then maybe in some cases it would be usful to grap the collatedComments and Description Text from UniProtKB
section from it's page on UCSC - $...$
Recommended Servers
DuckDuckGo MCP Server
A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.
YouTube Transcript MCP Server
This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Supabase MCP Server
A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface.
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
MCP DuckDB Knowledge Graph Memory Server
A memory server for Claude that stores and retrieves knowledge graph data in DuckDB, enhancing performance and query capabilities for conversations with persistent user information.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
Tavily MCP Server
Provides AI-powered web search capabilities using Tavily's search API, enabling LLMs to perform sophisticated web searches, get direct answers to questions, and search recent news articles.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.
Metabase MCP Server
Enables AI assistants to interact with Metabase databases and dashboards, allowing users to list and execute queries, access data visualizations, and interact with database resources through natural language.