Model Context Protocol server for Galaxy bioinformatics platform
Project description
Galaxy MCP Server - Python Implementation
This is the Python implementation of the Galaxy MCP server, providing a Model Context Protocol server for interacting with Galaxy instances.
Features
- Complete Galaxy API integration through BioBlend
- Optional OAuth login flow for HTTP deployments
- Interactive Workflow Composer (IWC) integration
- FastMCP2 server with remote deployment support
- Type-annotated Python codebase
Requirements
- Python 3.10+
- FastMCP 2.3.0+
Installation
From PyPI (Recommended)
# Install from PyPI
pip install galaxy-mcp
# Or using uv (recommended)
uvx galaxy-mcp
From Source
# Clone the repository
git clone https://github.com/galaxyproject/galaxy-mcp.git
cd galaxy-mcp/mcp-server-galaxy-py
# Install with uv (recommended)
uv sync --all-extras
Configuration
At minimum the server needs to know which Galaxy instance to target:
export GALAXY_URL="https://usegalaxy.org.au/"
How you authenticate depends on your transport:
-
Stdio / long-lived sessions – provide an API key:
export GALAXY_API_KEY="your-api-key"
-
HTTP / OAuth – configure the public URL that users reach and a signing secret for session tokens. The server mints short-lived Galaxy API keys on behalf of each user.
export GALAXY_MCP_PUBLIC_URL="https://mcp.example.com" export GALAXY_MCP_SESSION_SECRET="$(openssl rand -hex 32)"
Optionally set
GALAXY_MCP_CLIENT_REGISTRYto control where OAuth client registrations are stored.
You can also steer the transport with GALAXY_MCP_TRANSPORT (stdio, streamable-http, or sse).
All variables can be placed in a .env file for convenience.
Usage
Quick Start with uvx
# Local stdio transport (no network listener)
uvx galaxy-mcp
# Remote/browser clients with HTTP + OAuth
export GALAXY_URL="https://usegalaxy.org.au/"
export GALAXY_MCP_PUBLIC_URL="https://mcp.example.com"
export GALAXY_MCP_SESSION_SECRET="$(openssl rand -hex 32)"
uvx galaxy-mcp --transport streamable-http --host 0.0.0.0 --port 8000
Installed CLI
pip install galaxy-mcp
galaxy-mcp --transport streamable-http --host 0.0.0.0 --port 8000
If --transport is omitted the server defaults to stdio and reads/writes MCP messages via stdin/stdout.
Working from a checkout
uv sync
uv run galaxy-mcp --transport streamable-http --host 0.0.0.0 --port 8000
See USAGE_EXAMPLES.md for detailed tool usage patterns.
Available MCP Tools
The Python implementation provides the following MCP tools:
connect: Establish connection to a Galaxy instancesearch_tools_by_name: Find Galaxy tools by nameget_tool_details: Retrieve detailed tool informationrun_tool: Execute a Galaxy tool with parametersget_tool_panel: Retrieve the Galaxy tool panel structureget_tool_run_examples: Retrieve XML-defined test lessons that show how to run a toolget_user: Get current user informationget_histories: List available Galaxy historieslist_history_ids: Get simplified list of history IDs and namesget_history_details: Get detailed information about a specific historyupload_file: Upload local files to Galaxyupload_file_from_url: Upload files from URLs to Galaxylist_workflows: List available workflows in Galaxy instanceget_workflow_details: Get detailed information about a specific workflowinvoke_workflow: Execute/run a workflow with specified inputscancel_workflow_invocation: Cancel a running workflow invocationget_invocations: View workflow executionsget_iwc_workflows: Access Interactive Workflow Composer workflowssearch_iwc_workflows: Search IWC workflows by keywordsimport_workflow_from_iwc: Import an IWC workflow to Galaxy
Testing
The project includes a comprehensive test suite using pytest with mock-based testing.
Running Tests
# Install test dependencies
uv pip install -r requirements-test.txt
# Run all tests
uv run pytest
# Run with coverage report
uv run pytest --cov=main --cov-report=html
# Run specific test file
uv run pytest tests/test_history_operations.py
# Run tests with verbose output
uv run pytest -v
Test Structure
Tests are organized by functionality:
test_connection.py- Galaxy connection and authenticationtest_history_operations.py- History-related operationstest_dataset_operations.py- Dataset upload/downloadtest_tool_operations.py- Tool search and executiontest_workflow_operations.py- Workflow import and invocationtest_integration.py- End-to-end scenarios
See tests/README.md for more details on the testing strategy.
Development
Code Style Guidelines
- Use Python 3.10+ features
- Employ type hints where appropriate
- Follow PEP 8 style guidelines
- Use ruff for code formatting and linting
- All code should pass type checking with mypy
Development Setup
# Install development dependencies
make install-dev
# Set up pre-commit hooks (required for contributing)
uv run pre-commit install
Pre-commit hooks will automatically format your code and run linting checks when you commit. All contributors should install these hooks to maintain consistent code quality.
Development Commands
We use a Makefile for consistent development commands:
# Show all available commands
make help
# Install dependencies
make install # Install all dependencies
# Code quality
make lint # Format code and run all checks
# Testing
make test # Run tests with coverage
# Building
make clean # Clean build artifacts
make build # Build distribution packages
# Running
make run # Run the MCP server
make dev # Run FastMCP2 dev server
Using uv directly
All commands can also be run directly with uv:
# Install dependencies
uv sync --all-extras
# Format and lint code
uv run pre-commit run --all-files
# Run tests with coverage
uv run pytest --cov=galaxy_mcp --cov-report=html
# Update dependencies
uv lock --upgrade
Cross-version Testing
Test across multiple Python versions using tox:
# Test on all supported Python versions
tox
# Test on specific version
tox -e py312
# Run only linting
tox -e lint
# Run type checking
tox -e type
Pre-commit Hooks
The project uses pre-commit hooks for automatic code quality checks:
# Install pre-commit hooks (one-time setup)
uv run pre-commit install
# Run pre-commit manually on all files
uv run pre-commit run --all-files
# Skip pre-commit for a single commit (not recommended)
git commit --no-verify
Pre-commit runs automatically on git commit and includes:
- Code formatting with ruff
- Linting with ruff
- Trailing whitespace removal
- File cleanup (EOF, YAML/JSON/TOML validation)
- Large file detection
- Merge conflict detection
License
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 galaxy_mcp-1.4.0.tar.gz.
File metadata
- Download URL: galaxy_mcp-1.4.0.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6737cb2bda074003e2ac51c64bd3cec8b7e26326775639ab61009f8891ce67c8
|
|
| MD5 |
850bdef5012feffa29ff7b4547e3c945
|
|
| BLAKE2b-256 |
55c45212ffc451922a07eac272dfd4e39a3de1896700dd3994a96dc6146a22c2
|
File details
Details for the file galaxy_mcp-1.4.0-py3-none-any.whl.
File metadata
- Download URL: galaxy_mcp-1.4.0-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c497a2b6bfbd39be0225908760d27e73bb6a2b615295af4e902f301592a795d
|
|
| MD5 |
9b82104df7f1d30f2c1d083ae9ccadb1
|
|
| BLAKE2b-256 |
921fc77fcc85b6d380a4ad772f88b355dbd89cf329dfd6a9947529fccd5eb705
|