Skip to main content

MCP for Boltz-2 model inference

Project description

boltz-mcp

MCP (Model Context Protocol) server for Boltz-2 protein structure prediction model.

Overview

This MCP server provides tools for protein structure prediction using the state-of-the-art Boltz-2 model. It enables you to:

  • Predict single protein structures from amino acid sequences
  • Predict protein complexes and multimers
  • Predict protein-ligand interactions
  • Use custom multiple sequence alignments (MSAs)
  • Handle cyclic peptides
  • Configure various prediction parameters

Features

Tools Available

  1. boltz_predict_structure - Main prediction tool with full configuration options
  2. boltz_predict_from_sequences - Simple sequence-to-structure prediction
  3. boltz_check_status - Check Boltz installation status
  4. boltz_get_examples - Get example configurations for different prediction types

Resources Available

  • resource://boltz-usage-guide - Comprehensive usage guide and documentation

Installation

Prerequisites

System Dependencies

Before installing the Python packages, you need to install system dependencies required for building scientific Python packages:

Ubuntu/Debian:

sudo apt update
sudo apt install -y cmake build-essential gfortran

CentOS/RHEL/Fedora:

# For CentOS/RHEL
sudo yum install cmake gcc-gfortran gcc-c++ make
# For Fedora
sudo dnf install cmake gcc-gfortran gcc-c++ make

macOS:

# Install Xcode Command Line Tools if not already installed
xcode-select --install
# Install gfortran (via Homebrew)
brew install gcc cmake

Note: These system dependencies are required because some Python packages (like SciPy) need to be compiled from source when using uv, and they require:

  • cmake: For building dm-tree and other native extensions
  • gfortran: For building SciPy from source
  • build-essential/gcc-c++: For general C/C++ compilation

Python Dependencies

  1. Install the Boltz-2 model:

    pip install boltz
    
  2. Install this MCP server:

    cd boltz-mcp
    uv pip install -e .
    

GPU Requirements

Boltz-2 works best with GPU acceleration. Ensure you have:

  • CUDA-compatible GPU
  • PyTorch with CUDA support
  • Sufficient GPU memory (8GB+ recommended)

Usage

Running the Server

Stdio Mode (for MCP clients)

boltz-mcp
# or
uv run boltz-mcp

HTTP Server Mode

uv run boltz_mcp.server:cli_app --host 0.0.0.0 --port 3002

SSE Mode

uv run boltz_mcp.server:cli_app_sse --host 0.0.0.0 --port 3002

Configuration

You can specify a custom cache directory for Boltz models:

boltz-mcp --cache-dir /path/to/cache

Inspecting the Boltz 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:

npx @modelcontextprotocol/inspector --config mcp-config-local.json --server boltz-mcp

For local stdio mode:

npx @modelcontextprotocol/inspector --config mcp-config-local.json --server boltz-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 (note, if you run inspector several times it can change port, also use the url that includes proxy token when possible)

Note: Using the MCP Inspector is optional. Most MCP clients (like Cursor, Windsurf, Claude Desktop, 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.

Example Usage

Simple Protein Structure Prediction

# Using the boltz_predict_from_sequences tool
{
    "sequences": {
        "sequences": {
            "protein1": "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGYNIVATPRGYVLAGG"
        }
    },
    "output_dir": "./predictions",
    "model": "boltz2"
}

Protein Complex Prediction

# Using the boltz_predict_structure tool
{
    "input_data": {
        "sequences": {
            "chain_A": "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGYNIVATPRGYVLAGG",
            "chain_B": "ARNDCEQGHILKMFPSTWYV"
        }
    },
    "model": "boltz2",
    "devices": 1,
    "accelerator": "gpu",
    "sampling_steps": 200,
    "diffusion_samples": 1,
    "output_format": "mmcif"
}

Advanced Configuration

{
    "input_data": {
        "sequences": ["protein.fasta"],
        "job_name": "my_prediction",
        "pdb_id": "1ABC",  # Template structure
        "msa": ["custom.a3m"],  # Custom MSA
        "ligands": ["ligand.sdf"]  # Ligands
    },
    "model": "boltz2",
    "devices": 2,
    "recycling_steps": 5,
    "sampling_steps": 300,
    "use_msa_server": true,
    "override": false
}

Input Formats

Sequences

  • Amino acid sequences as strings
  • FASTA files (specify file paths)
  • Multiple sequences for complexes

Configuration Files

  • YAML format configurations
  • Support for MSA files (.a3m format)
  • Ligand files (.sdf format)
  • Template PDB structures

Output

The server returns:

  • Success status
  • List of generated output files
  • Output directory path
  • Command executed
  • Standard output/error from Boltz

Output files include:

  • Predicted structures (.pdb or .mmcif)
  • Confidence scores
  • Error estimates (PAE, PDE)

Parameters

Core Parameters

  • model: "boltz1" or "boltz2" (default: "boltz2")
  • devices: Number of GPU devices (default: 1)
  • accelerator: "gpu", "cpu", or "tpu" (default: "gpu")

Sampling Parameters

  • recycling_steps: Number of recycling iterations (default: 3)
  • sampling_steps: Diffusion sampling steps (default: 200)
  • diffusion_samples: Number of samples to generate (default: 1)

Output Parameters

  • output_format: "pdb" or "mmcif" (default: "mmcif")
  • output_dir: Where to save results

Advanced Options

  • use_msa_server: Use online MSA generation
  • override: Override existing predictions
  • step_scale: Control sampling temperature

Error Handling

The server handles various error conditions:

  • Missing Boltz installation
  • Invalid input sequences
  • GPU memory issues
  • Timeout for long predictions (1 hour limit)

Check the boltz_check_status tool to verify installation.

Development

Project Structure

boltz-mcp/
├── src/
│   └── boltz_mcp/
│       ├── __init__.py
│       └── server.py
├── pyproject.toml
└── README.md

Dependencies

  • fastmcp: MCP server framework
  • pydantic: Data validation
  • eliot: Structured logging
  • PyTorch: Deep learning framework
  • RDKit: Chemical informatics
  • Other scientific computing libraries

License

This project follows the same license as the original Boltz-2 model.

Contributing

Contributions are welcome! Please submit issues and pull requests on the project repository.

Support

For issues related to:

  • Boltz-2 model: Check the official Boltz-2 documentation
  • MCP protocol: Check the MCP specification
  • This server: Submit issues to this repository

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

boltz_mcp-0.1.1.tar.gz (113.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boltz_mcp-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file boltz_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: boltz_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for boltz_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 33c76efa10f7adab5a7a8883881c7180636c0aa54f7738b3fc70f1b867b1bdeb
MD5 935b4c4f3f2c25f6cd9487545358b65b
BLAKE2b-256 e167a0820bb8f126c0f39b224fb2e6e994eea58d04f0402c8fa8fb14aa520694

See more details on using hashes here.

File details

Details for the file boltz_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: boltz_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for boltz_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 536df5a41c15d9733760143ec4a17b0712628cbf97956463264b8c5782d7bc5f
MD5 e40f40bea1e31feb3879641e0e8212b7
BLAKE2b-256 a87ff42cc80c5bcccd660b5aaf2fa04741edb9ef4f362d53b3fefd68ea783c27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page