OLS MCP Server
Large Language Models are notoriously bad at working with ontologies, often hallucinating terms or their identifiers. This server provides a reliable way to access and query ontologies, ensuring accurate and up-to-date information.
This repository contains a Model Context Protocol (MCP) server providing access to the Ontology Lookup Service (OLS) API. This server enables AI assistants to search for and retrieve ontological terms, concepts, and hierarchies from various biological and medical ontologies.
This server is designed to work seamlessly with AI assistants like Claude Desktop, allowing users to query ontologies using natural language. It supports a wide range of ontologies, including Gene Ontology (GO), Human Phenotype Ontology (HP), and many others.
Without (top part of image below) and with mcp server engaged (bottom of figure below):
Features
The OLS MCP Server provides the following tools:
- 🔍 Search Terms: Search for terms across ontologies with flexible filtering
- 📚 Search Ontologies: Discover available ontologies and their metadata
- ℹ️ Get Ontology Information: Retrieve detailed information about specific ontologies
- 🎯 Get Term Information: Get comprehensive details about specific terms
- 🌳 Get Term Children: Find direct child terms in ontological hierarchies
- 👨👩👧👦 Get Term Ancestors: Retrieve parent terms and ancestors
- 🤖 Find Similar Terms: Discover semantically similar terms using LLM embeddings
Supported Ontologies
The server works with any ontology available through the EBI Ontology Lookup Service, including:
- GO (Gene Ontology)
- EFO (Experimental Factor Ontology)
- HP (Human Phenotype Ontology)
- MONDO (Monarch Disease Ontology)
- ChEBI (Chemical Entities of Biological Interest)
- UBERON (Uber-anatomy ontology)
- And many more...
Installation
Prerequisites
- Python 3.12 or higher
- uv package manager
Install uv (if not already installed)
Install the OLS MCP Server
Configuration
Claude Desktop Configuration
To use this server with Claude Desktop, add the following configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Alternative Configuration (if installed as tool)
If you installed the server as a uv tool, you can use this simpler configuration:
Usage Examples
Once configured with Claude Desktop, you can use natural language to interact with the OLS API:
Searching for Terms
"Search for terms related to diabetes in the Human Phenotype Ontology"
"Find all terms containing 'apoptosis' in the Gene Ontology"
Getting Ontology Information
"Tell me about the Gene Ontology"
"What ontologies are available for chemical compounds?"
Exploring Term Hierarchies
"Show me the children of the term 'metabolic process' in GO"
"What are the ancestor terms for HP:0000118?"
Finding Similar Terms
"Find terms similar to 'heart development' in the Gene Ontology"
Development Setup
Setting up the Development Environment
- Clone the repository:
- Install dependencies:
- Activate the virtual environment:
Code Quality
Adding New Features
- Add new tools in
src/ols_mcp_server/server.py
using the@mcp.tool()
decorator - Create models in
src/ols_mcp_server/models.py
for structured responses - Update tests to cover new functionality
- Update documentation as needed
API Documentation
The server interacts with the EBI Ontology Lookup Service API v2. Key endpoints:
- Search:
https://www.ebi.ac.uk/ols4/api/search
- Ontologies:
https://www.ebi.ac.uk/ols4/api/v2/ontologies
- Terms:
https://www.ebi.ac.uk/ols4/api/terms
- Hierarchies:
https://www.ebi.ac.uk/ols4/api/v2/ontologies/{ontology}/classes/{term}/children
Troubleshooting
Common Issues
- Server not found: Ensure the path to the server is correct in your Claude config
- Permission errors: Make sure the server script is executable
- Network errors: Check your internet connection and firewall settings
- Python version: Ensure you're using Python 3.12 or higher
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make your changes
- Run tests:
uv run pytest
- Format code:
uv run ruff format
- Submit a pull request ]
Acknowledgments
- EBI Ontology Lookup Service for providing the API
- FastMCP for the MCP framework
- The ontology communities for maintaining these valuable resources
This server cannot be installed
Provides reliable access to the Ontology Lookup Service (OLS) API, enabling AI assistants to accurately search and retrieve terms from biological and medical ontologies.
Related MCP Servers
- -securityAlicense-qualitySemantic Scholar API, providing comprehensive access to academic paper data, author information, and citation networks.Last updated -55PythonMIT License
- -securityAlicense-qualityProvides a semantic memory layer that integrates LLMs with OpenSearch, enabling storage and retrieval of memories within the OpenSearch engine.Last updated -4PythonApache 2.0
- AsecurityAlicenseAqualityEnables searching for drugs and exploring ontology terms in the Cortellis database, providing access to comprehensive drug development status information with structured JSON responses.Last updated -71231JavaScriptMIT License
- -securityFlicense-qualityProvides tools for accessing the Semantic Scholar API to search papers, retrieve paper and author details, and fetch citations and references through the Model Context Protocol.Last updated -21Python