Skip to main content
Glama
ena-biosamples-mcp

ena-biosamples-mcp

by Abinesh-T

ena-biosamples-mcp

CI

An MCP server that lets researchers ask questions about public genomics data in the European Nucleotide Archive (ENA) and BioSamples in plain English, from any MCP client (Claude, IDE agents, custom agents).

Question in, insight out: "How many domestic cattle samples were collected in the UK, and is their metadata good enough for a livestock project?" becomes a handful of API calls and a checked, explained answer.

Demo

1. Counting records with a country filter

Counting domestic cattle samples in ENA and filtering to the United Kingdom

2. Checking metadata against a livestock project's requirements

Checking three UK cattle samples for sex and breed

The second check found a real data-quality issue: the first UK "cattle" samples are rumen bacteria from an in vitro fermentation study, submitted under a metagenome checklist, so they can never carry sex or breed. Their coordinates are also written in degrees-minutes-seconds while labelled as decimal degrees.

Related MCP server: BV-BRC MCP Server

Tools

Tool

Example question

Source

count_records

"How many cattle sequencing runs are in ENA?"

ENA Portal API

search_samples

"Show me cattle samples collected in the United Kingdom"

ENA Portal API

get_biosample

"What tissue and breed is sample SAMEA103957639?"

BioSamples API

check_sample_metadata

"Does this sample have sex and breed for a FAANG-style project?"

BioSamples API

check_sample_metadata always checks the fields ENA requires on every sample (organism, collection date, geographic location) and accepts extra required fields per project. Each field is reported as ok, absent, declared_missing (an INSDC missing-value term such as "not collected") or invalid_format (e.g. a collection date that isn't ISO 8601).

Quick start

Claude desktop app (stdio)

Requires uv. Add to the MCP config and restart the app:

{
  "mcpServers": {
    "ena-biosamples": {
      "command": "/full/path/to/uv",
      "args": ["--directory", "/path/to/ena-biosamples-mcp", "run", "ena-mcp"]
    }
  }
}

Docker (Streamable HTTP)

docker build -t ena-biosamples-mcp .
docker run --rm -p 8000:8000 ena-biosamples-mcp
# MCP endpoint: http://localhost:8000/mcp

Development

uv sync
uv run pytest                          # unit tests, no network
uv run ruff check .
uv run python scripts/smoke_live.py    # live check against ENA and BioSamples

Settings can be overridden with ENA_MCP_* environment variables; see .env.example.

Design notes

  • Service layer. All HTTP calls live in ena_service.py and biosamples_service.py. MCP tools in server.py only delegate, and tests swap in a mock transport.

  • Metadata rules are pure functions (metadata_check.py), so consortium-specific rules can be added and tested without touching the network.

  • Verified against the live APIs, not just the docs. Findings that shaped the code:

    • The ENA count endpoint returns TSV with a header line, not a bare number.

    • country="United Kingdom*" returns 0 results while country="United Kingdom" returns 5,188, so countries are matched exactly (case-insensitive). country="*Kingdom*" returns the same 5,188, so no region-suffixed UK values are missed.

    • "cattle" resolves to the genus Bos, which also covers yak and zebu. Results carry a note telling the client to ask for a species such as Bos taurus.

  • Clear errors. Unknown species, private samples and wrong accession types come back as readable messages the model can relay to the user.

Roadmap

  • Validate coordinates (decimal degrees vs. degrees-minutes-seconds), found during the demo

  • Check samples against full ENA and consortium checklists (e.g. FAANG, ERGA)

  • Aggregate tools, e.g. samples per country or per year for a species

  • Response caching and polite rate limiting for bulk questions

License

MIT

Available Tools

4 tools
check_sample_metadataA

Check whether an ENA/BioSamples sample's metadata is complete and well-formed.

Always checks the fields ENA requires on every sample (organism, collection date, geographic location). Flags fields that are absent, filled with an INSDC missing-value term (e.g. "not collected"), or badly formatted (collection date not ISO 8601).

Args: accession: BioSamples accession, e.g. "SAMEA7658521". extra_fields: Additional attributes to require, e.g. ["sex", "breed", "tissue"] for a livestock (FAANG-style) project.

Inputs: accession (required), extra_fields. Returns: fields, passed, summary, accession

count_recordsB

Count records for a species in the European Nucleotide Archive (ENA, EMBL-EBI).

Args: species: Scientific or common name, e.g. "Bos taurus" or "cattle". record_type: "read_run" (sequencing runs), "sample", or "assembly". include_subspecies: Also count subspecies and breeds under this taxon.

Inputs: species (required), record_type, include_subspecies. Returns: count, query, taxon, record_type, +1 more

get_biosampleA

Get an EMBL-EBI BioSamples record with all its attributes.

Attributes include organism, geographic location, tissue, breed and sex where submitted.

Args: accession: BioSamples accession, e.g. "SAMEA7658521". Use the accession returned by search_samples.

Inputs: accession (required). Returns: name, tax_id, accession, update_date, +2 more

search_samplesA

Find samples in the European Nucleotide Archive (ENA, EMBL-EBI) for a species.

Optionally filter by country of origin.

Returns the total number of matching samples plus up to limit records with accession, country, collection date, first public date, submitting centre and description.

Args: species: Scientific or common name, e.g. "Bos taurus" or "cattle". country: Country name, e.g. "United Kingdom" or "Kenya". Omit for all countries. limit: Max samples to return (1-100). Default 20. include_subspecies: Also include subspecies and breeds under this taxon.

Inputs: species (required), limit, country, include_subspecies. Returns: query, taxon, samples, returned, +2 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation4/5

    count_records and search_samples overlap on the species+samples axis, since search_samples already returns a total count alongside records, which could cause hesitation about which to call for a simple sample tally. Otherwise the retrieval (get_biosample) and validation (check_sample_metadata) tools are clearly distinct despite sharing an accession argument.

    Naming Consistency5/5

    All four tools follow a clean verb_noun snake_case pattern (count_records, search_samples, get_biosample, check_sample_metadata) with consistent, predictable verb semantics.

    Tool Count4/5

    Four tools is on the lean side but coherent for a focused ENA/BioSamples lookup server, covering count, search, fetch, and validate without redundancy. It could arguably support one more retrieval tool, but nothing feels bloated.

    Completeness4/5

    The search→get→validate lifecycle for BioSamples is well covered and closure is sensible. Minor gaps: count_records tallies read_run and assembly records but there is no way to retrieve those records, and search_samples only filters by country.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server for querying BV-BRC biological data, submitting analysis jobs (assembly, annotation, BLAST, etc.), and managing workspace files via natural language.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables querying and retrieving bacterial and viral genomic data, features, antimicrobial resistance, and epitopes from the BV-BRC API using natural language.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables searching ENA's public sequencing data by organism, study, platform, country or date, retrieving FASTQ/BAM download URLs and checksums, and discovering available result types and fields.
      146 npm
      MIT