plantcv-mcp
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., "@plantcv-mcpsegment plant.jpg with channel a and method otsu"
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.
plantcv-mcp
Plant phenotyping over MCP — traits, plus the segmentation overlay they were measured from.
PlantCV as an MCP measurement instrument: it returns plant trait numbers and the picture they were computed from, and refuses to return numbers when the segmentation is degenerate.
Unofficial. Not affiliated with, endorsed by, or sponsored by the Donald Danforth Plant Science Center or the PlantCV maintainers. See NOTICE.
Why you are handed the overlay
Red marks the pixels that were measured. Both images below come from the same file and the same threshold method — the only difference is one parameter.
✅ | ❌ |
|
|
Mask covers 3.1% of the frame, 9 components. | Mask covers 96.1% — it is the background. |
The failure on the right is what this server exists to prevent. Without the picture, both runs return seventeen traits with correct units and entirely believable magnitudes. The one on the right is measuring the wall behind the plants.
segment() returns the overlay and diagnostics but no traits. measure() requires the
session_id that segment() mints. You cannot get a number without first being handed the
image it came from.
That is not a style preference. Measured on real images with PlantCV 4.11.3:
failure | what you get without the overlay |
four-view render, whole-image ROI | 17 plausible traits describing four merged plants |
plant clipped by the frame | size traits that are silently lower bounds |
empty mask | 17 traits of zeros, with PlantCV reporting |
All three produce correctly-united, entirely believable numbers.
Related MCP server: media-mcp
Install
Not published to PyPI. Install from the repository:
uv add git+https://github.com/musharna/plantcv-mcpOr from a local checkout:
uv add /path/to/plantcv-mcpRequires Python 3.11+. Installing pulls PlantCV and its scientific stack (scikit-image, dask, scipy), so the first install is not fast.
Configure your MCP client
The server speaks stdio. The console script installed by the package is
plantcv-mcp.
Claude Code
claude mcp add plantcv -- plantcv-mcpClaude Desktop — add to claude_desktop_config.json:
{
"mcpServers": {
"plantcv": {
"command": "plantcv-mcp"
}
}
}If the executable is not on your PATH (common when it lives in a project
virtualenv), give the absolute path to it, or invoke it through uv:
{
"mcpServers": {
"plantcv": {
"command": "uv",
"args": ["run", "--directory", "/path/to/plantcv-mcp", "plantcv-mcp"]
}
}
}Verify it is wired up by calling list_methods(), which reports the channels,
the methods, and the pinned PlantCV version.
Tools
tool | returns |
| contact sheets, and what each |
| overlay + diagnostics + warnings — no traits |
| traits, or a raised error on a degenerate mask |
|
|
| one recipe across many images; traits only where valid |
| channels, methods, object types, pinned PlantCV version |
Typical loop: suggest_segmentation → segment → look at the overlay → segment again
with a different channel, method or polarity if it is wrong → measure.
segment parameters
parameter | default | what it does |
| required | image to read from the host filesystem |
| required | one of |
| required | one of |
|
| which side of the threshold is the plant. See below |
|
| drops components smaller than this; can erase a small specimen |
|
| neighbourhood size, |
|
| constant subtracted from the local mean, |
The segment() response for the image at the top of this page — verbatim, apart from a
shortened session_id and an elided warning message:
{
"session_id": "9d2384c8-…",
"channel": "a",
"method": "otsu",
"object_type": "dark",
"fill_size": 200,
"mask_fraction": 0.031,
"component_count": 9,
"major_object_count": 4,
"largest_area": 8628,
"overlay_scale": 1.0,
"overlay_png_bytes": 748233,
"warnings": [
{
"code": "multi_specimen",
"message": "4 comparably-sized objects detected (areas: [8628, 7981, 7106, 6748]). …"
}
]
}The overlay arrives alongside this as a second content block, as an image.
Getting the polarity right
object_type decides which side of the threshold is the plant, and it is the easiest way to
get a confidently wrong answer — that is the right-hand image at the top of this page.
Two things guard against it. suggest_segmentation reports what both polarities yield on
your image before you commit, alongside a contact sheet of every colourspace:

