breedsim-mcp

Official registry Other

Breeding-scheme simulation via AlphaSimR. Needs R, AlphaSimR and libtirpc-dev on the host.

What can you do with breedsim-mcp?

  • Compare with compare_programs, not two run_program calls. It runs both arms on
  • Genomic selection needs linkage disequilibrium. selection_method="genomic" fits
  • Reproducibility. The server pins OMP_NUM_THREADS=1 at import, before R starts;
  • Warnings explain; none of them withhold results.
  • Multi-trait selection. Pass h2 as a list and index_weights to select on a
  • Species. species applies only to runMacs, which has demographic histories for
  • Limits. Every size parameter has a ceiling, listed by list_methods() under

Install

Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).

PYPI package breedsim-mcp
Claude Code
claude mcp add breedsim-mcp -e 'OMP_NUM_THREADS=<OMP_NUM_THREADS>' -- uvx breedsim-mcp==0.6.1
JSON configuration (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "breedsim-mcp": {
            "command": "uvx",
            "args": [
                "breedsim-mcp==0.6.1"
            ],
            "env": {
                "OMP_NUM_THREADS": "<OMP_NUM_THREADS>"
            }
        }
    }
}

Environment variables

  • OMP_NUM_THREADS Pinned to '1' at import so AlphaSimR results are reproducible; overriding it makes runs non-deterministic and the server reports that in every response.

Documentation

From the project's README on GitHub, refreshed weekly. Links open on GitHub.

Contents
  1. breedsim-mcp
  2. Does it help?
  3. Why replicates
  4. Install
  5. Configure your MCP client
  6. Tools
  7. Testing
  8. Limitations
  9. License

breedsim-mcp

breedsim-mcp is an MCP server that lets AI agents run AlphaSimR breeding-program simulations. It returns the spread over replicates, never a single stochastic run, so an agent can say what a selection scheme would gain and how sure that is.

Does it help?

Yes, compared with Claude alone. Compared with Claude writing its own AlphaSimR scripts, it is not measurably more accurate and costs more.

Claude Opus 5.5 answered 34 breeding-simulation questions three times each, keyed by AlphaSimR run directly; the best named formula lands in only 15 of 34. With this server Claude got 102 of 102 right, with its own R and AlphaSimR 99 of 102 (not separated, exact McNemar p = 1.0), and alone 51 of 102 (both tool setups beat it, p < 1e-6). It still costs more than Claude's own scripts. A pre-registered re-run on 2026-10-18, with an unreleased commit that cut the server's instructions and rounded its outputs, got 102 of 102 right in both setups and lowered the server's median cost per answer from $0.051 to $0.033, but Claude's own scripts cost $0.027, cheaper on all 34 questions (p = 1e-10). Time is not separated.

Each question spells out the AlphaSimR calls, so this tests running a stated simulation, not designing one unaided; method, controls, other limitations, and six probability questions reported separately are in benchmarks/agent_qa.

Why replicates

A single simulation run is not a result, and this API will not return one. Five seeds of an identical three-cycle program gave mean genetic gain [1.151, 1.841, 1.424, 1.429, 1.473], sd 0.247, on the very number being reported (measured once on AlphaSimR 2.1.0 while building v0.1.0, 2026-07-29). So run_program enforces a replicate floor and returns a per-cycle mean, sd and confidence interval. No flag collapses it to a point estimate.

Install

This needs more than uv pip install:

  • R ≥ 4.3 with a shared library (libR.so)
  • AlphaSimR, an Rcpp/RcppArmadillo compile that takes minutes
  • libtirpc-dev, or rpy2 fails to link (cannot find -ltirpc)
  • rpy2 <3.6, because 3.6 binds R_getVar, which needs R ≥ 4.4
sudo apt-get install -y r-base r-base-dev libtirpc-dev
R -e 'install.packages("AlphaSimR", repos="https://cloud.r-project.org")'
uv add breedsim-mcp

Do not use a conda Python: rpy2 then fails to load libR.so with GLIBCXX_3.4.30 not found, because conda ships an older libstdc++ than the system libicuuc requires. Use a system or uv-managed interpreter. Requires mcp 2.x.

Configure your MCP client

The server speaks stdio through the breedsim-mcp console script.

Claude Code

claude mcp add breedsim -- breedsim-mcp

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "breedsim": {
      "command": "breedsim-mcp"
    }
  }
}

If the executable is not on your PATH, or AlphaSimR lives in a user library, run it through uv and pass the library path:

{
  "mcpServers": {
    "breedsim": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/breedsim-mcp", "breedsim-mcp"],
      "env": { "R_LIBS_USER": "/home/you/R/library" }
    }
  }
}

