phylokit-mcp
phylokit-mcp lets AI agents run phylogenetics workflows with IQ-TREE 3 and MAFFT: align sequences, select models, infer bootstrap-supported trees, compare topologies, simulate controls, map positions, and inspect limits.
Infer maximum-likelihood trees from aligned FASTA (DNA or protein) with mandatory bootstrap support (nonparametric or UFBoot2), returning per-clade support, conflicting clades, alignment diagnostics, warnings, and reproducibility metadata.
Rank substitution models by AIC/AICc/BIC, reporting the best model, runners-up, ΔAIC, and whether criteria agree.
Compare two Newick trees by Robinson–Foulds distance and clades/splits that differ.
Simulate an alignment from a known Newick tree as a positive control for inference.
Align unaligned FASTA with MAFFT, optionally writing the alignment to a new file and verifying output rows.
Map a residue to its alignment column and to the corresponding positions in other sequences.
Report engine capabilities: piqtree/IQ-TREE/MAFFT versions, available substitution models, support thresholds, and enforced limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@phylokit-mcp infer tree for alignment 'my_sequences.fasta' with 200 bootstrap replicates"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
phylokit-mcp
phylokit-mcp is an MCP server that lets AI agents build maximum-likelihood trees with IQ-TREE 3 and align sequences with MAFFT.
A topology without support is not a result. infer_tree always runs a
bootstrap and returns per-clade support. There is no flag to skip it.
Why the rule
A maximum-likelihood tree looks the same whether or not the data support it.
Measured on alignments simulated from a known 7-taxon tree,
(((A:0.05,B:0.05):0.05,(C:0.05,D:0.05):0.05):0.05,(E:0.05,F:0.05):0.05,G:0.1);,
with simulate_alignment(newick, model="JC", length=sites, seed=42) and then
infer_tree(fasta, model="JC", replicates=100, seed=1):
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. Only the support values tell them apart, and the false clade is the
lowest-supported one in the tree.
Related MCP server: STRING-db MCP Server
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 put them.
fraction_resolved: the share of clades clearing 0.70. The headline number, before any single 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 not JC (it is TPM2u, which ModelFinder scores the same as TPM2), and several models, JC among them at ΔAIC 0.7, sit inside the conventional ±2 margin (
select_substitution_modelwithseed=1, piqtree 0.8.3).Length versus evidence:
n_parsimony_informativealongsiden_sites. A 10,000-site alignment of near-identical sequences supports nothing.
Tools
Tool | What it does |
| ML tree plus bootstrap support (nonparametric or UFBoot2), per clade. |
| Ranks 100+ models with ΔAIC/AICc/BIC, and says when the criteria disagree. |
| Robinson–Foulds distance and the clades that differ. Compares splits, not strings. |
| Generates sequences along a tree you specify: the positive control. |
| Aligns unaligned FASTA with MAFFT, inline or to a new file ( |
| Maps a residue to its alignment column, and that column to every other sequence. |
| piqtree and IQ-TREE versions, 215 substitution models, MAFFT version, limits. |
Tools that take FASTA or Newick also take a file path (fasta_path, or
trees_path for two trees), read by the server; a relative path resolves
against the server's working directory.
The tests run real IQ-TREE and real MAFFT, with 23 recorded mutation checks and a real-process JSON-RPC handshake test. A few tests replace the engine with scripted trees or model scores so that a count can be worked out by hand. The conflicting-clade advisory is one of them: its replicate trees are scripted, because no simulated alignment tried so far makes the real engine report a conflicting clade.
Install
pip install phylokit-mcpRequires Python 3.12+. IQ-TREE 3 comes through
piqtree 0.8, which builds it into its
wheel. align_sequences also needs the
MAFFT binary on PATH, as does
map_positions on unaligned input; the other tools work without it. Details: docs/INSTALL.md.
Configure your MCP client
{
"mcpServers": {
"phylokit": {
"command": "uvx",
"args": ["phylokit-mcp"]
}
}
}If uvx picks a Python older than 3.12, use
"args": ["--python", "3.12", "phylokit-mcp"].
By default the server opens any path its user can. To confine fasta_path,
trees_path and out_path to your data, add --root DIR (repeatable, or set
PHYLOKIT_ROOTS): "args": ["phylokit-mcp", "--root", "/data/alignments"].
A path outside the roots is refused by name; see
SECURITY.md.
What the benchmark shows
Claude with the server was compared with Claude writing Python in an environment we set up with piqtree, cogent3 and MAFFT, on 38 phylogenetics questions, 3 runs each. A tie means the server matches that result without you building the environment. Questions right in every run, server against Python: Claude Haiku 5.5 34 against 37, Sonnet 5.5 37 against 35, Opus 5.5 36 against 35 (on the commit that takes file paths). None is separated (pre-registered; Holm-adjusted McNemar p = 0.75 on both Haiku and Sonnet). The server cost about the same as Python on Haiku and more on Sonnet (1.23×) and Opus (1.26×).
The chart is the first Opus 5.5 run, on a release that took the data as text. Counting answers, the server got 110 of 114 right and Python 113; counting questions, 36 of 38 were right in every run against 37 (sign test p = 1). Per question the server took 6.0 times as long (95% CI 4.4 to 8.3) and cost 14.4 times as much (9.9 to 20.2), each a geometric mean of per-question ratios. Most of that cost was the model pasting the data file into tool calls; taking file paths (pre-registered re-run, 2026-10-18) brought it down to 1.26 times (1.04 to 1.55).
We wrote the questions and ran the benchmark ourselves; an outside re-run is welcome. The benchmark does not score support values; method, controls and other limitations are in benchmarks/agent_qa; the Haiku and Sonnet runs: 2026-10-20 re-run.
Reproducibility
Not bit-exact, in any setting: IQ-TREE reads the wall clock during its search,
so the same request and seed can differ in the trailing digits of branch
lengths and log-likelihood, and a support value can move: by about 0.05 (a
replicate flipping) for the nonparametric bootstrap, and by no fixed bound for
UFBoot2, whose replicates IQ-TREE draws inside the search (one clade moved 0.16
across six calls on one machine). The server reports
deterministic_across_processes: false and the drift bound for the method
used, null for UFBoot2. Compare
trees with compare_trees and numbers with a tolerance, never by string
equality. Measurements: docs/REPRODUCIBILITY.md.
Limitations
Nucleotide and protein, no codon models. Pass
sequence_type="protein"and a protein model (LG,WAG, …). The molecule type is declared, never sniffed: an A/C/G/T-only alignment is also valid protein (Ala/Cys/Gly/Thr), and a wrong guess returns a wrong tree, likelihood and support with no warning.Two bootstraps, no aLRT or approximate Bayes. The default is the nonparametric bootstrap (Felsenstein 1985), computed here, clades supported at 0.70; it is the only one that reports well-supported clades missing from the ML tree.
support_method="ufboot"is IQ-TREE's UFBoot2 (Hoang et al. 2018), clades supported at 0.95.Nonparametric cost is linear in replicates, each a full ML search: on 89 taxa x 435 sites one replicate took 25-93 s, and 1000 UFBoot2 replicates 83 s. Capped at 200 taxa, 1000 nonparametric and 10000 UFBoot2 replicates. Every tool sends a progress notification every 15 s, so a client idle timeout does not abort a long call.
Alignment is MAFFT
--auto, single-threaded, and nothing else: no strategy choice, profile alignment or trimming; at most 200 sequences of 100,000 residues and 600 s. Gapped input is refused, not degapped. The tree tools refuse ragged input rather than align it.Unrooted trees. No rooting, dating or ancestral reconstruction.
License
GPL-2.0-only, because piqtree is GPL-2.0-only, which is incompatible
with GPL-3.0. cogent3 is BSD.
If you publish results from this server, cite IQ-TREE 3, piqtree and (when it made the alignment) MAFFT, not this wrapper. The references are in CITATION.cff, and licensing and affiliation are in NOTICE.
Available Tools
7 toolsalign_sequencesAlign sequences with MAFFT, ready for infer_treeA
Align unaligned sequences with MAFFT, ready for infer_tree.
The returned fasta has every row the same length and can be passed to
infer_tree or select_substitution_model unchanged. Each output row, with
its gaps removed, is verified to equal the input sequence before it is
returned.
Args:
fasta: UNALIGNED sequences in FASTA, 2-200 of them. Gap characters are
refused: input that is already aligned does not need this tool.
sequence_type: "dna" (default) or "protein". Declared, never sniffed,
and passed to MAFFT explicitly so it does not guess either.
fasta_path: Path of a FASTA file to read instead of fasta.
out_path: Write the aligned FASTA to this NEW file (never overwritten;
its directory must exist) instead of returning it: fasta comes
back None and written_to holds the absolute path, which
infer_tree, select_substitution_model and map_positions take
as fasta_path. Use it rather than copying rows between calls.
Inputs: fasta, out_path, fasta_path, sequence_type. Returns: fasta, engine, warnings, alignment, +4 more
capabilitiesEngine capabilities and limitsARead-onlyIdempotent
What this server can do, and the bounds it enforces.
engine_version is the installed piqtree version (e.g. "0.8.3");
iqtree_version is the IQ-TREE build inside it (e.g. "3.1.2").
Args: include_models: Include the full substitution-model list (long).
Inputs: include_models. Returns: engine, limits, criteria, aligner_error, +7 more
compare_treesCompare two tree topologiesARead-onlyIdempotent
Robinson-Foulds distance between two trees, and which clades differ.
Compares SPLITS, not strings: the same topology has many valid Newick representations, so string equality answers a different question.
Args: newick_a: First tree in Newick format. newick_b: Second tree in Newick format. trees_path: Instead of the two strings, the path of a file holding exactly two Newick trees, A then B.
Inputs: newick_a, newick_b, trees_path. Returns: warnings, only_in_a, only_in_b, shared_taxa, +4 more
infer_treeInfer a phylogenetic tree with bootstrap supportARead-onlyIdempotent
Build a maximum-likelihood tree and measure how well the data support it.
Always bootstraps. There is deliberately no option to skip it: an
unsupported topology is the failure mode this server exists to prevent.
support_method picks which bootstrap; see its entry for the cost.
Args:
fasta: Aligned sequences in FASTA, nucleotide or protein as declared by
sequence_type. All sequences must be the same length — run
align_sequences first if they are not.
model: Substitution model, e.g. "JC", "HKY", "GTR+G" (or "LG+G" for
protein). Run select_substitution_model first if you do not have a
reason to prefer one.
replicates: Bootstrap replicates. Nonparametric: 20-1000, default 100,
and each one costs a full ML search, so the call takes about
replicates x one search. UFBoot2: 1000-10000, default 1000.
seed: 0 to 2**31-1. Fixes the nonparametric bootstrap's column
resampling exactly; the engine's search, and with it UFBoot2's
support, is seeded too but is not bit-exact (see reproducibility).
sequence_type: "dna" (default) or "protein". DECLARED, never sniffed: an
alignment of only A/C/G/T is a valid protein alignment too, so
guessing would silently fit a nucleotide model to protein data. A
protein alignment also needs a protein model — "LG+G" or "WAG",
not the nucleotide default — so run select_substitution_model with
the same sequence_type first.
fasta_path: Path of a FASTA file to read instead of fasta.
support_method: "bootstrap" (default): the nonparametric bootstrap,
clades supported at 0.70, and the only method that reports
well-supported clades the ML tree lacks (conflicting_support).
"ufboot": IQ-TREE's ultrafast bootstrap (UFBoot2, Hoang et al.
2018), clades supported at 0.95; far faster, use it when the
nonparametric cost (replicates x one ML search) is too high, e.g.
more than a few dozen taxa.
Inputs: seed, fasta, model, fasta_path, +3 more. Returns: model, engine, newick, support, +8 more
map_positionsMap a residue to its alignment column and across sequencesARead-onlyIdempotent
Map a residue to its alignment column, and the column to every sequence.
Answers "which residue of B is in the same column as residue N of A" without
counting by hand. Positions count residues from 1, gaps not counted; columns
count from 1. At a gap, a row's position is null and between gives the
residues either side.
Args:
aligned: true if the input is an alignment; false if unaligned, and it
is aligned with MAFFT first, as align_sequences would.
sequence: The sequence whose residue position is meant.
position: A residue position in sequence. Give this or column.
column: An alignment column. Give this or position.
fasta: The sequences in FASTA.
fasta_path: Path of a FASTA file to read instead of fasta.
sequence_type: "dna" (default) or "protein".
Inputs: aligned (required), fasta, column, position, +3 more. Returns: rows, query, column, window, +3 more
select_substitution_modelRank substitution models, with the margin over the runners-upARead-onlyIdempotent
Compare substitution models and report how much the winner won by.
A single model name reads as a finding. The ranking, the delta to the next model, and whether AIC/AICc/BIC agree are what make it one.
Args:
fasta: Aligned sequences in FASTA, nucleotide or protein as declared by
sequence_type.
criterion: "AIC", "AICc" or "BIC". BIC penalises parameters more heavily.
seed: Fixes the engine's search.
top_n: How many ranked models to return.
sequence_type: "dna" (default) or "protein". Ranks within that molecule
type's model set — nucleotide and protein models are not comparable.
fasta_path: Path of a FASTA file to read instead of fasta.
models: Rank only these models (IQ-TREE names, e.g. ["JC", "K2P",
"F81+F", "HKY+F"]), all returned. Bare "F81"/"HKY" have equal base
frequencies in IQ-TREE; JC69, K80 and HKY85 are accepted.
Inputs: seed, fasta, top_n, models, +3 more. Returns: seed, ranking, warnings, alignment, +8 more
simulate_alignmentSimulate an alignment from a known treeARead-onlyIdempotent
Generate sequences along a tree you specify, so the true answer is known.
This is the positive control for everything else here: infer a tree from the
output and compare it back with compare_trees. If inference cannot recover
a topology you generated from, the problem is the data or the settings, not
the biology.
Args:
newick: The true tree, with a branch length on every edge.
model: Substitution model to simulate under. A protein model ("LG",
"WAG", ...) simulates protein; pass the output to infer_tree with
sequence_type="protein". alignment.moltype says which it is.
length: Number of sites.
seed: Fixes the simulation.
Inputs: newick (required), seed, model, length. Returns: seed, fasta, model, warnings, +2 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct pipeline stage: alignment, model selection, tree inference, tree comparison, position mapping, simulation, and capability introspection. The only potential overlap (map_positions aligning internally) is explicitly framed as a convenience, and infer_tree vs select_substitution_model produce clearly different outputs.
Six of seven tools follow a clean verb_noun pattern (infer_tree, align_sequences, map_positions, compare_trees, select_substitution_model, simulate_alignment). The lone noun 'capabilities' deviates but is a conventional meta-tool name and remains readable.
Seven tools is well-scoped for a phylogenetic pipeline, with no redundant or filler tools. Every tool corresponds to a necessary step in the workflow.
The surface covers the full lifecycle: align -> select model -> infer with support -> compare trees -> simulate a positive control -> map positions, plus a capabilities probe. out_path handling and internal alignment in map_positions close the usual I/O gaps.
Maintenance
Related MCP Connectors
Validated molecular biology tools: cloning, primers, CRISPR, Sanger, alignment, qPCR, phylogenetics
Hosted DNA language models: promoter, splice, enhancer, chromatin, expression, annotation
Protein analysis: ESM-2/ESMC embeddings, mutation scoring, landscape scans, ESMFold structure.
- PhageScopeDeprecatedio.github.yiyabo
PhageScope phage database and analysis tasks. Free sign-up at phageagent.deepomics.org.
Related MCP Servers
- AlicenseBqualityDmaintenanceA comprehensive Model Context Protocol (MCP) server that provides access to the AlphaFold Protein Structure Database through a rich set of tools and resources for protein structure prediction analysis.1938MIT
- AlicenseBqualityNot gradedmaintenanceA comprehensive Model Context Protocol (MCP) server for accessing the STRING protein interaction database. This server provides powerful tools for protein network analysis, functional enrichment, and comparative genomics through the STRING API.64MIT
- AlicenseAqualityDmaintenanceEnables the generation, mutation, and evolution of DNA and protein sequences using various evolutionary models and phylogenetic algorithms. It supports realistic next-generation sequencing read simulation and population-level evolutionary tracking for bioinformatics research and testing.6BSD 2-Clause "Simplified"
- AlicenseAqualityDmaintenanceMCP server for single-cell lineage tracing analysis, enabling conversational reconstruction, visualization, and heritability analysis of lineage trees using Cassiopeia, pycea, and treedata.18MIT