And segment emits an implausible_coverage warning when the mask covers more than half the
frame. Neither refuses the measurement, because a macro shot of a single leaf legitimately
fills the frame — they make the choice visible rather than making it for you.
fill_size deletes any component smaller than itself, so a small specimen can vanish
entirely. When that happens segment reports fill_erased_mask and names the size to drop
below, rather than letting it look like a bad channel choice.
What it measures
One measure() call returns seventeen traits, each with a unit.
group | traits |
size |
|
shape |
|
ellipse fit |
|
position |
|
PlantCV flags |
|
The last two are PlantCV's own flags. They are passed through as information, never as
validity signals — on an all-zero mask PlantCV reports both as True while returning
seventeen zeros. They are bounds checks, not success checks.
Passing analyses=["size", "color"] adds hue, saturation and value statistics —
hue_circular_mean, hue_circular_std, hue_median (degrees), saturation_mean,
saturation_median, value_mean, value_median (percent). The three frequency histograms
that accompany them total 692 numbers, so they are withheld unless you ask for them with
include_histograms=true.
Real-world units
Traits are in pixels by default, and pixel sizes are not comparable between images shot at
different distances or zoom levels. Pass px_per_mm to measure() and spatial traits come
back in mm and mm2:
measure(session_id, px_per_mm=12.5)
area 207.533 mm2 (32427 pixels)
width 54.880 mm (686 pixels)Lengths divide by px_per_mm, areas by its square. That distinction is a hard-coded table
rather than something inferred from PlantCV's unit strings, because PlantCV labels both
area and width as "pixels" — scaling everything with that label linearly would leave
every area wrong by exactly a factor of px_per_mm, plausibly and silently. Positions
(center_of_mass, ellipse_center) stay in pixels, since a millimetre coordinate means
nothing without a defined origin.
If you have a marker of known real size in the frame — a coin, a printed disc — put a box around it and let the server measure it:
calibrate_scale_from_marker(image_path, x=100, y=100, w=100, h=100, marker_length_mm=20)
-> px_per_mm 4.05, marker_length_px 81marker_length_mm is the marker's longest real dimension. Check marker_length_px against
what you expect, because a wrong scale silently rescales every trait you measure afterwards.
The region is cropped before thresholding, so nothing outside your box can be selected;
PlantCV's own report_size_marker_area takes an ROI instead, and measured against a disc of
known 80 px diameter it returns 348 with a tight ROI — a silent 4.35× error. If the detected
object reaches the crop edge you get a marker_touches_crop_edge warning, which usually means
the polarity is wrong and the background was measured.
Colour correction
segment(..., color_correct=true) detects a Macbeth-style ColorChecker in the frame and
corrects to a standard reference, which is what makes colour traits comparable between images
shot under different lighting. measure() re-applies the same correction, so traits are always
measured on the pixels the mask was drawn on.
If no card is found this raises rather than quietly measuring the uncorrected image — returning colour traits that look corrected and are not would be the same kind of confident wrongness as an inverted mask.
Measuring many images
measure_images(image_paths, channel, method, ...) applies one fixed recipe across up to 200
images.
This is the one place the two-step discipline cannot hold literally: nobody reviews two hundred
overlays. So the overlay is replaced by the only honest substitute — every image runs the same
guards as segment(), and any image that trips a blocking guard comes back with no traits at
all, just a reason and an instruction to inspect it individually. Advisory warnings such as
multi_specimen are attached to the traits rather than suppressing them.
{
"summary": {
"submitted": 2,
"measured": 1,
"needs_review": 1,
"review_paths": ["blank.png"]
},
"results": [
{
"image_path": "blank.png",
"measured": false,
"traits": null,
"refused_because": "empty_mask — traits withheld because the mask probably does not describe the plant."
}
]
}Settle the recipe on one representative image with suggest_segmentation and segment first,
looking at the overlay, then apply it here. A batch never returns a number the server could not
validate — which is weaker than a human looking at a mask, and is stated plainly rather than
implied.
Security and trust boundary
This server reads image files anywhere on the host filesystem, and returns them to the model as images.
suggest_segmentation and segment take an image_path and pass it straight to
PlantCV's reader. There is no directory allow-list and no sandbox. Any path the
model asks for — that the operating-system user running the server can read — will
be decoded and returned as a base64 image in the model's context.
Practical consequences:
Treat it like any other local filesystem MCP server. Run it as a user whose read access you are comfortable exposing to the model driving it.
A prompt-injected or adversarial model can use it to view arbitrary image files on the machine. Non-image files fail to decode and raise, but the error message discloses whether the path exists.
Do not run it as root, and do not expose it to untrusted input on a machine holding sensitive imagery.
Restricting reads to a configured root directory is a candidate for a future release; it is deliberately not implemented today, and this section exists so that is a decision you make rather than a surprise you discover.
Limitations
Phase 1 is single-ROI: measure() uses the whole image as its region of
interest, which is why the multi-specimen warning can only advise rather than
correct. Multi-plant grids, morphology traits (leaf angles, stem, skeleton) and
iterative mask refinement are phase 2.
Sessions are in-memory and capped (8 by default, LRU-evicted). They do not survive a server restart.
Attribution and licensing
This project is MIT licensed. It depends on PlantCV, which is licensed under the Mozilla Public License 2.0. No PlantCV source is vendored or redistributed here — it is an ordinary runtime dependency — so the MIT license applies to this project's own files. See NOTICE for the full statement.
More
CHANGELOG.md — what changed, and why
docs/MUTATION-CHECKS.md — every guard disabled on purpose, and the test that went red for it. A guard whose test passes with the guard removed is not a test.
Images on this page are rendered from tests/fixtures/multi_specimen.png, an original render
by the author, and regenerate from committed code.
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.
Related MCP Servers
- Flicense-qualityDmaintenanceAllows users to upload images and paint selections with a brush tool to generate and save black-and-white masks. It provides an interface for visual selection that integrates with MCP clients for image processing workflows.Last updated
- AlicenseBqualityBmaintenanceMCP server for video enhancement and SAM3 image segmentation, enabling tasks like upscaling videos and segmenting objects in images via natural language.Last updated495MIT
- AlicenseAqualityDmaintenanceAn MCP server that provides classic computer vision feature extraction tools (color, texture, shape) for image analysis, enabling LLMs to perform precise mathematical image comparisons and quality assessments.Last updated9MIT
- AlicenseBqualityAmaintenanceProvider-neutral Vision MCP Server — image analysis via 10 inference providers through a single MCP server.Last updated319MIT
Related MCP Connectors
A paid remote MCP for HyperFrames, built to return verdicts, receipts, usage logs, and audit-ready J
A paid remote MCP for Equibles, built to return verdicts, receipts, usage logs, and audit-ready JSON
Remote MCP for C2PA intake verifier MCP, structured receipts, audit logs, and reviewer-ready evidenc
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/musharna/plantcv-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server

