trefle-mcp
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., "@trefle-mcp search Trefle for lavender and show full details of the top match"
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.
trefle-mcp (proof of concept)
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 |
|
| full-text search, optional |
|
| full species card |
|
| "plants by growing conditions" |
|
|
|
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_TOKENenv var only. Sent asAuthorization: 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
limitis capped at 50 per call;has_next_pageandtotaltell the agent whether to paginate.Validation: unknown
filter/rangekeys 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.
Run
pip install -e ".[test]"
export TREFLE_TOKEN=... # from your trefle.io account
python -m trefle_mcp.server # stdioClaude Desktop / Cursor config:
{ "mcpServers": { "trefle": { "command": "python", "args": ["-m", "trefle_mcp.server"],
"env": { "TREFLE_TOKEN": "<your token>" } } } }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 -qNot done yet (production scope)
Retry with Retry-After on 429/5xx, lang parameter for localized common names, species/{id}/facts
provenance tool, Streamable HTTP transport, packaging + CI publish, MCP Registry server.json.
Need a Custom MCP Server for Your API?
Built by Khoa Phan (khoaphan.dev/services • 0%-Fee Escrow on Contra ($145)).
License: MIT
Available Tools
4 toolsget_speciesA
Full species card (growth conditions, images, distributions, synonyms) by id or slug.
Inputs: id_or_slug (required). Returns: object
list_plantsC
List plants filtered by growing conditions, e.g. ranges={"minimum_temperature_deg_c": "-10,"}.
Inputs: page, limit, ranges, filters. Returns: object
search_speciesB
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. Returns: object
species_in_distributionA
Species recorded in a geographic zone (slug or TDWG code like 'fra').
establishment: optional 'native' or 'introduced'.
Inputs: zone (required), page, limit, establishment. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The four tools mostly target distinct operations: name-based search, geographic distribution, full species lookup, and condition-based listing. However, search_species and list_plants can be confused because both return filtered species lists, and the boundary depends on whether the user starts from a name or from growing conditions.
Names are consistently snake_case and mostly follow a verb_noun pattern: search_species, get_species, list_plants. The main deviation is species_in_distribution, which is noun_relation rather than verb-led, but it remains readable and predictable.
Four tools is a well-scoped surface for a read-only plant database MCP. Search, browse, distribution lookup, and full record retrieval each earn their place without redundancy.
The surface covers the core read workflows: discovery by name, filtering by conditions, geographic distribution, and full species cards. Minor gaps exist around taxonomy browsing (e.g. family/genus lookup) and explicit pagination beyond the search limit, but agents can work around them.
Maintenance
Related MCP Connectors
Read and write Drupal JSON:API nodes, taxonomy terms, users and files.
Search published psychedelic research papers, clinical-trial registrations, stakeholders, patents and editorial overviews with source links. Version 1.4.0: 20 read-only tools, including catalogue counts and distributions. OAuth and a free Blossom account required. Limits: 60 MCP requests/minute; 100 ordinary or 500 supporter requests per UTC day. Research context only, no personalized treatment or dosing advice. Guide: https://www.moreblossom.com/connect
Look up Pokémon, moves, abilities, items, natures, and type matchups from PokéAPI v2.
Reference data API for classification systems, real-time world data, and unit conversions
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables queries about global taxonomic data, including scientific name matching, classification chains, common names, and synonyms from the Catalogue of Life index.54 npmMIT
- FlicenseNot gradedqualityDmaintenanceRemote 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.-
- AlicenseNot gradedqualityCmaintenanceEnables querying Rick and Morty characters, locations, and episodes using the Rick and Morty API with no authentication required.320 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables querying biodiversity data from the Global Biodiversity Information Facility (GBIF) API v1, supporting species occurrence searches and other GBIF endpoints through natural language.63 npmMIT