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.
Protocol target: MCP spec revision 2025-11-25.
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]
OpenTelemetry spans/metrics are optional:
pip install "refua-mcp[observability]"
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
~/.boltzby default. Override via toolboltz.cache_dirif needed. - BoltzGen: uses the bundled HF artifact by default. Override via tool
boltzgen.mol_dirif 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
Transport And Security
Default transport is stdio. You can run HTTP transports with runtime env vars:
REFUA_MCP_TRANSPORT=streamable-http python -m refua_mcp.server
Supported transport modes:
REFUA_MCP_TRANSPORT=stdio|sse|streamable-httpREFUA_MCP_HOST/REFUA_MCP_PORTREFUA_MCP_MOUNT_PATH
Security/runtime controls:
REFUA_MCP_ENABLE_DNS_REBINDING_PROTECTION=true|falseREFUA_MCP_ALLOWED_HOSTS=host1,host2REFUA_MCP_ALLOWED_ORIGINS=https://origin1,https://origin2REFUA_MCP_AUTH_TOKENS=token1,token2(static bearer tokens for HTTP transports)REFUA_MCP_TASK_TIMEOUT_SECONDSREFUA_MCP_QUEUE_TIMEOUT_SECONDS
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+ optionalcontext_entities).refua_protein_properties: compute sequence-based protein properties via Refua'sProteinPropertiesAPI.refua_job: check status/results for background jobs.refua_admet_profile(optional): run model-based ADMET predictions for SMILES strings (requiresrefua[admet]).
All major tools expose strict JSON schemas, including discriminated entity unions by type and typed output schemas.
Output-format notes:
structure_output_format: canonical values areciforbcif;mmcifis accepted as a compatibility alias forcif.feature_output_format: usetorchornpzwhen writing feature files. Ifjsonis provided with a file output request, the server normalizes it tonpzand reports a warning.- If
feature_output_pathends with.json, the server normalizes it to.npzfor feature file export. - Fold/design responses include a
warningslist when compatibility normalization is applied.
Input-compatibility notes:
- For compatibility with some MCP clients,
entities,constraints,antibody, andcontext_entitiesalso accept JSON-encoded strings and will be normalized server-side.
Execution-policy notes:
refua_foldandrefua_antibody_designblock exploratory names by default (for examplesanity_*,*_probe,schema_*,smoke_*) to avoid costly preflight runs.- If an exploratory run is intentionally needed, set
allow_exploratory_run=true. - Asynchronous fold/affinity/design tools accept
queue_timeout_seconds(optional).
Error-contract notes:
- Tool errors return a structured payload with
error.code,error.message, optionalerror.hint, anderror.retryable.
Resources And Templates
refua://capabilities(resource): runtime feature flags, protocol revision, transport/security config summary.refua://recipes/index(resource): lists canonical recipe names.refua://recipes/{recipe_name}(resource template): returns concrete tool/args examples.refua://protein-properties/index(resource): lists available protein property names/groups.refua://protein-properties/group/{group_name}(resource template): lists property names in a group.refua://protein-properties/property/{property_name}(resource template): property metadata.
Completion support:
refua://recipes/{recipe_name}completions for recipe names.refua://protein-properties/group/{group_name}completions for group names.refua://protein-properties/property/{property_name}completions for property names.
Recipe names:
fold_protein_ligandaffinity_onlyantibody_designprotein_properties
Workflow
Recommended call sequence:
- Read
refua://recipes/indexand optionally a recipe template. - Read
refua://capabilitiesfor runtime support and limits. - For sequence-only property analysis, call
refua_protein_properties. - Call
refua_validate_specto catch schema/logic issues before expensive runs (deep_validate=truefor asset-backed construction checks). - Execute
refua_fold,refua_affinity, orrefua_antibody_design. - For long runs, set
async_mode=trueand pollrefua_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
}
}
Protein properties:
{
"tool": "refua_protein_properties",
"args": {
"sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ",
"groups": ["basic"],
"include_catalog": 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.
Set cancel=true in refua_job to cancel queued/running jobs.
Long-poll support:
{
"tool": "refua_job",
"args": {
"job_id": "...",
"wait_for_terminal_seconds": 300,
"cancel": false,
"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_validate_spec, 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. Task cancellation (tasks/cancel) is wired to background job cancellation.
Otherwise, continue with async_mode=true + refua_job.
Project details
Release history Release notifications | RSS feed
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 refua_mcp-0.6.0.tar.gz.
File metadata
- Download URL: refua_mcp-0.6.0.tar.gz
- Upload date:
- Size: 44.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24565b844ffd677096cef278050db5c0ce190737939443ef1e649d9cd7717da7
|
|
| MD5 |
5b9fc600dc818aa1180f47d81e6e0999
|
|
| BLAKE2b-256 |
82b09f7ffe28a063cd78296278eae5744815397b8e1b40970849f0067d4a7867
|
File details
Details for the file refua_mcp-0.6.0-py3-none-any.whl.
File metadata
- Download URL: refua_mcp-0.6.0-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85c335daa114a2fd668c750997311713fdcd215a8ab1014e2450f49d53ac0341
|
|
| MD5 |
d1765a27e4d0e2e79c29678de02542c6
|
|
| BLAKE2b-256 |
3f651b2f4f2e5a3f28b414ffe444f3bde5a242a26f0229e59bb93d869cd64315
|