Skip to main content

phylokit-mcp

ci PyPI python license

Phylogenetic inference over MCP, driving IQ-TREE 2 through piqtree.

A topology without support is not a result. infer_tree always runs a bootstrap and always returns per-clade support. There is no flag to skip it.

5 tools, 62 tests against real IQ-TREE (no mocked engine), 10 mutation checks, and a real-process JSON-RPC handshake test.

Why the rule

A maximum-likelihood tree looks identical whether or not the data support it. Measured here, on alignments simulated from a known 7-taxon tree so the right answer is not in doubt:

sites informative sites recovered the true tree? lowest clade support
300 51 yes, exactly 1.00
60 11 no — RF 2 0.57

At 60 sites the tree contains a clade (C,D,G) that does not exist and omits one that does (E,F,G). Both runs return a fully resolved Newick string of the same shape; nothing about the topology itself distinguishes them. The support values do — and the false clade is the lowest-supported one in the tree.

That is the entire argument for this server. Returning a bare tree returns a result the caller cannot evaluate.

What it reports that a Newick string cannot

  • Conflicting clades — groupings the data support at ≥0.70 that are absent from the reported tree. A support-annotated Newick string has nowhere to attach these, so the standard format silently drops them.
  • fraction_resolved — the share of clades clearing 0.70. The headline number, before any individual grouping is repeated as fact.
  • Model runners-up with ΔAIC — not just a winner. On the 300-site alignment above, simulated under JC, the AIC winner is F81, with several models inside the conventional ±2 indistinguishability margin. A winner without its margin is a claim the numbers do not support.
  • Length versus evidencen_parsimony_informative alongside n_sites. A 10,000-site alignment of near-identical sequences supports nothing.

Tools

tool what it does
infer_tree ML tree plus bootstrap support, per clade. Never one without the other.
select_substitution_model Ranks 100+ models with ΔAIC/AICc/BIC, and says when the criteria disagree.
compare_trees Robinson–Foulds distance and the clades that differ. Compares splits, not strings.
simulate_alignment Generates sequences along a tree you specify — the positive control.
capabilities Engine version, 215 substitution models, enforced limits.

Install

pip install phylokit-mcp

piqtree ships prebuilt wheels, so there is no compiler, no R and no conda step — but it requires Python 3.12+, and so does this package.

Reproducibility, stated precisely

Measured, not assumed:

  • Across fresh processes: exact. Three runs of an identical 30-replicate bootstrap returned byte-identical support.
  • Within one long-lived process: not bit-exact. Passing the same rand_seed does not fully reset IQ-TREE's internal state — building the same tree three times gave call 1 == call 2 but call 3 different.

The practical size: over six repeated 50-replicate calls, three of four clades were bit-identical and one moved 0.02 — a single replicate flipping, well inside the bootstrap's own sampling error (~0.07 at 50 replicates). The topology and every conclusion were unchanged. This is reported in every response rather than papered over, because an MCP server is long-lived by design and that is exactly the condition which exposes it.

Threads are pinned to 1 before piqtree is imported: likelihood sums accumulate in thread-completion order, floating-point addition is not associative, and near-tied topologies can flip on the last bits.

Limitations

  • Nucleotide alignments only. Protein and codon models are not exposed.
  • Bootstrap only — no aLRT, no approximate Bayes, no UFBoot. Support is the nonparametric bootstrap (Felsenstein 1985), computed here rather than read back from IQ-TREE, because piqtree 0.8.3 runs bootstrap_replicates but does not expose the resulting values.
  • Cost is linear in replicates. ~130 ms per replicate at 7 taxa / 300 sites, and it grows with taxon count. Capped at 200 taxa and 1000 replicates.
  • It does not align sequences. Ragged input is refused, not guessed at.
  • Unrooted trees. No rooting, no dating, no ancestral reconstruction.

Licence

GPL-2.0-only. The "only" is load-bearing: piqtree declares GPL-2.0-only, which is incompatible with GPL-3.0, so the distributed combination cannot be GPL-3. cogent3 is BSD and imposes nothing.

Unofficial. Not affiliated with, endorsed by, or sponsored by the IQ-TREE authors or the cogent3 project. IQ-TREE 2 is academic software and expects to be cited — if results from this server appear in published work, cite IQ-TREE 2 as directed at iqtree.org, not this wrapper. See NOTICE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phylokit_mcp-0.2.2.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

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

phylokit_mcp-0.2.2-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file phylokit_mcp-0.2.2.tar.gz.

File metadata

  • Download URL: phylokit_mcp-0.2.2.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for phylokit_mcp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 714421207a4d26a4b3ace85b713ef994502e6ceeb6fde385c90222966df43763
MD5 07a4bc4f80e28f0cb2c5974db65b5d9d
BLAKE2b-256 e566ebc6fd82d18772b7dc7f92da4c873c1f5872225e8778b153376d698dfba1

See more details on using hashes here.

File details

Details for the file phylokit_mcp-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: phylokit_mcp-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for phylokit_mcp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e4702132485c7754a0741af9bd3ff3f9f8f37373e18ee7d6af2a714f2b59ac0e
MD5 e7a131f48707eab9165435c1c44336e4
BLAKE2b-256 fc509b3f9c794651ed6900c690450624e75e1230a33b3e56512c7d1a7ab05e78

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page