A Model Context Protocol (MCP) server for retrieving information from the Ontology Lookup Service (OLS).
This package provides tools for searching ontologies, retrieving ontology details, and accessing ontology terms through a standardized MCP interface.
pip install ols-mcp# Clone the repository
git clone https://github.com/contextualizer-ai/ols-mcp.git
cd ols-mcp
# Install with uv (recommended)
uv sync --group dev
# Or with pip
pip install -e .The primary use case is as an MCP server that provides ontology search capabilities to AI agents and applications.
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"ols-mcp": {
"command": "ols-mcp",
"args": []
}
}
}claude mcp add ols-mcpgoose session start --with-mcp "ols-mcp"The MCP server provides three main tools:
search_all_ontologies- Search across all ontologies in OLSget_ontology_info- Get detailed information about a specific ontologyget_terms_from_ontology- Retrieve terms from a specific ontology
from ols_mcp.tools import search_all_ontologies, get_ontology_info, get_terms_from_ontology
# Search for biological terms
results = search_all_ontologies("apoptosis", max_results=5)
# Get information about Gene Ontology
go_info = get_ontology_info("go")
# Get terms from a specific ontology
terms = get_terms_from_ontology("go", max_results=10)Run the MCP server directly:
ols-mcpYou can test the tools directly using Python:
# Search for biological terms across all ontologies
uv run python -c "from ols_mcp.tools import search_all_ontologies; print(search_all_ontologies('apoptosis', max_results=3))"
# Get information about Gene Ontology
uv run python -c "from ols_mcp.tools import get_ontology_info; print(get_ontology_info('go'))"
# Get terms from a specific ontology
uv run python -c "from ols_mcp.tools import get_terms_from_ontology; print(get_terms_from_ontology('go', max_results=3))"Test the MCP protocol directly:
# Test basic protocol handshake
make test-mcp
# Test extended protocol with tool calls
make test-mcp-extended- Python 3.11+
- uv (recommended) or pip
# Clone the repository
git clone https://github.com/contextualizer-ai/ols-mcp.git
cd ols-mcp
# Install development dependencies
uv sync --group devmake dev- Install development dependenciesmake install- Install production dependencies onlymake clean- Clean build artifacts
make test-unit- Run unit tests (fast, mocked)make test-real-api- Run integration tests against live OLS APImake test-mcp- Test MCP protocol functionality
make format- Format code with Blackmake lint- Run Ruff linter with fixesmake mypy- Run type checkingmake deptry- Check for unused dependenciesmake test-coverage- Run all tests with coverage reportmake test-integration- Run integration tests
make build- Build package distributionsmake upload-test- Upload to TestPyPImake upload- Upload to PyPImake release- Complete release workflow (test → build → upload)
make server- Run the MCP server locallymake all- Run complete CI pipeline
# Run all tests
make test-coverage
# Run only unit tests (fast)
make test-unit
# Run integration tests against real OLS API
make test-real-api
# Run with specific pytest options
uv run pytest tests/ -v -k "test_search"The project uses modern Python tooling:
- uv - Fast Python package manager
- ruff - Fast Python linter and formatter
- black - Code formatting (alternative to ruff format)
- mypy - Static type checking
- pytest - Testing framework with coverage reporting
- Fork the repository
- Create a feature branch
- Make your changes
- Run the test suite:
make all - Submit a pull request
Releases are automated via GitHub Actions:
-
Create and push a version tag:
git tag v0.1.4 git push origin v0.1.4
-
GitHub Actions will automatically:
- Run the full test suite
- Build the package
- Publish to PyPI
ols-mcp/
├── src/ols_mcp/
│ ├── __init__.py
│ ├── main.py # FastMCP server setup
│ ├── api.py # OLS API wrapper functions
│ └── tools.py # MCP tools that wrap API functions
├── tests/
│ ├── test_api.py # Unit tests for API functions
│ ├── test_tools.py # Unit tests for MCP tools
│ └── test_integration.py # Integration tests with real OLS API
├── .github/workflows/ # CI/CD pipelines
├── Makefile # Development automation
└── pyproject.toml # Project configuration
api.py- Low-level functions that interact with OLS REST APItools.py- Higher-level MCP tools that provide simplified interfacesmain.py- FastMCP server that exposes tools via MCP protocol
MIT