MCP for Guide to Pharmacology database
Project description
pharmacology-mcp
MCP (Model Context Protocol) server for the Guide to PHARMACOLOGY database, providing access to pharmacological data including targets, ligands, and interactions.
This server implements the Model Context Protocol (MCP) for the Guide to PHARMACOLOGY, providing a standardized interface for accessing pharmacological data. MCP enables AI assistants and agents to access specialized pharmacological knowledge through structured interfaces to authoritative data sources.
The Guide to PHARMACOLOGY is an expert-curated database of drug targets and their ligands, providing comprehensive information about:
- Targets: Pharmacological targets (receptors, enzymes, ion channels, etc.)
- Ligands: Chemical compounds and drugs
- Interactions: Target-ligand interactions with affinity data
- Diseases: Disease associations
- Families: Target family classifications
If you want to understand more about what the Model Context Protocol is and how to use it more efficiently, you can take the DeepLearning AI Course or search for MCP videos on YouTube.
About MCP (Model Context Protocol)
MCP is a protocol that bridges the gap between AI systems and specialized domain knowledge. It enables:
- Structured Access: Direct connection to authoritative pharmacological data sources
- Natural Language Queries: Simplified interaction with specialized databases
- Type Safety: Strong typing and validation through FastMCP
- AI Integration: Seamless integration with AI assistants and agents
Quick Start
Installing uv
# Download and install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Verify installation
uv --version
uvx --version
uvx is a very nice tool that can run a python package installing it if needed.
Running with uvx
You can run the pharmacology-mcp server directly using uvx without cloning the repository:
# Run the server in streamed http mode (default)
uvx pharmacology-mcp
Other uvx modes (STDIO, HTTP, SSE)
STDIO Mode (for MCP clients that require stdio, can be useful when you want to save files)
# Or explicitly specify stdio mode
uvx pharmacology-mcp stdio
HTTP Mode (Web Server)
# Run the server in streamable HTTP mode on default (3001) port
uvx pharmacology-mcp server
# Run on a specific port
uvx pharmacology-mcp server --port 8000
SSE Mode (Server-Sent Events)
# Run the server in SSE mode
uvx pharmacology-mcp sse
In cases when there are problems with uvx often they can be caused by cleaning uv cache:
uv cache clean
The HTTP mode will start a web server that you can access at http://localhost:3001/mcp (with documentation at http://localhost:3001/docs). The STDIO mode is designed for MCP clients that communicate via standard input/output, while SSE mode uses Server-Sent Events for real-time communication.
API Endpoints
The server provides REST API endpoints for:
- Targets: Pharmacological targets (receptors, enzymes, ion channels, etc.)
- Ligands: Chemical compounds and drugs
- Interactions: Target-ligand interactions with affinity data
- Diseases: Disease associations
- Families: Target family classifications
Example API Usage
import httpx
# Search for GPCR targets
async with httpx.AsyncClient() as client:
response = await client.post(
"http://localhost:8000/targets",
json={"type": "GPCR", "immuno": True}
)
targets = response.json()
# Get specific target information
async with httpx.AsyncClient() as client:
response = await client.get("http://localhost:8000/targets/1")
target = response.json()
# Search for approved drugs
async with httpx.AsyncClient() as client:
response = await client.post(
"http://localhost:8000/ligands",
json={"approved": True, "type": "Synthetic organic"}
)
ligands = response.json()
Usage Example
Local File Tools
The server also provides MCP tools for saving search results to files:
search_targets_to_file: Search targets and save resultssearch_ligands_to_file: Search ligands and save resultsget_target_interactions_to_file: Get target interactions and saveget_ligand_interactions_to_file: Get ligand interactions and save
Configuring your AI Client (Anthropic Claude Desktop, Cursor, Windsurf, etc.)
We provide preconfigured JSON files for different use cases:
- For STDIO mode (recommended): Use
mcp-config-stdio.json - For HTTP mode: Use
mcp-config.json - For local development: Use
mcp-config-stdio-debug.json
Inspecting Pharmacology MCP server
Using MCP Inspector to explore server capabilities
If you want to inspect the methods provided by the MCP server, use npx (you may need to install nodejs and npm):
For STDIO mode with uvx:
npx @modelcontextprotocol/inspector --config mcp-config-stdio.json --server pharmacology-mcp
For HTTP mode (ensure server is running first):
npx @modelcontextprotocol/inspector --config mcp-config.json --server pharmacology-mcp
For local development:
npx @modelcontextprotocol/inspector --config mcp-config-stdio-debug.json --server pharmacology-mcp
You can also run the inspector manually and configure it through the interface:
npx @modelcontextprotocol/inspector
After that you can explore the tools and resources with MCP Inspector at http://127.0.0.1:6274
Integration with AI Systems
Simply point your AI client (like Cursor, Windsurf, ClaudeDesktop, VS Code with Copilot, or others) to use the appropriate configuration file from the repository.
Repository setup
# Clone the repository
git clone https://github.com/antonkulaga/pharmacology-mcp.git
cd pharmacology-mcp
uv sync
Running the MCP Server
If you already cloned the repo you can run the server with uv:
# Start the MCP server locally (HTTP mode)
uv run server
# Or start in STDIO mode
uv run stdio
# Or start in SSE mode
uv run sse
Testing & Verification
Run tests for the MCP server:
uv run pytest -vvv -s
You can use MCP inspector with locally built MCP server same way as with uvx.
Troubleshooting
Timeout Issues
If you encounter timeout errors when using tools with approved=True parameter (which can be slow due to large datasets), the server is configured with 30-second timeouts. You can:
- Use more specific filters to reduce response size
- Check your internet connection for stability
- Run tests individually if the full test suite times out:
pytest tests/test_judged_simple.py::TestPharmacologyMCPJudged::test_search_dopamine_targets_judged -v
Cache Issues with uvx
If you encounter problems with uvx, try cleaning the uv cache:
uv cache clean
Note: Using the MCP Inspector is optional. Most MCP clients (like Cursor, Windsurf, etc.) will automatically display the available tools from this server once configured. However, the Inspector can be useful for detailed testing and exploration.
If you choose to use the Inspector via npx, ensure you have Node.js and npm installed. Using nvm (Node Version Manager) is recommended for managing Node.js versions.
API Documentation
When the server is running, you can access:
- Interactive API docs: http://localhost:8000/docs
- ReDoc documentation: http://localhost:8000/redoc
- OpenAPI schema: http://localhost:8000/openapi.json
Data Source
This server provides access to data from the Guide to PHARMACOLOGY, an expert-curated database of drug targets and their ligands.
License
This project is licensed under the MIT License.
- Database: Open Data Commons Open Database License (ODbL)
- Contents: Creative Commons Attribution-ShareAlike 4.0 International License
Citations
If you use this server in your research, please cite:
Armstrong JF, Faccenda E, Harding SD, Pawson AJ, Southan C, Sharman JL, Campo B, Cavanagh DR, Alexander SPH, Davenport AP, Spedding M, Davies JA; NC-IUPHAR. (2020) The IUPHAR/BPS Guide to PHARMACOLOGY in 2020: extending immunopharmacology content and introducing the IUPHAR/MMV Guide to MALARIA PHARMACOLOGY. Nucleic Acids Research 48: D1006-D1021.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- Guide to PHARMACOLOGY for the comprehensive pharmacological data
- Model Context Protocol for the protocol specification
- FastMCP for the MCP server framework
This project is part of the Longevity Genie organization, which develops open-source AI assistants and libraries for health, genetics, and longevity research.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pharmacology_mcp-0.1.3.tar.gz.
File metadata
- Download URL: pharmacology_mcp-0.1.3.tar.gz
- Upload date:
- Size: 174.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d75c94cbbef86bf1008d93e8a5eb50fb7c341a04b8b54098d72e138c2ef686e
|
|
| MD5 |
71be8e3e0d0912a86709f3633eff7986
|
|
| BLAKE2b-256 |
86b27ebcab6c08cefe40176991e97f1d90342e912ff870fbfa164877c48ecddb
|
File details
Details for the file pharmacology_mcp-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pharmacology_mcp-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bae4ad6965a00f5f450b7580a8d07a5ee63df20e4aa7eb2ca89212da08d27fd1
|
|
| MD5 |
3424bf5169e8ddddf3ea90aba4e118dc
|
|
| BLAKE2b-256 |
0d609389f328257369e34e35967b5a7bdfc095ba035b6165d9ebad5853495ec5
|