Skip to main content

MCP server for Refua Boltz2 folding/affinity and BoltzGen design workflows.

Project description

Refua MCP Server

MCP server exposing strict, typed Refua tools for Boltz2 folding/affinity and BoltzGen design workflows.

Install

pip install refua[cuda] # remove [cuda] if you don't need gpu support
pip install refua-mcp

ADMET predictions are optional; install refua[admet] to enable them:

pip install refua[admet]

Boltz2 and BoltzGen require model/molecule assets. If you don't have them, refua can download them for you automatically:

python -c "from refua import download_assets; download_assets()"
  • Boltz2: uses ~/.boltz by default. Override via tool boltz.cache_dir if needed.
  • BoltzGen: uses the bundled HF artifact by default. Override via tool boltzgen.mol_dir if needed.

MCP Clients

Claude Code

Add the server to your Claude Code MCP config (macOS: ~/Library/Application Support/Claude/claude_code_config.json, Linux: ~/.config/claude/claude_code_config.json). This uses the default assets (~/.boltz for Boltz2 and the bundled BoltzGen artifact). Merge with any existing mcpServers entries:

{
  "mcpServers": {
    "refua-mcp": {
      "command": "python3",
      "args": ["-m", "refua_mcp.server"]
    }
  }
}

Codex

Register the server with the Codex CLI (uses default asset locations):

codex mcp add refua-mcp -- python3 -m refua_mcp.server

List configured servers with:

codex mcp list

If the server is slow to boot (for example on first import of heavy ML deps), raise the startup timeout in your Codex config.toml:

[mcp_servers.refua-mcp]
startup_timeout_sec = 30

Tools

  • refua_validate_spec: validate and normalize a request without running folding/affinity.
  • refua_fold: run fold/design workflows with typed entities and constraints.
  • refua_affinity: run affinity-only predictions.
  • refua_antibody_design: focused antibody entrypoint (antibody + optional context_entities).
  • refua_job: check status/results for background jobs.
  • refua_admet_profile (optional): run model-based ADMET predictions for SMILES strings (requires refua[admet]).

All major tools expose strict JSON schemas, including discriminated entity unions by type and typed output schemas.

Resources And Templates

  • refua://recipes/index (resource): lists canonical recipe names.
  • refua://recipes/{recipe_name} (resource template): returns concrete tool/args examples.

Recipe names:

  • fold_protein_ligand
  • affinity_only
  • antibody_design

Workflow

Recommended call sequence:

  1. Read refua://recipes/index and optionally a recipe template.
  2. Call refua_validate_spec to catch schema/logic issues before expensive runs (deep_validate=true for asset-backed construction checks).
  3. Execute refua_fold, refua_affinity, or refua_antibody_design.
  4. For long runs, set async_mode=true and poll refua_job.

Examples

Fold protein + ligand with optional affinity:

{
  "tool": "refua_fold",
  "args": {
    "name": "protein_ligand",
    "entities": [
      {"type": "protein", "id": "A", "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"},
      {"type": "ligand", "id": "lig", "smiles": "CCO"}
    ],
    "constraints": [
      {"type": "pocket", "binder": "lig", "contacts": [["A", 5], ["A", 8]]}
    ],
    "affinity": {"binder": "lig"},
    "admet": true
  }
}

Affinity-only:

{
  "tool": "refua_affinity",
  "args": {
    "name": "protein_ligand_affinity",
    "entities": [
      {"type": "protein", "id": "A", "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"},
      {"type": "ligand", "id": "lig", "smiles": "CCO"}
    ],
    "binder": "lig"
  }
}

Antibody-focused design:

{
  "tool": "refua_antibody_design",
  "args": {
    "name": "ab_design",
    "antibody": {
      "type": "antibody",
      "ids": ["H", "L"],
      "heavy_cdr_lengths": [12, 10, 14],
      "light_cdr_lengths": [10, 9, 9]
    },
    "context_entities": [
      {"type": "protein", "id": "A", "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"}
    ]
  }
}

Validate only (no run):

{
  "tool": "refua_validate_spec",
  "args": {
    "action": "fold",
    "entities": [
      {"type": "protein", "id": "A", "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"},
      {"type": "ligand", "id": "lig", "smiles": "CCO"}
    ]
  }
}

ADMET predictions:

{
  "tool": "refua_admet_profile",
  "args": {
    "smiles": "CCO",
    "include_scoring": true
  }
}

Note: DNA/RNA entities are supported for Boltz2 folding only (BoltzGen does not accept DNA/RNA entities).

Long-Running Jobs

For runs that exceed the tool-call timeout, set async_mode=true and poll sparingly (for example every 30-120 seconds) or follow recommended_poll_seconds from refua_job.

{
  "tool": "refua_fold",
  "args": {
    "async_mode": true,
    "entities": [...]
  }
}

Then poll:

{
  "tool": "refua_job",
  "args": {
    "job_id": "..."
  }
}

For queued/running jobs, the response includes recommended_poll_seconds plus queue and estimate metadata (queue_position, queue_depth, average_runtime_seconds, estimated_start_seconds, estimated_remaining_seconds). Set include_result=true once complete to fetch results.

Long-poll support:

{
  "tool": "refua_job",
  "args": {
    "job_id": "...",
    "wait_for_terminal_seconds": 300,
    "include_result": true
  }
}

Experimental MCP Tasks

This server enables MCP experimental task support (tasks/get, tasks/result, tasks/list, tasks/cancel) and advertises task execution support for refua_fold, refua_affinity, refua_antibody_design, and refua_admet_profile.

If your client supports task-augmented tool calls, prefer tasks for long-running operations. Otherwise, continue with async_mode=true + refua_job.

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

refua_mcp-0.5.1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

refua_mcp-0.5.1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file refua_mcp-0.5.1.tar.gz.

File metadata

  • Download URL: refua_mcp-0.5.1.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Darwin/25.2.0

File hashes

Hashes for refua_mcp-0.5.1.tar.gz
Algorithm Hash digest
SHA256 349e2d62c784d8cb94e8332b82b70439adcf8212209bb698a0ac9146535e171e
MD5 9d376f203ea7949d631d27c3c07cd5fd
BLAKE2b-256 2e13120de23d37ab3db62af03512c859158d7647dd7d6fbbced336b30f18abe3

See more details on using hashes here.

File details

Details for the file refua_mcp-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: refua_mcp-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Darwin/25.2.0

File hashes

Hashes for refua_mcp-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d3e07f6b060ee80defcec769dd44863340ee66c1c8c2c291931951ea607e806
MD5 78b4cc2170fa3deabfe8ec401cad9455
BLAKE2b-256 5affae87926b11302cc1b1f85f13e7a68a0377ca0c412929a15c3a4a58a664f3

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