Gigwa MCP Server
Click on "Install 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., "@Gigwa MCP Serverimport DArTseq report and run diversity analysis"
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.
Gigwa MCP Server
An MCP server that drives a local or remote Gigwa installation over its REST API. It lets an MCP client (Claude Desktop / Claude Code) run the whole genotyping workflow in plain language: connect → import genotype data & metadata → run QC and diversity analyses → audit databases for import artifacts. Built for genomic-resources teams and genebanks, but works with any Gigwa instance.
Import DArTseq SNP/Silico xlsx reports (with correct 2-row genotype calling) or plain VCF, plus per-individual metadata.
Analyse read-only: genotypes are pulled out of Gigwa and all statistics are computed in Python (scikit-allel / numpy / scipy). Nothing is written back.
Audit an existing instance to find databases that were imported badly.
Every analysis returns a chat summary and writes full tables as CSV under
./gigwa_results/<database>/.
Table of contents
Related MCP server: Cloud Life Sciences API MCP Server
Overview
Gigwa is a web platform for storing and querying genotyping data. Loading data into it and getting analyses out is normally manual (massaging xlsx into Gigwa's import format, clicking through the web UI, uploading .dart/.vcf, exporting VCFs, running pop-gen tools separately).
This server exposes Gigwa as a set of MCP tools. You talk to your MCP client in natural language; it picks the matching tool and fills in the arguments. There is no chat API of its own, meaning the "interface" is the tool list below plus your prompts.
The analysis tools are read-only: they extract genotypes (via async VCF export or
paged BrAPI allelematrix), compute everything in Python, and write CSVs locally. They
never modify the data in Gigwa.
Features
Import pipeline
Tool | What it does |
| Verify connectivity/auth and report the server version |
| List databases → projects → runs on the instance |
| Call genotypes from DArTseq SNP/Silico xlsx report(s) → VCF and import (optionally genome-anchored via |
| Import a |
| Align DArT tag sequences to a reference genome to infer each marker's chromosome/position |
| Validate an individual-metadata TSV without importing |
| Import per-individual attributes into a database |
| Poll a running import by its progress token |
QC & diversity (read-only)
Tool | What it does |
| Per-sample & per-marker call rate; flag low-call samples/markers |
| Per-sample Ho; flag outliers (contamination / off-type / selfed) |
| Pairwise IBS → group duplicate/clonal accessions |
| Report markers that MAF / missingness filters would remove |
| Per-marker MAF, He, Ho, PIC, Fis + dataset means |
| PCA of population structure; variance explained + PC coords (optional |
| VanRaden genomic relationship (kinship) matrix |
| Pairwise Weir & Cockerham Fst between groups |
| Per-population He, Ho, Fis, MAF, % polymorphic + (rarefied) allelic richness |
| Greedy allele-coverage core: smallest accession set capturing the most diversity |
| Lightweight ancestry with PCA + K-means, pseudo-F suggests K (no ADMIXTURE binary) |
| UPGMA dendrogram of accessions from IBS distance, written as Newick ( |
Import-quality audit
Tool | What it does |
| Scan a whole instance (or one run) for genotype-encoding artifacts left by a bad import; rank runs BROKEN / SUSPECT / OK |
How it works
MCP client (Claude Desktop / Code)
│ natural language → tool call
▼
gigwa_mcp (this server, stdio)
│ GigwaClient: token auth, multipart upload, async progress, BrAPI v2
▼
Gigwa REST API ──► genotypes (async VCF export ‖ paged search/allelematrix)
│
▼
scikit-allel / numpy / scipy → chat summary + CSV under ./gigwa_results/<module>/Analyses load genotypes through gigwa_mcp/analysis/genotypes.py:load_genotypes, which
has two backends:
method="vcf"(default) : exports the whole variant set once via async VCF and caches it on disk for reuse. Best for small/medium sets and when you will run several tools on the same run.method="allelematrix": pages the genotype matrix via BrAPIsearch/allelematrix, honouring a server-sidemax_markerssubset and sizing pages to the server's per-response cell cap. Best for large datasets where a full export is wasteful (see Performance & scaling).
Variant sets are addressed by their BrAPI variantSetDbId, of the form
MODULE§projectNumber§run (e.g. MyDatabase§1§run1). list_content shows them.
Requirements
Python ≥ 3.10
A reachable Gigwa server (local or remote) and credentials.
Optional: the minimap2 CLI on
PATHfor DArTseq genome-anchoring of very large genomes (otherwise the in-processmappybinding is used).Optional: the
[viz]extra (matplotlib) to run the plotting recipes / regenerate the example figures.
Core Python dependencies (installed automatically): mcp, httpx, pandas, openpyxl,
numpy, python-dotenv, scikit-allel, scipy, mappy.
Installation
From PyPI (recommended):
pip install gigwa-mcp # core + analysis (scikit-allel/scipy)
pip install "gigwa-mcp[viz]" # + matplotlib, for the plotting recipesOr run it without installing into your environment using pipx
or uv — handy as the command in an MCP client config
(see below):
pipx install gigwa-mcp # then: gigwa-mcp
uvx gigwa-mcp # run on demand, no install stepFrom source (for development or an unreleased version):
git clone <your-fork-url> gigwa-mcp && cd gigwa-mcp
python -m venv venv && source venv/bin/activate
pip install -e . # core + analysis (scikit-allel/scipy)
pip install -e ".[dev]" # + pytest, to run the test suite
pip install -e ".[viz]" # + matplotlib, for plotting recipes / example figuresRun the stdio server directly to smoke-test:
python -m gigwa_mcp # or: gigwa-mcp(Normally you don't run it by hand as your MCP client launches it; see below.)
Configuration
Connection settings come from the environment, optionally seeded from a .env file in
the working directory or any parent (cp .env.example .env and edit):
GIGWA_URL=http://localhost:8080/gigwa
GIGWA_USER=your_user
GIGWA_PASS=your_password
# GIGWA_TIMEOUT=120 # optional, secondsGIGWA_URL is the Gigwa base URL without the /rest suffix (it is appended
automatically). The target Gigwa may be local or remote. .env files are gitignored;
keep credentials out of version control.
Connecting from an MCP client
Add a stdio server entry (Claude Desktop claude_desktop_config.json or Claude Code MCP
settings). If you pip installed into a venv, point command at that venv's
gigwa-mcp; with uv you can have it fetch and run the
published package on demand with no separate install:
{
"mcpServers": {
"gigwa": {
"command": "uvx",
"args": ["gigwa-mcp"],
"env": {
"GIGWA_URL": "http://localhost:8080/gigwa",
"GIGWA_USER": "your_user",
"GIGWA_PASS": "your_password"
}
}
}
}Or with an explicit interpreter path ("command": "/abs/path/to/venv/bin/gigwa-mcp",
no args) if you installed it into a virtual environment.
Credentials live in this config, so there is no per-chat "connect" step and every tool call
authenticates on its own (token generated and refreshed automatically). To drive
several Gigwa servers, register one entry each (e.g. gigwa-local, gigwa-remote)
with its own GIGWA_URL/credentials and name the one you mean in the prompt.
Quick start
You talk to your MCP client in plain language; it calls the matching tool and fills in arguments (paths, thresholds, module names) from what you say. A typical first session:
You ask | Tool called |
"Is my Gigwa up, and what version?" |
|
"Connect and list the databases." |
|
"Import |
|
"Now run call-rate QC and a PCA on that run." |
|
"Scan the whole instance for badly imported databases." |
|
More example prompts:
You ask | Tool called |
"Load this VCF into project |
|
"Validate then import this individual-metadata TSV." |
|
"Find duplicate / clonal accessions." |
|
"Flag heterozygosity outliers (contamination / off-types)." |
|
"Which markers would a MAF 5% / 50%-missing filter drop?" |
|
"Give me per-marker MAF, He, Ho, PIC." |
|
"Compute the kinship matrix." |
|
"Compute Fst between these two groups of accessions." |
|
"Compare diversity (He/Ho/allelic richness) across my populations." |
|
"Pick a core collection of ~10% that captures the most diversity." |
|
"How many genetic clusters are in this collection?" |
|
"Build a UPGMA tree of the accessions." |
|
Tool reference
All variant-set tools take variant_set_db_id (MODULE§projectNumber§run). QC/diversity
tools also accept output_dir (defaults to ./gigwa_results/<module>/) and the scaling
args max_markers / method ("vcf" | "allelematrix"); see
Performance & scaling.
Connection & import
Tool | Key arguments | Returns / writes |
| (none) | server version + auth check |
| (none) | database → project → run hierarchy |
|
| imports a DArTseq report; marker/sample counts + final status |
|
| imports a |
|
|
|
|
| validation issues (no import) |
|
| imports per-individual attributes |
|
| current async-job status |
QC & diversity (output files listed in Output files)
Tool | Key arguments | Flags / interprets |
|
| samples/markers below threshold |
|
| Ho outliers; warns if cohort mean Ho implausibly high |
|
| duplicate/clone groups; warns on degenerate clustering |
|
| counts monomorphic / low-MAF / high-missing markers |
| (none) | dataset means; warns on strongly negative Fis |
|
| variance explained + PC1/PC2 outliers |
|
| mean off-diagonal, top related pairs, inbreeding diagonal |
|
| pairwise Fst |
|
| per-group He/Ho/Fis/MAF/%poly/allelic richness |
|
| core set + % of diversity captured |
|
| suggested K (pseudo-F) + per-K table; warns on degenerate clustering |
|
| UPGMA Newick ( |
Audit
Tool | Key arguments | Returns / writes |
|
| ranked BROKEN/SUSPECT/OK + |
Usage scenarios
A. Import a DArTseq report, genome-anchored. Map the tag sequences once, inspect, then import reusing the positions:
"Where do these DArT markers sit on the X genome at
reference.sr.mmi?" →map_dartseq_to_reference"Looks good, importreport_snps.xlsxintoMYDBreusing that mapping." →import_dartseq(..., positions_csv=...)
B. Vet an instance you inherited. Before trusting any analysis, triage every run for encoding artifacts:
"Scan my whole Gigwa for databases that were imported badly." →
audit_import_qualityRuns are ranked BROKEN / SUSPECT / OK with reasons, and the full table lands inimport_quality_scan.csv.
C. Genebank cleaning. Classic data-cleaning sweep on one run:
"Check call rates, flag heterozygosity outliers, and find duplicate accessions in
MYDB§1§run1." →qc_call_rate→qc_heterozygosity→qc_duplicate_accessions.
D. Diversity & structure study.
"Give me a diversity summary, a PCA, the number of clusters, and a UPGMA tree for
MYDB§1§run1." →diversity_summary→diversity_pca→diversity_structure→diversity_tree.
E. Build a core collection.
"Pick a core of ~10% of accessions that captures the most allelic diversity." →
diversity_core_collection(fraction=0.1).
F. Population comparisons from metadata. Provide a metadata TSV with a grouping column
(e.g. country, population):
"Using
meta.tsvgrouped bypopulation, compare per-group diversity and compute pairwise Fst." →diversity_by_group(metadata_tsv="meta.tsv", group_column="population")→diversity_fst(...).
Output files
Each analysis writes one or more CSVs (Newick for the tree) under
./gigwa_results/<module>/ (the audit writes to ./gigwa_results/):
File | Written by | Contents |
|
| per-sample / per-marker call rate + flags |
|
| per-sample Ho, z-score, flag |
|
| IBS pairs ≥ threshold, grouped |
|
| per-marker MAF, missingness, would-remove flags |
|
| per-marker MAF, He, Ho, PIC |
|
| per-sample PC coords (+ optional |
|
| samples × samples GRM |
|
| Fst for every group pair |
|
| per-group He/Ho/Fis/MAF/%poly/allelic richness |
|
| rank, accession, cumulative allele coverage |
|
| per-sample cluster + PC coords |
|
| UPGMA tree (Newick) |
|
| one row per run: status + diagnostics + reasons |
|
| per-marker chrom/pos/strand/mapq/status |
Visualizing results
The tools output tables, not images, which keeps them composable. The figures below were
produced from a synthetic dataset by docs/make_example_figures.py (run
pip install -e ".[viz]" && python docs/make_example_figures.py to regenerate). The same
recipes work on the real CSVs the tools write.
PCA: pca_coords.csv

import pandas as pd, matplotlib.pyplot as plt
df = pd.read_csv("gigwa_results/MYDB/pca_coords.csv")
groups = df["group"] if "group" in df else pd.Series("all", index=df.index)
for g, sub in df.groupby(groups):
plt.scatter(sub.PC1, sub.PC2, s=20, label=g)
plt.xlabel("PC1"); plt.ylabel("PC2"); plt.legend(); plt.savefig("pca.png")Population structure: structure_clusters.csv

df = pd.read_csv("gigwa_results/MYDB/structure_clusters.csv")
plt.scatter(df.PC1, df.PC2, c=df.cluster, cmap="tab10", s=20)
plt.xlabel("PC1"); plt.ylabel("PC2"); plt.title("K-means clusters"); plt.savefig("structure.png")Kinship: kinship_matrix.csv

g = pd.read_csv("gigwa_results/MYDB/kinship_matrix.csv", index_col=0)
plt.imshow(g.values, cmap="viridis"); plt.colorbar(label="relatedness"); plt.savefig("kinship.png")Per-group diversity: diversity_by_group.csv

d = pd.read_csv("gigwa_results/MYDB/diversity_by_group.csv").set_index("group")
d[["he", "ho", "allelic_richness"]].plot.bar(); plt.tight_layout(); plt.savefig("by_group.png")Core-collection coverage: core_collection.csv

c = pd.read_csv("gigwa_results/MYDB/core_collection.csv")
plt.plot(c["rank"], c["coverage_fraction"] * 100)
plt.xlabel("core size"); plt.ylabel("% alleles captured"); plt.savefig("core.png")UPGMA tree: tree.nwk

tree.nwk is standard Newick; open it directly in FigTree
or iTOL, or render in Python:
from Bio import Phylo # pip install biopython
Phylo.draw(Phylo.read("gigwa_results/MYDB/tree.nwk", "newick"))Performance & scaling
Small/medium runs: the default
method="vcf"exports once and caches; running several tools on the same run reuses the cached genotypes.Large runs (hundreds of thousands of markers): pass
method="allelematrix"with amax_markerscap (e.g. 2000-20000) so genotypes are sampled server-side instead of exporting a multi-GB VCF. Statistics are estimated from the sample.Many samples (thousands): the server caps each
allelematrixresponse at ~10,000 cells, so at N samples a response holds ~`10000/Nmarkers, i.e. requests scale withmax_markers. Keepmax_markers` modest on high-sample-count sets.O(samples²) tools:
diversity_kinship,qc_duplicate_accessions, anddiversity_treebuild a samples × samples matrix (and the kinship CSV is written in full). Subsample markers and expect large output / slower runs beyond a few thousand accessions.The
audit_import_qualitytool is bounded bymax_markers×max_samplesper run, so it is cheap and roughly constant-cost even across a whole production instance.
Limitations & disadvantages
Read-only analysis. QC/diversity/audit never write results back to Gigwa; you get CSVs locally. (Import tools do write to Gigwa.)
No built-in plotting. Tools emit CSV/Newick; use the recipes above (matplotlib/Bio.Phylo) to make figures.
allelematrix has no session cache. Unlike the VCF backend, the
allelematrixpath re-fetches genotypes on each tool call, so running many tools on the same large set re-downloads the sample each time.diversity_structureis a lightweight heuristic. It is PCA + K-means with a pseudo-F (Calinski-Harabasz) K suggestion; there is no true admixture model. On weakly or continuously structured data pseudo-F tends towardk_max; the per-K table is the real output and the tool warns when clustering is degenerate. For formal ancestry use a dedicated tool (ADMIXTURE / sNMF) on an exported VCF.Diploid-biallelic assumptions in places (IBS dosage 0/1/2, collapsed-token decode).
Grouping uses a metadata TSV, not server attributes. Some Gigwa builds do not expose BrAPI germplasm/sample/attribute endpoints, so
diversity_fst/diversity_by_grouptake groups fromgroups_jsonor a metadata TSV rather than querying Gigwa.VCF export downloads the whole variant set regardless of
max_markers; usemethod="allelematrix"to subsample large sets.Genome anchoring needs minimap2 + a reference, and streaming very large indexes is I/O-bound.
Single-threaded Python compute; large matrices are held in RAM.
Troubleshooting
Auth / "Missing required environment variable(s)". Ensure
GIGWA_URL,GIGWA_USER,GIGWA_PASSare set (env or.env).GIGWA_URLmust omit the/restsuffix.VCF import rejected / "not bgzipped". Gigwa needs BGZF, not plain gzip. Recompress:
gunzip -c f.vcf.gz | bgzip > f.bgz.vcf.gz(htslibbgzip).Implausible ~95% heterozygosity after a DArT import. That is Gigwa's built-in DArT parser mis-calling the 2-row format. Use
import_dartseq(it calls genotypes in Python and imports a standard VCF) instead of importing the raw DArT report (see below).diversity_fst/diversity_by_groupreport "no groups matched". Check thatid_columnvalues in your TSV match the accession names (or callset ids) in the run.Large set feels slow. Use
method="allelematrix"+ a smallermax_markers, and avoid the O(samples²) tools on many thousands of accessions.
DArTseq notes
DArTseq SNP reports use the classic 2-rows-per-marker layout (a reference-allele row and a
SNP-allele row, each cell 1/0/-); Silico-DArT reports are 1 row per clone (dominant
presence/absence). import_dartseq does the genotype calling in Python and emits a
standard VCF, imported through Gigwa's verified VCF path:
(ref=1, alt=0) -> 0/0 (ref=0, alt=1) -> 1/1
(ref=1, alt=1) -> 0/1 otherwise -> ./. (missing / no allele detected)This deliberately bypasses Gigwa's built-in DArT parser, which might mis-call the 2-row format (there are cases that it imports reference homozygotes as heterozygous, producing implausible ~95% heterozygosity). SNP and Silico use different allele models; import them as separate runs unless you specifically intend to combine them.
Genomic positions (optional)
DArTseq markers have no genomic coordinates, so by default they are placed on a single
Unmapped contig at sequential positions. If you have a reference genome FASTA, the marker
tag sequences (AlleleSequence, ~69 bp) can be aligned to it with minimap2 to infer real
chromosome/position/strand:
map_dartseq_to_reference(snp_xlsx, reference_fasta)→ adartseq_positions.csvreport (uniquely mapped / multi / unmapped), for inspection.import_dartseq(..., reference_fasta=...)→ imports uniquely-mapped markers genome-anchored (minus-strand alleles complemented, output coordinate-sorted, one marker per genomic site); unmapped markers stay onUnmapped.import_dartseq(..., positions_csv=...)→ reuse adartseq_positions.csvfrom a previous run instead of re-aligning. Recommended for large genomes: align once, inspect, then import without paying the alignment cost again.
reference_fasta may be a FASTA (.fa/.fa.gz) or a prebuilt minimap2 .mmi index. By
default the minimap2 CLI backend is used when available: it streams over multi-part
indexes with bounded RAM, so very large (multi-gigabase) genomes work on modest machines.
The in-process mappy backend (backend="mappy") loads the whole index into RAM instead.
Prebuild an index once (tuned for the ~69 bp tags) and reuse it:
minimap2 -x sr -d reference.sr.mmi reference.fasta # build once
# then pass reference.sr.mmi as reference_fastaProject layout
gigwa_mcp/
__main__.py # python -m gigwa_mcp → stdio server
config.py # .env / env loading (GIGWA_URL/USER/PASS/TIMEOUT)
client.py # GigwaClient: auth, multipart upload, progress, BrAPI calls
server.py # FastMCP instance + get_client()
importers/
dartseq.py # DArTseq xlsx → standard VCF (2-row genotype calling)
refmap.py # minimap2 tag → reference mapping
analysis/
genotypes.py # load_genotypes (VCF / allelematrix backends), GenotypeMatrix
stats.py # pure pop-gen stats (MAF, He, PIC, IBS, GRM, allelic richness …)
genebank.py # core-collection + UPGMA helpers
results.py # output-dir resolution + CSV writing
tools/ # @mcp.tool() wrappers: connection, genotype, metadata, qc,
# diversity, audit
scripts/ # run_import_audit.py, run_qc_diversity_validation.py (generic)
docs/ # make_example_figures.py + img/ (README figures)
tests/ # pytest suite (mocked client + synthetic fixtures)Testing
pip install -e ".[dev]"
pytesttest_client.py covers auth/token-refresh, multipart assembly and progress polling with a
mocked transport; test_dartseq_convert.py checks the conversion against synthetic
SNP/Silico fixtures; test_stats.py / test_genebank.py verify the pop-gen and genebank
statistics against hand-computed values; test_genotypes.py exercises VCF parsing +
callset-name mapping with a mock client. The suite needs no live Gigwa server.
License & contributing
Released under the Apache License 2.0 © 2026 Anestis Gkanogiannis anestis@gkanogiannis.com (see also NOTICE).
Issues and pull requests are welcome. Please run pytest before submitting, keep new
analysis logic in pure, unit-tested helpers under gigwa_mcp/analysis/, and avoid
committing data, credentials, or result files (these are gitignored).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gkanogiannis/Gigwa-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server