
Longhorn Mcp
io.github.rafaelgaspar由 GitHub 帳號 rafaelgaspar 發布v0.1.8更新於 Oct 24, 2026
MCP server for the Longhorn distributed storage manager API, with a --read-only mode.
概覽
面向 Longhorn 分散式儲存管理 API 的 MCP 伺服器,讓助理讀寫磁碟區、快照、備份、節點與設定,並可選用唯讀模式。
- 可以做什麼
- 檢視與管理 Longhorn 磁碟區、快照、備份、後備映像與週期性工作
- 查詢節點、引擎映像、執行個體管理器、磁碟區掛載與叢集設定
- 送出原始請求,並檢視 Longhorn 資源類型及其結構定義
- 查看資源目前可用的動作,並對應到相應工具與參數
- 可限制為唯讀工具集,或以 stdio、Streamable HTTP 方式提供服務
- 適用情境
- 適合需要讓助理檢查或操作 Longhorn 叢集的情境,例如查看磁碟區健康狀態、快照與備份,或執行維護動作,可從本機 MCP 用戶端或叢集內部部署使用。
- 執行需求
- 透過 npx(Node.js)在本機執行,或以容器/Helm chart 部署。需要可連線的 Longhorn manager API 位址,以 longhorn-url 參數指定,預設為叢集內部服務位址。未宣告任何驗證機制。遠端存取通常需要 VPN、SSH 通道或 kubectl port-forward。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Longhorn Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
longhorn-mcp
An MCP server for the Longhorn distributed storage manager API. Full read/write coverage of Longhorn's REST API (volumes, snapshots, backups, backing images, nodes, settings, engine images, recurring jobs, and more), a --read-only mode, both stdio and Streamable HTTP transports, and an official Helm chart.
AI-assisted development. The majority of this codebase — implementation, tests, and this documentation — was written with AI assistance (Claude). Review accordingly, especially before running write-mode tools against a production Longhorn cluster.
Quick start
Longhorn's manager API is unauthenticated — reachability is the only access control. If you're not running this against an in-cluster Longhorn (see Connecting popular MCP clients → Remote/HTTP), you'll need a VPN, SSH tunnel, or kubectl port-forward svc/longhorn-backend 9500:9500 to reach it safely. Never expose Longhorn's manager API directly to an untrusted network.
CLI reference
Deploying with Helm
An official chart is published alongside every release:
Key values:
Full schema: chart/values.yaml / chart/values.schema.json.
The chart is also attached as an OCI referrer directly on the image manifest, for tooling that discovers charts via the OCI Referrers API instead of pulling a separately tagged artifact:
Connecting popular MCP clients
Each client's exact config file path/key can drift between versions — check the client's own docs if these don't work. All of them accept the same underlying command/args shape for a local stdio server.
Claude Code
Claude Desktop
Edit claude_desktop_config.json:
Cursor
Edit .cursor/mcp.json (project-scoped) or ~/.cursor/mcp.json (global):
VS Code (Copilot Chat)
.vscode/mcp.json uses a servers key (not mcpServers):
Remote/HTTP
To point a client at an already-running Streamable HTTP instance (e.g. this server deployed in-cluster, see Deploying with Helm) instead of spawning a local npx process, use that client's remote-MCP configuration with the server's /mcp URL. Clients without native remote-HTTP MCP support can bridge via mcp-remote.
Running behind a gateway
Longhorn's manager API — and by extension this server — has no authentication of its own; reachability is the access control (see Quick start). For a multi-tenant or externally-reachable deployment, fronting --http mode with an MCP-aware gateway (e.g. Envoy AI Gateway or similar) for auth, rate limiting, and routing is a good idea. It's not required, though — a private network boundary (VPN, SSH tunnel, cluster-internal only) is a perfectly reasonable standalone posture too, and is exactly what the Helm chart defaults to (route.enabled: false, no external exposure).
Destructive-action guardrails
--read-only is an enforced, structural guarantee (see below); the following is a softer, model-facing one — it shapes what a well-behaved LLM should do, not what the server can refuse.
Every tool whose action is destructive or hard to reverse (deletes, force-detaches, reverts, restores cluster-wide state, evicts a node, deploys an arbitrary engine image, redirects a backup target, etc.) has its description suffixed with an explicit instruction not to call it unless the user has explicitly authorized that specific action in the current conversation, and never proactively, speculatively, or as a side effect of an unrelated task. The server's MCP instructions field (surfaced by clients that support it, in addition to each tool's own description) repeats the same guidance at the server level as a backstop for tools called without reading their full description closely.
This is advisory, not enforced — a client or model can ignore it. It reduces the chance of an LLM calling volume_delete or systemrestore_create as an unprompted "helpful" side effect; it is not a substitute for --read-only where that's the guarantee you actually need.
Longhorn documentation links
Most tool descriptions end with a Longhorn docs: <url> link to the relevant page in Longhorn's official documentation, pinned to the Longhorn version this server's default --longhorn-url target runs (currently 1.13.0) rather than "latest," so the linked content matches the API version actually in use. A handful of tools with no clearly corresponding doc page (instancemanager_*, volumeattachment_*, longhorn_events, volume_job_list, the longhorn_raw_request/longhorn_list_resource_types/longhorn_describe_resource_type introspection tools) don't have one.
Action links
Every Longhorn resource returned by this server (a volume, node, backing image, ...) embeds an actions map of the RPC actions currently valid for it, e.g. a volume's actions.attach. Longhorn's own API returns these as URLs pointing at the manager's in-cluster address — useless to an MCP client, which can only call tools, not arbitrary HTTP endpoints. This server rewrites each one into the MCP tool that performs it instead, alongside that tool's parameter shape (name -> compact type, ? suffix for optional) so a client can call it without a separate schema lookup, e.g.:
args (as above on updateReplicaCount) appears when the action already pins down one of the tool's parameters — Longhorn's ~19 single-field volume update* actions all route through the one volume_update_setting tool, distinguished only by which setting value to pass. shape always lists every parameter the tool takes, including ones already pinned via args, so a pinned value can always be resolved against shape without a separate lookup.
Every action every resource type's schema currently declares maps to a named tool this way — including volume's undocumented jobList, via volume_job_list (Longhorn publishes no input/output schema for it, so that tool accepts an open-ended extra object; see longhorn_describe_resource_type('volume') to check the deployed version's exact shape). Any action a future Longhorn version adds that this server hasn't caught up to yet falls back to longhorn_raw_request instead, with args.method/args.path pre-filled from the original URL. Since Longhorn only lists actions currently valid for a resource's state (e.g. salvage only appears on a faulted volume), this reflects what's actually callable right now, not just what the tool schema allows.
Read-only mode
--read-only enforces itself two ways:
- Registration-time filtering — every write tool is simply never advertised in
tools/list, so a read-only instance's tool set is a strict subset of the read-write one. - Client-layer guard —
LonghornClientrefuses any non-GETrequest regardless of which tool triggered it. This is what protectslonghorn_raw_request, the one escape-hatch tool that stays registered in both modes (its write-ness isn't known until it's actually called).
Run both a read-write and a read-only instance under different names in the same client config if you want an LLM session to default to read-only but have an explicit, differently-named write-capable tool set available:
Development
scripts/introspect-schema.ts dumps a live Longhorn manager's self-described /v1/schemas — useful for cross-checking this package's hand-written tool coverage against whatever Longhorn version you're actually running:
Contributing
Contributions are welcome — see CONTRIBUTING.md for dev setup, coding conventions, and how releases work.
License
MIT — see LICENSE.
來源:README.md,提交 5de0a47
工具
0版本歷史
2- v0.1.8最新Oct 8, 2026
- v0.1.7Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分