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
- Interactive Workflow Composer (IWC) integration
- FastMCP server for high-performance operation
- Type-annotated Python codebase
Requirements
- Python 3.12+
- BioBlend 1.5.0+
- MCP SDK 1.6.0+
- Requests 2.32.3+
Installation
From PyPI (Recommended)
# Install from PyPI
pip install galaxy-mcp
# Or using uv package manager
uv pip install galaxy-mcp
From Source
# Clone the repository
git clone https://github.com/galaxyproject/galaxy-mcp.git
cd galaxy-mcp/mcp-server-galaxy-py
# Install in development mode
pip install -e .
# Or using uv package manager
uv pip install -e .
Configuration
The server requires Galaxy credentials to connect to an instance. You can provide these via environment variables:
export GALAXY_URL=<galaxy_url>
export GALAXY_API_KEY=<galaxy_api_key>
Alternatively, create a .env file in the project root with these variables.
Usage
Quick Start with uvx
The fastest way to run the Galaxy MCP server is using uvx:
# Run the server directly without installation
uvx galaxy-mcp
# Run with MCP developer tools for interactive exploration
uvx --from galaxy-mcp mcp dev galaxy_mcp.server
# Run as a deployed MCP server
uvx --from galaxy-mcp mcp run galaxy_mcp.server
As a standalone MCP server
# Install and run the MCP server
pip install galaxy-mcp
galaxy-mcp
# The server will wait for MCP protocol messages on stdin
With MCP clients
# Use with MCP CLI tools
mcp connect galaxy-mcp
# Use with MCP developer tools
mcp dev galaxy-mcp
# Use with other MCP-compatible clients
your-mcp-client galaxy-mcp
See USAGE_EXAMPLES.md for detailed usage patterns and common examples.
Available MCP Tools
The Python implementation provides the following MCP tools:
connect: Establish connection to a Galaxy instancesearch_tools: 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_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 Galaxyget_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.12+ 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 runtime dependencies
make install-dev # Install development dependencies
# Code quality
make lint # Run linting checks (via pre-commit)
make format # Auto-format code (via pre-commit)
make format-quick # Quick format (ruff + prettier only)
make check # Run all checks (lint + test)
# Testing
make test # Run tests
make test-cov # Run tests with coverage report
make test-watch # Run tests in watch mode
# Building
make clean # Clean build artifacts
make build # Build distribution packages
# Running
make run # Run the MCP server
make dev # Run MCP dev server with explorer
Using uv directly
All commands can also be run directly with uv:
# Lint the code
uv run ruff check .
# Format the code
uv run ruff format .
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=galaxy_mcp --cov-report=html
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-0.2.1.tar.gz.
File metadata
- Download URL: galaxy_mcp-0.2.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54bf1a4394abea9d687ec8f1e018749312bb1a3a31cac4cd7cdfd1d4b328002a
|
|
| MD5 |
5f5bbbd754a640eadb553d2e36b4cf8d
|
|
| BLAKE2b-256 |
aa19911acd4db04794e6cb21a8c09ee721d02d473ef7d32a97ad06ad090078b5
|
File details
Details for the file galaxy_mcp-0.2.1-py3-none-any.whl.
File metadata
- Download URL: galaxy_mcp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea5d37f0750bad3eee96f583ac42553a41c4fb8ad357e564d5ba7d4ffce684e
|
|
| MD5 |
aa2cab2d984efe47a7ac6a9cd1f88d5c
|
|
| BLAKE2b-256 |
4c92108bb9b687d6d099a5356fd68e39c25fba473e5b2e19f98f82d4def5b79d
|