A Model Context Protocol (MCP) server for DROMA (Drug Response Omics association MAp) - enabling natural language interactions with drug-omics association analysis.
DROMA MCP Server bridges the gap between AI assistants and cancer pharmacogenomics analysis by providing a natural language interface to the DROMA.R and DROMA.Set packages.
It is a part of DROMA project. Visit the official DROMA website for comprehensive documentation and interactive examples.
- π Natural Language Interface: Ask questions about drug-omics associations in plain English
- π Dataset Management: Load and manage DROMA datasets (CCLE, gCSI, etc.) in memory
- π Data Loading & Normalization: Load molecular profiles and treatment response data with automatic z-score normalization
- ποΈ Multi-Project Support: Seamlessly work with data across multiple research projects
- πΎ Smart Caching: Efficient data caching with metadata tracking for faster access
- π€ Data Export: Export analysis results to various formats (CSV, Excel, JSON)
- β‘ Multi-Modal Support: Works with various transport protocols (STDIO, HTTP, SSE)
- π R Integration: Seamless integration with existing DROMA R packages via rpy2
- π Performance Optimizations: Memory management, asynchronous processing, and connection pooling
- π‘οΈ Robust Error Handling: Comprehensive validation, logging, and graceful error recovery
- ποΈ Class-Based CLI: Modern, type-safe command-line interface with comprehensive help
- Asynchronous Processing: Non-blocking I/O operations for better responsiveness
- Memory Management: Automatic memory monitoring and garbage collection
- Connection Pooling: Efficient R environment management
- Smart Caching: LRU cache with size limits and automatic eviction
- Batch Operations: Process multiple datasets efficiently
- Performance Monitoring: Built-in metrics tracking and reporting
- Python 3.10+
- R 4.0+ with DROMA.Set and DROMA.R packages
- DROMA SQLite database
pip install droma-mcp
git clone https://github.com/mugpeng/DROMA_MCP
cd DROMA_MCP
pip install -e .
Ensure you have the DROMA R packages installed:
# Install DROMA.Set and DROMA.R packages
# devtools::install_github("mugpeng/DROMA_Set")
# devtools::install_github("mugpeng/DROMA_R")
# Check dependencies and configuration
droma-mcp validate
# Test specific database connection
droma-mcp test --db-path path/to/droma.sqlite --r-libs path/to/R/libs
# Run performance benchmark
droma-mcp benchmark
# Benchmark specific module
droma-mcp benchmark --module data_loading --iterations 10
# STDIO mode (for AI assistants) - default
droma-mcp run --db-path path/to/droma.sqlite
# HTTP mode (for web applications)
droma-mcp run --transport streamable-http --port 8000 --db-path path/to/droma.sqlite
# With verbose logging and dependency validation
droma-mcp run --verbose --validate-deps --db-path path/to/droma.sqlite
Export a configuration file for your MCP client:
# Generate STDIO configuration
droma-mcp export-config -o droma-config.json
# Generate HTTP configuration
droma-mcp export-config -o droma-http-config.json --transport streamable-http --port 8000
Add to your MCP client configuration:
{
"mcpServers": {
"droma-mcp": {
"command": "droma-mcp",
"args": ["run", "--db-path", "path/to/droma.sqlite"]
}
}
}
The DROMA MCP CLI provides comprehensive commands for server management and testing:
Command | Description | Example |
---|---|---|
run |
Start the MCP server | droma-mcp run --db-path db.sqlite |
test |
Test configuration and dependencies | droma-mcp test --db-path db.sqlite |
validate |
Validate complete setup | droma-mcp validate |
benchmark |
Run performance benchmark | droma-mcp benchmark -n 10 |
export-config |
Export MCP client configuration | droma-mcp export-config -o config.json |
info |
Display server information | droma-mcp info |
--help
: Show help for any command--verbose
: Enable verbose logging--db-path
: Path to DROMA SQLite database--r-libs
: Path to R libraries
--transport
: Choose transport protocol (stdio
,streamable-http
,sse
)--host
: Host for HTTP transports (default:127.0.0.1
)--port
: Port for HTTP transports (default:8000
)--path
: Path for streamable HTTP (default:/mcp
)
--module
: Choose server module (all
,data_loading
,database_query
,dataset_management
)
# Get detailed help
droma-mcp --help
droma-mcp run --help
# Validate environment
droma-mcp validate
# Test with specific database
droma-mcp test --db-path /path/to/droma.db
# Start server with all modules
droma-mcp run --module all --db-path /path/to/droma.db
# Start HTTP server with data loading only
droma-mcp run --module data_loading --transport streamable-http --port 8080
# Export configuration for HTTP mode
droma-mcp export-config --transport streamable-http --port 8080 -o http-config.json
# Run performance benchmark
droma-mcp benchmark --iterations 5 --module data_loading
load_dataset
: Load DROMA datasets (CCLE, gCSI, etc.) into memory from databaselist_loaded_datasets
: Show which datasets are currently loaded in memoryset_active_dataset
: Set the active dataset for subsequent operationsunload_dataset
: Remove datasets from memory to free up resources
load_molecular_profiles_normalized
: Load molecular profiles (mRNA, CNV, methylation, etc.) with z-score normalizationload_treatment_response_normalized
: Load drug response data with normalizationload_multi_project_molecular_profiles_normalized
: Load data across multiple projectsload_multi_project_treatment_response_normalized
: Load treatment response across projectscheck_zscore_normalization
: Verify normalization status of cached dataget_cached_data_info
: Get information about cached datasetsexport_cached_data
: Export data to CSV/Excel/JSON formats
get_droma_annotation
: Retrieve sample or drug annotation data from the databaselist_droma_samples
: List all available samples for a project with filtering optionslist_droma_features
: List all available features (genes, drugs) for a project and data typelist_droma_projects
: List all projects available in the DROMA database
"Load the CCLE dataset from the database and set it as active"
"Show me which datasets are currently loaded in memory"
After loading datasets, you can perform data operations:
"Load mRNA expression data for ABCB1 gene from the CCLE dataset with z-score normalization"
"Get Paclitaxel drug response data across multiple projects, including only overlapping samples"
"List all projects available in the DROMA database"
"Show me all available samples for the gCSI project that have mRNA data"
"Get the first 100 genes available in the CCLE mRNA dataset"
"Retrieve sample annotations for breast cancer cell lines in the gCSI project"
-
First, load your dataset:
"Load the CCLE dataset into memory"
-
Then, load and analyze data:
"Load mRNA expression data for TP53 gene from CCLE with z-score normalization"
-
Check results:
"Show me information about cached datasets and export the mRNA data to CSV"
"Check if my cached molecular data has been z-score normalized and show me the statistics"
"Load multi-project treatment response data for Doxorubicin and verify the normalization status"
"Unload the gCSI dataset to free up memory"
The DROMA MCP server follows a streamlined modular architecture:
src/droma_mcp/
βββ __init__.py # Package initialization
βββ __main__.py # Entry point
βββ cli.py # Command-line interface
βββ util.py # Utility functions
βββ schema/ # Pydantic data models
β βββ __init__.py
β βββ data_loading.py # Data loading schemas
β βββ database_query.py # Database query schemas
β βββ dataset_management.py # Dataset management schemas
βββ server/ # MCP server modules
βββ __init__.py # Server setup & state
βββ dataset_management.py # Dataset loading/management
βββ data_loading.py # Data loading operations
βββ database_query.py # Database exploration operations
- Modular Design: Separate modules for dataset management, data loading, and database exploration
- State Management: Centralized data and R environment management with active dataset tracking
- Type Safety: Comprehensive Pydantic validation for all inputs
- R Integration: Seamless R-Python data exchange via rpy2
- Database Access: Direct SQLite database querying for exploration
- Caching System: Efficient data caching with metadata tracking
DROMA_DB_PATH
: Default path to DROMA SQLite databaseR_LIBS
: Path to R librariesDROMA_MCP_MODULE
: Server module to load (all
,data_loading
,database_query
,dataset_management
)DROMA_MCP_VERBOSE
: Enable verbose logging
droma-mcp run --help
# Validate complete setup
droma-mcp validate
# Test dependencies and database connection
droma-mcp test --db-path path/to/droma.db
# Run performance benchmark
droma-mcp benchmark --iterations 5
# Test CLI functionality
droma-mcp info
droma-mcp export-config -o test-config.json
# Test core imports
python -c "from src.droma_mcp.cli import cli; print('β CLI works')"
python -c "from src.droma_mcp.server import droma_mcp; print('β Server works')"
python -c "from src.droma_mcp.util import setup_server; print('β Utils work')"
black src/
isort src/
mypy src/
- Define Pydantic schemas in
schema/
- Implement server functions in
server/
- Register tools with FastMCP decorators
- Update CLI module loading logic
# Check if all dependencies are installed
droma-mcp validate
# Install missing dependencies
pip install -e .
# Test R environment
droma-mcp test --r-libs /path/to/R/libs
# Install R dependencies
R -e "install.packages('rpy2')"
# Test database connection
droma-mcp test --db-path /path/to/droma.db
# Check database file exists and is readable
ls -la /path/to/droma.db
# Run with verbose logging
droma-mcp run --verbose --validate-deps
# Test specific module
droma-mcp run --module data_loading --verbose
If experiencing issues, set these environment variables:
export DROMA_DB_PATH="/path/to/droma.sqlite"
export R_LIBS="/path/to/R/libraries"
export DROMA_MCP_VERBOSE="1"
# Run benchmark to identify bottlenecks
droma-mcp benchmark --iterations 10
# Monitor memory usage during operations
droma-mcp run --verbose
Contributions are welcome! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
This project is licensed under the MPL-2 License - see the LICENSE file for details.
- DROMA - Main DROMA project
- DROMA.Set - R package for data management
- DROMA.R - R package for analysis functions
- FastMCP - Python framework for MCP servers
- Model Context Protocol - Open standard for AI tool integration
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: Contact DROMA Team
If you use DROMA MCP in your research, please cite:
@software{droma_mcp2024,
title={DROMA MCP: Model Context Protocol Server for Drug-Omics Association Analysis},
author={DROMA Development Team},
year={2024},
url={https://github.com/mugpeng/DROMA_MCP}
}
DROMA MCP - Bridging AI and Cancer Pharmacogenomics π§¬ππ€