bioportal-mcp
A Model Context Protocol (MCP) server for interacting with the BioPortal API to search and retrieve ontology terms.
README
bioportal-mcp
A Model Context Protocol (MCP) server for interacting with the BioPortal API to search and retrieve ontology terms.
Features
- Search ontology terms: Search across BioPortal's extensive collection of biomedical ontologies
- Search ontology properties: Find object properties, annotation properties, and datatype properties
- Get ontology analytics: Access visitor statistics and usage analytics for ontologies
- Flexible filtering: Filter by specific ontologies (e.g., NCIT, GO, HP, MONDO)
- Exact matching: Option to require exact matches or allow fuzzy matching
- Rich results: Returns term IDs, preferred labels, ontology information, and ontology page URLs
Installation
You can install the package from source:
pip install -e .
Or using uv:
uv pip install -e .
Setup
Before using this MCP server, you need to obtain a BioPortal API key:
- Visit BioPortal
- Create an account or sign in
- Go to your account settings to get your API key
- Set the API key as an environment variable:
export BIOPORTAL_API_KEY="your_api_key_here"
Usage
As an MCP Server
Run the MCP server:
bioportal-mcp
Available Tools
search_ontology_terms
Search for ontology terms in BioPortal.
Parameters:
query(str): The search term (e.g., "melanoma", "breast cancer", "neuron")ontologies(str, optional): Comma-separated list of ontology acronyms (e.g., "NCIT,GO,HP")max_results(int, default=10): Maximum number of results to returnrequire_exact_match(bool, default=False): Whether to require exact matchesapi_key(str, optional): BioPortal API key (uses environment variable if not provided)
Returns: List of tuples containing:
- Term ID (e.g., "http://purl.obolibrary.org/obo/NCIT_C4872")
- Preferred label (e.g., "Breast Cancer")
- Ontology acronym (e.g., "NCIT")
- Ontology URL (e.g., "https://bioportal.bioontology.org/ontologies/NCIT")
Examples:
# Search for cancer terms
results = search_ontology_terms("cancer")
# Search for cell types in Cell Ontology
results = search_ontology_terms("neuron", ontologies="CL")
# Search for exact matches only
results = search_ontology_terms("melanoma", require_exact_match=True)
# Limit results
results = search_ontology_terms("disease", max_results=5)
search_ontology_properties
Search for ontology properties (object properties, annotation properties, datatype properties) by their labels and IDs.
Parameters:
query(str): The search term (e.g., "has part", "related to", "has dimension")ontologies(str, optional): Comma-separated list of ontology acronyms (e.g., "NCIT,GO,HP")max_results(int, default=10): Maximum number of results to returnrequire_exact_match(bool, default=False): Whether to require exact matches by property id, label, or generated labelrequire_definitions(bool, default=False): If True, only return properties that have definitionsproperty_types(str, optional): Comma-separated list of property types to filter by: "object", "annotation", "datatype"api_key(str, optional): BioPortal API key (uses environment variable if not provided)
Returns: List of tuples containing:
- Property ID (e.g., "http://www.w3.org/2000/01/rdf-schema#label")
- Property label (e.g., "label")
- Ontology acronym (e.g., "NCIT")
- Ontology URL (e.g., "https://bioportal.bioontology.org/ontologies/NCIT")
Examples:
# Search for properties containing "part"
results = search_ontology_properties("part")
# Search for object properties only
results = search_ontology_properties("related", property_types="object")
# Search for properties with definitions in specific ontologies
results = search_ontology_properties("has", ontologies="GO,CHEBI", require_definitions=True)
get_ontology_analytics
Get visitor analytics for BioPortal ontologies using Google Analytics data.
Parameters:
ontology_acronym(str, optional): Ontology acronym to get analytics for (e.g., "NCIT", "GO"). If None, returns analytics for all ontologiesmonth(int, optional): Month number (1-12) to filter analytics. Only valid when ontology_acronym is Noneyear(int, optional): Year to filter analytics (e.g., 2024). Only valid when ontology_acronym is Noneapi_key(str, optional): BioPortal API key (uses environment variable if not provided)
Returns: Dictionary containing visitor statistics:
- For all ontologies: dict with ontology acronyms as keys and visit counts
- For single ontology: detailed analytics with monthly/yearly breakdowns
Examples:
# Get analytics for all ontologies
analytics = get_ontology_analytics()
# Get analytics for a specific ontology
analytics = get_ontology_analytics(ontology_acronym="NCIT")
# Get analytics for all ontologies in April 2024
analytics = get_ontology_analytics(month=4, year=2024)
# Get analytics for all ontologies in 2024
analytics = get_ontology_analytics(year=2024)
Integration with AI Assistants
This MCP server can be integrated with AI assistants like Claude Desktop. Add the following to your MCP configuration:
{
"mcpServers": {
"bioportal": {
"command": "bioportal-mcp",
"env": {
"BIOPORTAL_API_KEY": "your_api_key_here"
}
}
}
}
A streamable version of this MCP is also available from the following URL:
https://bioportal.fastmcp.app/mcp
This means it may be used through any agentic framework supporting HTTP streaming of MCPs.
API Endpoints Supported
This MCP server provides access to the following BioPortal API endpoints:
- Search (
/search): Search for ontology terms/classes across all ontologies - Property Search (
/property_search): Search for ontology properties (object, annotation, datatype) - Analytics (
/analytics): Retrieve visitor statistics and usage analytics for ontologies
Supported Ontologies
BioPortal hosts hundreds of ontologies. Some popular ones include:
- NCIT: NCI Thesaurus - comprehensive cancer terminology
- GO: Gene Ontology - gene and protein functions
- HP: Human Phenotype Ontology - phenotypes and clinical features
- MONDO: Disease ontology
- CHEBI: Chemical entities
- UBERON: Anatomy ontology
- CL: Cell Ontology
- SO: Sequence Ontology
Development
Local Setup
# Clone the repository
git clone https://github.com/ncbo/bioportal-mcp.git
cd bioportal-mcp
# Install development dependencies
uv pip install -e ".[dev]"
License
BSD-3-Clause
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。