Using AlphaGenome with Docker¶
This guide explains how to use AlphaGenome with BioMCP in Docker containers.
Docker Setup¶
The BioMCP Docker image now includes AlphaGenome pre-installed. Here's how to use it:
1. Build the Docker Image¶
2. Run with Docker Compose¶
Create or update your docker-compose.yml
:
services:
biomcp-server:
build: .
image: biomcp-alphagenome:latest
container_name: biomcp-server
ports:
- "8000:8000"
environment:
- MCP_MODE=worker # Can be 'stdio' or 'worker'
- ALPHAGENOME_API_KEY=${ALPHAGENOME_API_KEY}
restart: unless-stopped
3. Set Your API Key¶
Create a .env
file in the same directory as your docker-compose.yml
:
Or set it in your shell:
4. Start the Container¶
Usage in Container¶
Via Docker Exec¶
You can run AlphaGenome predictions directly in the container:
# Basic prediction
docker exec biomcp-server biomcp variant predict chr7 140753336 A T
# With tissue specificity
docker exec biomcp-server biomcp variant predict chr7 140753336 A T --tissue UBERON:0000310
Via MCP Worker Mode¶
When running in worker mode, the container exposes port 8000 for MCP connections. Configure your MCP client to connect to:
Dockerfile Details¶
The Dockerfile includes these AlphaGenome-specific changes:
- Git Installation: Required to clone AlphaGenome repository
- AlphaGenome Installation: Cloned and installed during build
RUN git clone https://github.com/google-deepmind/alphagenome.git /tmp/alphagenome && \
pip install /tmp/alphagenome && \
rm -rf /tmp/alphagenome
- Environment Variable: API key passed through docker-compose
Troubleshooting¶
Container Can't Find API Key¶
Check that the environment variable is set:
AlphaGenome Import Errors¶
Verify AlphaGenome is installed in the container:
Rebuilding After Changes¶
If you update the Dockerfile or dependencies:
Security Considerations¶
- API Key Security: Never commit your API key to version control
- Use .env Files: Keep API keys in
.env
files (add to.gitignore
) - Network Security: In production, use proper network isolation
- Volume Mounts: Be careful with volume mounts that might expose sensitive data
Example Docker Run Command¶
For standalone container without docker-compose:
docker run -d \
--name biomcp-alphagenome \
-p 8000:8000 \
-e MCP_MODE=worker \
-e ALPHAGENOME_API_KEY="$ALPHAGENOME_API_KEY" \
biomcp-alphagenome:latest
Performance Notes¶
- AlphaGenome predictions require network calls to Google's API
- Container startup is slightly slower due to AlphaGenome installation
- Consider using volume mounts for caching if making many predictions
- The 1Mb genomic window option uses more memory and takes longer
Next Steps¶
- See AlphaGenome Setup Guide for general setup
- See AlphaGenome Prompt Examples for usage patterns
- Check the main Dockerfile for implementation details