Skip to main content
Glama

trefle-mcp

Official MCP Registry khoap1220-hue/trefle-mcp MCP server License: MIT Secured with mcp-tool-guard MCPRush Grade-A

A small, read-only Model Context Protocol server for the public Trefle botanical REST API, built as a concrete answer to treflehq/trefle-api#225 ("Official MCP server exposing Trefle search and species data").

It is a clean-room implementation: written from the public API contract (routes, query keys, error envelope) and not derived from Trefle's source code. Not affiliated with or endorsed by Trefle.

Tools

Tool

Trefle endpoint

Notes

search_species(q, filters?, ranges?, page, limit)

GET /api/v1/species/search

full-text search, optional filter[...] / range[...]

get_species(id_or_slug)

GET /api/v1/species/{id}

full species card

list_plants(filters?, ranges?, page, limit)

GET /api/v1/plants

"plants by growing conditions"

species_in_distribution(zone, establishment?, page, limit)

GET /api/v1/distributions/{zone}/species

native / introduced filter

These are the four endpoints proposed in the issue (search, species show, plants list with filters, distributions).

Related MCP server: Botany MCP

Design decisions (the open questions in #225)

  • Transport: stdio. Each user brings their own token, so there is no hosted state or shared quota. A Streamable HTTP mode is a small follow-up if Trefle wants a hosted endpoint.

  • Auth: TREFLE_TOKEN env var only. Sent as Authorization: Bearer, never as ?token=, so it does not leak into URLs, logs or tool output. The server fails fast with a clear message if it is missing.

  • Context budget: list results are trimmed to id/slug/names/family/genus/year/image and limit is capped at 50 per call; has_next_page and total tell the agent whether to paginate.

  • Validation: unknown filter/range keys are rejected locally (same allow-list as the API) before any request, so the agent gets an actionable error without spending a request.

  • Errors: Trefle's {error, code, message, details} envelope is returned to the agent as structured JSON instead of a stack trace.

  • Repo placement: works as a standalone package (treflehq/trefle-mcp) or as a folder in the main repo.

1-Click Client Configuration & Quickstart

  • 1-Click Claude Desktop Bundle (.mcpb): Download trefle-mcp.mcpb and open it in Claude Desktop.

  • Zero-Clone uvx Config (Claude Desktop / Cursor / VS Code):

{
  "mcpServers": {
    "trefle": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/khoap1220-hue/trefle-mcp.git",
        "trefle-mcp"
      ],
      "env": {
        "TREFLE_TOKEN": "your-trefle-token"
      }
    }
  }
}

Local Source Install

pip install -e ".[test]"
export TREFLE_TOKEN=...            # from your trefle.io account
python -m trefle_mcp.server        # stdio

Tests

Fully offline: HTTP is mocked with respx, and one test spawns the real stdio server and runs the MCP handshake + tools/list against it. No token or network needed.

PYTHONDONTWRITEBYTECODE=1 python -B -m pytest -q

Roadmap (Planned Next Phases)

Retry with Retry-After on 429/5xx, lang parameter for localized common names, species/{id}/facts provenance tool, and remote Streamable HTTP transport.

License

MIT


Custom Enterprise MCP & Webhook Engineering

Need a production-hardened MCP server (OAuth 2.1, tenant scoping, annotation mutation guards, Official Registry server.json + Glama Grade-A) or replay-safe Stripe/HubSpot/n8n webhook integration?


Project

Focus & Verification

mcp-tool-guard & a2a-card-guard

Zero-dep MCP & A2A v1.0 security guard, 11-CVE multi-lang SCA, RFC 8785 JCS/JWKS verifier & GitHub Action (Featured in awesome-a2a)

caido-mcp · anythingllm-mcp

Official Anthropic MCP Registry servers for Caido AppSec HTTPQL traffic/findings & AnythingLLM RAG workspaces with fail-closed ACLs

blender-mcp-suite · shopnex-mcp

Official Anthropic MCP Registry servers for 21-tool Blender 4.1+ 3D automation (zero-zombie Job Objects) & ShopNex e-commerce operations

wakatime-mcp · trefle-mcp

Read-only Official Anthropic MCP Registry servers for WakaTime developer productivity telemetry & Trefle botanical species data

khoaphan.dev

Architecture notes, live Ed25519-signed A2A v1.0.1 node & custom MCP engineering sprints (100% written async, zero live meetings)

Available Tools

4 tools
get_speciesA
Read-onlyIdempotent

Full species card (growth conditions, images, distributions, synonyms) by id or slug.

Inputs: id_or_slug (required).

list_plantsC
Read-onlyIdempotent

List plants filtered by growing conditions, e.g. ranges={"minimum_temperature_deg_c": "-10,"}.

Inputs: page, limit, ranges, filters.

search_speciesB
Read-onlyIdempotent

Full-text search of plant species by common or scientific name. filters: exact-match keys, e.g. {"edible": "true", "flower_color": "red,white"}. ranges: "min,max" bounds, e.g. {"ph_minimum": "5,", "light": "6,10"}. limit is capped at 50.

Inputs: q (required), page, limit, ranges, +1 more.

species_in_distributionB
Read-onlyIdempotent

Species recorded in a geographic zone (slug or TDWG code like 'fra'). establishment: optional 'native' or 'introduced'.

Inputs: zone (required), page, limit, establishment.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 4 tools

    Disambiguation4/5

    get_species and species_in_distribution are clearly distinct, but search_species and list_plants both return plant lists and can accept range filters, creating some boundary overlap. The descriptions help distinguish name-driven search from condition-driven listing, but an agent may still hesitate between them for broad queries.

    Naming Consistency4/5

    All names use snake_case and are readable, with three following a verb_noun pattern (search_species, get_species, list_plants). species_in_distribution is a noun phrase and a minor deviation from the otherwise consistent convention.

    Tool Count5/5

    Four tools are well-scoped for a focused plant-species lookup server, and each maps to a distinct core workflow: search, detail retrieval, condition-based listing, and geographic distribution. There is no obvious padding or missing essential tool.

    Completeness4/5

    The surface covers the main read-only workflows: finding species, retrieving full species cards, listing by growing conditions, and querying distributions. Minor gaps may exist around taxonomy/reference endpoints, but agents can likely work around them through get_species.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Remote MCP server for authoritative plant information from the VicFlora API. Enables searching plants, fetching profiles, finding occurrences near a point, and looking up botanical terms.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables querying biodiversity data from the Global Biodiversity Information Facility (GBIF) API v1, supporting species occurrence searches and other GBIF endpoints through natural language.
      64 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables querying a global plant database with over 1 million species, providing access to plant records and species search via natural language.
      51 npm
      MIT