Check it with list_methods(), which reports the engine versions and whether this process can currently produce reproducible results.

Tools

ToolReturns
list_methodsengine versions, generators, selection methods, replicate floor
found_populationsession_id, founder provenance, reproducible, measured LD
run_programper-cycle distributions: mean, sd, 95% CI
compare_programsthe paired difference between two programs, with a CI
describe_sessionprovenance, trait architecture, cycles run

Typical loop: found_population → run_program → read the CI and the warnings. To compare two schemes: found_population → compare_programs → read difference. run_program takes selection_method="phenotypic" or "genomic"; compare_programs takes one per arm.

docs/REFERENCE.md has the full tool signatures, example outputs, the warnings table, and the measurements behind the points below.

  • Compare with compare_programs, not two run_program calls. It runs both arms on the same seeds and differences them within each pair, so shared luck cancels. Two overlapping per-program intervals do not imply no difference; the paired interval can still exclude zero (warning overlap_but_different). favours is null when the paired interval contains zero.
  • Genomic selection needs linkage disequilibrium. selection_method="genomic" fits RRBLUP to a SNP chip set at founding (n_snp_per_chr). quickHaplo, the default and the only reproducible generator, has no LD, so use runMacs, which does not reproduce in a long-lived process. On this engine you cannot have both. found_population measures LD and warns (no_linkage_disequilibrium) when the markers are uninformative.
  • Reproducibility. The server pins OMP_NUM_THREADS=1 at import, before R starts; without it the same seed gives different results. The runMacs RNG is seeded once per R session and advances across calls, so a repeat call in this long-lived process differs (reproducible: false).
  • Warnings explain; none of them withhold results.
  • Multi-trait selection. Pass h2 as a list and index_weights to select on a weighted index. trait_correlation must be a real correlation matrix (for n equally correlated traits, not below −1/(n−1)); an invalid one is refused, not replaced by the nearest valid matrix. Genomic selection fits one RRBLUP model per trait, applies the index to the estimated breeding values, and reports prediction_accuracy in each traits entry.
  • Species. species applies only to runMacs, which has demographic histories for GENERIC, CATTLE, WHEAT and MAIZE; anything else is refused. The default is MAIZE, but this is not a plant-only simulator.
  • Limits. Every size parameter has a ceiling, listed by list_methods() under limits. R is a single interpreter and calls are serialized, so one oversized call would block every other. For large jobs, drive AlphaSimR directly.

Testing

CI installs R and compiles AlphaSimR, so the suite runs against the real engine on Python 3.11, 3.12 and 3.13. One test checks the R engine layer against the breeder's equation R = h²S (docs/EVAL.md); it does not test this server's founding or selection code against an outside reference. docs/MUTATION-CHECKS.md records 25 deliberate mutants: 24 turned a test red, and one survives because it is equivalent. tests/test_perf_ratchet.py gates each tool on exact counts of package-function calls and R evaluations, not on time.

Limitations

  • compare_programs is single-trait: one paired verdict needs one criterion, and with several traits that is the index, for which AlphaSimR reports no gain.
  • No G×E, optimal contribution selection, crossing-block optimization or genotype-matrix export.
  • Genomic selection is RRBLUP only. RRBLUP_D, _GCA and _SCA estimate dominance and combining-ability effects that the additive-only addTraitA architecture does not have.
  • Sessions are in memory, capped at 8 (LRU), and do not survive a restart.

License

GPL-3.0-or-later, because this imports rpy2, which is GPLv2+. AlphaSimR itself is MIT. Unofficial: not affiliated with, endorsed by, or sponsored by the AlphaSimR authors, the University of Edinburgh, or the R Foundation. See NOTICE.

CHANGELOG.md records what changed and why.

Frequently asked questions

What is breedsim-mcp?

Breeding-scheme simulation via AlphaSimR. Needs R, AlphaSimR and libtirpc-dev on the host.

How do I install breedsim-mcp?

It runs on your machine. In Claude Code: claude mcp add breedsim-mcp -e 'OMP_NUM_THREADS=<OMP_NUM_THREADS>' -- uvx breedsim-mcp==0.6.1. For other clients, paste the JSON configuration from this page into their MCP settings.

Does breedsim-mcp need an API key?

Its registry entry lists no required key or secret. Some features may still need an account with the service it connects to.

Is breedsim-mcp open source?

Yes. Its code is on GitHub under the GPL-3.0 license.

Who maintains breedsim-mcp?

It is published by musharna. AI.tn lists it but does not maintain or endorse it.

From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.