
plantcv-mcp
io.github.musharna由 GitHub 帳號 musharna 發布v1.19.2更新於 Nov 3, 2026
Plant phenotyping via PlantCV — returns traits plus the segmentation overlay they came from
概覽
在本機執行 PlantCV 植物表型分析,回傳性狀數值以及這些數值所依據的分割疊圖。
- 可以做什麼
- 建議分割參數,並預覽各通道與目標類型會得到什麼結果
- 將影像分割為遮罩,回傳疊圖、診斷與警告但不給性狀,並可細化接近正確的遮罩
- 從分割工作階段量測性狀,支援批次影像、托盤內單株以及葉莖形態量測
- 以分水嶺或選用的 Segment Anything 估算葉片數量
- 用已知尺寸標記標定比例、校正鏡頭畸變,以及裁切與放大影像
- 分割並量測高光譜與熱影像
- 適用情境
- 當助理需要從影像取得定量植物量測結果(葉面積、形態、計數、光譜或熱統計)時適用;它同時顯示遮罩,便於發現錯誤分割,而不是直接相信數值。
- 執行需求
- 以 Python 套件形式透過 stdio 在本機執行(pip install plantcv-mcp,或以 uvx 搭配 Python 3.13;需 Python 3.11 至 3.13)。選用的 Segment Anything 工具需安裝 sam 附加元件。未宣告驗證或環境變數;--root 參數或 PLANTCV_MCP_ROOTS 可限制檔案存取範圍。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 plantcv-mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
plantcv-mcp
plantcv-mcp is an MCP server that lets AI agents run PlantCV plant phenotyping. It returns trait numbers and the segmentation overlay they were measured from, and refuses to return numbers when the segmentation is degenerate.
[CI] [PyPI] [Python] [License] [DOI] [Glama]
[Correct segmentation: four views of a rendered plant, stems and leaves tinted red and outlined in cyan, the gray background untouched] [Inverted segmentation: the whole gray background tinted red, the four plant views left out]
Left, channel="a", object_type="dark": the mask covers 3.1% of the frame, 9 components,
area=32427. Right, channel="s", object_type="dark": the mask covers 96.1%; it is the
background, area=1007829.
Why you get the overlay
Both images come from the same file and the same threshold method; only the channel differs. Without the picture, both runs return 17 traits with correct units and believable magnitudes. The one on the right is measuring the wall behind the plants. Red marks the measured pixels; a cyan line traces the mask's edge.
So segment() returns the overlay and diagnostics but no traits, and measure() needs the
session_id that segment() mints: no single image is measured before you are shown it. The
exception is measure_images(), which applies one recipe to up to 200 images without overlays.
Settle the recipe on one image's overlay first (the server does not check); every image still
passes the segment() guards, and one that trips a blocking guard gets no traits.
Measured with PlantCV 4.11.3 on a synthetic render (first row:
tests/fixtures/multi_specimen.png) and on photographs, each of these returns believable
numbers with correct units:
Install
With uv nothing needs installing: uvx --python 3.13 plantcv-mcp fetches and
runs the current release. Otherwise:
Requires Python 3.11 to 3.13: PlantCV 4.11.3 needs SciPy below 1.16, which has no Python 3.14
wheels, so --python 3.13 keeps uvx off a 3.14 default. PlantCV and its scientific stack make the first install (or first uvx
run) slow. From a checkout: uv add /path/to/plantcv-mcp. The one optional tool,
segment_leaves_sam(), needs pip install "plantcv-mcp[sam]" (torch, torchvision,
segment-anything); without it, that tool refuses with that command and every other tool works.
Configure your MCP client
Claude Desktop and other stdio hosts:
With a pip install the command is plantcv-mcp (checkout config).
Verify with list_methods().
Flags: --root DIR (repeatable, or PLANTCV_MCP_ROOTS) confines every read, and every file
the server keeps, to your imagery: plantcv-mcp --root /data/phenotyping. --no-isolate (or
PLANTCV_MCP_ISOLATE=0) runs analyses in-process instead of in the crash-containing worker.
What the benchmark shows
Claude with the server was compared with Claude writing its own code (mostly OpenCV) in a Python environment we set up with the same PlantCV and OpenCV, on 46 measurement questions about rendered plant images, 3 runs each. A tie means the server matches that result without you building the environment. Questions right in every run, server against Claude's own code: Claude Haiku 5.5 38 against 32, Sonnet 5.5 33 against 28, Opus 5.5 42 against 44. None is separated (pre-registered; exact McNemar p = 0.15, 0.23 and 0.63), and Claude's own code was cheaper on all three models.
The chart is the Opus 5.5 re-run on 2026-10-18, against an unreleased commit (051aff0) that adds
several-channel segmentation rules and zoom_image: right on 97.1% of answers with its own code
and 95.7% with the server. Its own code cost $0.038 against $0.066 per answer (medians; the
intervals do not overlap). On release 1.16.1 the server was right on 86.2% against 95.7%
(p = 0.18). The images have crisp edges, so a single color cut with no model answers 28 of the
46.
We wrote the questions and ran the benchmark ourselves; an outside re-run is welcome. Method, controls and limitations: benchmarks/agent_qa; the Haiku and Sonnet runs: 2026-10-20 re-run.
Tools
Typical loop: suggest_segmentation → segment → look at the overlay → segment again
with another channel, method or polarity if it is wrong (or refine if it is nearly right) →
measure. With a ColorChecker in the frame, color_correct=true corrects colors before
segmenting and excludes the card from the mask. Parameters, an example response and the
measured facts behind each tool:
docs/GUIDE.md.
What it refuses
Each guard was added after a specific failure and names the next action. Blocking guards withhold numbers; advisories travel with them.
- Inverted mask (
implausible_coverage): the right-hand image above, 17 believable traits describing the wall. - Nothing selected, or
fill_sizedeleted the specimen (empty_mask,fill_erased_mask): PlantCV returns 17 zeros within_bounds=True. - Background texture (
noisy_segmentation): specks of chamber wall measured as one plant. - Several plants in one mask (
multi_specimen): usemeasure_regions(). - Wrong scale, wrong session kind, a file changed after segmentation: refused, naming the right tool.
- A lens calibration the boards do not determine, or no color card when one was asked for: refused.
Why each guard exists, and every warning code: docs/GUIDE.md#warnings-and-refusals.
Security
With no --root, the server reads any image file the host user can read and returns it to the
model. It writes only the lens-corrected image, the Segment Anything checkpoint when asked to
download it, and short-lived temporary copies of hyperspectral and thermal inputs. Run it as a
non-root user with --root set. Analyses run in a worker subprocess, so a native crash is a
tool error, not a dead server. Details:
docs/GUIDE.md#security-and-trust-boundary.
Attribution and license
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. Unofficial: not affiliated with, endorsed by, or sponsored by the Donald Danforth Plant Science Center or the PlantCV maintainers. See NOTICE.
Cite it with CITATION.cff (archived at doi:10.5281/zenodo.21713516). Changes: CHANGELOG.md.
來源:README.md,提交 d6b2e59
工具
0版本歷史
12- v1.19.2最新Nov 3, 2026
- v1.18.3Nov 1, 2026
- v1.18.2Nov 1, 2026
- v1.18.1Oct 31, 2026
- v1.18.0Oct 29, 2026
- v1.17.1Oct 20, 2026
- v1.17.0Oct 20, 2026
- v1.16.1Sep 26, 2026
- v1.16.0Sep 23, 2026
- v1.15.0Sep 19, 2026
- v1.14.0Sep 19, 2026
- v1.13.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分