
Hetzner Cloud (unofficial)
io.github.mguttmann由 GitHub 帳號 mguttmann 發布v0.2.0更新於 Oct 30, 2026
Unofficial MCP server for the Hetzner Cloud API: one typed tool per operation, read and write.
概覽
非官方的本機 MCP 伺服器,把 Hetzner Cloud API 包裝成具型別的工具,讓助理檢視與操作雲端伺服器、防火牆和 DNS。
- 可以做什麼
- 列出並檢視伺服器,支援依名稱篩選,並可查詢指定時間區間的指標
- 對伺服器執行開機、關機、重新啟動、重建、快照、備份、救援模式和更換機型
- 為伺服器套用防火牆,並管理 SSH 金鑰、映像等雲端資源
- 透過產生的工具管理 Cloud DNS 區域與記錄集
- 向任意 Cloud API 端點送出自行指定的請求,並輪詢動作直到完成
- 適用情境
- 適合在桌面 MCP 用戶端中讓助理讀取或操作 Hetzner Cloud 基礎設施:查看伺服器狀態與指標、執行例行伺服器操作,或管理 Cloud DNS。不適用於 Hetzner Robot、獨立 DNS 產品或 Storage Box。
- 執行需求
- 需要 Node.js 22.12 或更新版本,透過 npx 或全域 npm 安裝此套件(0.2.0 或更新版本),以 stdio 在本機執行。需要 HETZNER_API_TOKEN 中的 Hetzner Cloud API 權杖,並能連線至 Hetzner Cloud API。選用開關包括 HETZNER_READ_ONLY、HETZNER_CONFIRM_WRITES 和 HETZNER_DENY_TOOLS。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Hetzner Cloud (unofficial),將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
the-real-hetzner-mcp
An unofficial local Model Context Protocol (MCP) server
(stdio) for the Hetzner Cloud API: every operation of the vendored Hetzner Cloud API
specification as a typed tool, read and write, plus hand-tuned wrappers for the common server
operations. npm package: @mguttmann/hetzner-cloud-mcp.
Unofficial project. This server is not affiliated with, endorsed by, sponsored by or
supported by Hetzner Online GmbH. "Hetzner" is a trademark of Hetzner Online GmbH. The vendored
API specification (specs/cloud.spec.json) is Hetzner's and is not covered by this project's
MIT License. See NOTICE.
Maintenance status
- Maintained on a best-effort basis by one maintainer (@mguttmann) in spare time. There is no support contract and no guaranteed response time.
- Security fixes take priority over features. Report vulnerabilities privately through GitHub private vulnerability reporting, never in a public issue; see SECURITY.md.
- Only the latest minor release gets fixes (SECURITY.md lists the supported versions).
- Dependency updates come from Dependabot; CI fails when a runtime dependency has a known high or critical advisory.
- Releases are built and published by GitHub Actions from a tag on
main, with a CycloneDX SBOM,SHA256SUMSand build provenance (CHANGELOG.md lists the changes). - Issues and pull requests are welcome. Tool names, parameters and environment variables are kept stable between releases; see AGENTS.md for the contract rules.
Features
- Full coverage of the Hetzner Cloud API via codegen from
specs/cloud.spec.json(one generated tool per operation), plus hand-tuned wrappers for the common server operations. The exact tool list and count are pinned bytests/tools-contract.test.tsagainsttests/snapshots/tools-contract.json. hcloud_raw_requestas a generic escape hatch for any endpoint.- Capped 429 backoff, automatic pagination with a soft-cap, action polling with a wall-clock budget (see Timeouts and retries).
- Optional write guard
HETZNER_CONFIRM_WRITES=true: every tool that is not read-only returns a preview (tool name and input) unless the call carriesconfirm: "YES". - Optional operator switches
HETZNER_READ_ONLY=true(only read-only tools andGETthroughhcloud_raw_requestrun) andHETZNER_DENY_TOOLS(tool name globs that always return an error). Both leave the tool list and the schemas unchanged.
Out of Scope
Not covered: Hetzner Robot (the dedicated-server API), Hetzner DNS (the standalone DNS product, a separate API from Cloud DNS) and Hetzner Storage Boxes. They are not part of the Cloud API and the codegen has no spec for them.
Covered: Cloud DNS zones and RRSets (/v1/zones) are part of the Cloud API spec, so they are in scope through the generated tools.
Installation
Requires Node.js 22.12 or newer (engines in package.json; the CI matrix in .github/workflows/ci.yml tests the floor and the current Node lines).
Do not install 0.1.x. npm versions below 0.2.0 (0.1.0 and 0.1.1) are affected by a path-injection vulnerability that is fixed in 0.2.0, see SECURITY.md.
From npm (0.2.0 or newer)
The package name is exactly @mguttmann/hetzner-cloud-mcp; packages with similar names are not from this project.
The version range makes npm refuse the vulnerable 0.1.x versions. If npm reports that no matching version exists, 0.2.0 is not published yet: install from a pinned git commit instead. In your MCP client config the command is then just hetzner-cloud-mcp (no path needed).
With npx (no global install)
MCP clients start it the same way, see Variant C. Keep the version range: without it npx would take whatever version npm serves as latest.
From the MCP Registry
Once listed, the server is in the official MCP Registry as io.github.mguttmann/the-real-hetzner-mcp, with the npm package above as its package. Clients that install from the registry use the same npm package.
From a pinned git commit
Pin a full commit SHA, not a branch name: the commit of the v0.2.0 tag (git rev-list -n 1 v0.2.0) or a later commit on main. npm ci installs exactly the committed lockfile.
Setup
With the npm package, set the variables in the env block of your MCP client configuration (see MCP Connector Setup); the package ships no .env file. In a git checkout:
npm run refresh-spec and npm run generate are not part of the setup: they change the tool surface (see Spec Updates).
The server reads its configuration from the environment. At startup it also loads the .env file in the package directory (next to package.json, dotenv), never one from the current working directory; variables that are already set win. A deployment can pass the file explicitly instead, from any working directory: node --env-file=/path/to/.env dist/index.js.
Optional smoke test against the real API (four read-only calls):
Configuration
Only HETZNER_API_TOKEN is required. The defaults below are pinned by tests/config.test.ts. A numeric value that is not a positive number, and an unknown boolean or log level, falls back to the default. Exceptions that stop the server at startup instead: an invalid HETZNER_API_BASE and an unknown HETZNER_READ_ONLY value.
Development only: RUN_LIVE_TESTS=1 enables tests/live-smoke.test.ts (set by npm run test:live), and HETZNER_LIVE_SMOKE_ANCHORS optionally names servers that test expects to find.
Timeouts and retries
Retries: a 429 is retried after Retry-After, or after a short backoff when the header is
missing (Hetzner refills one request per second; RateLimit-Reset is the time the bucket is
full again and is not used as a delay). A 5xx is retried with backoff, except for POST, which
may already have been processed. With the defaults one tool call answers within about
max(HTTP_TIMEOUT_MS, ACTION_POLL_TIMEOUT_MS) (tests/call-budget.test.ts measures this), so it
stays below a 60 s client call timeout, common in MCP clients and gateways. Keep that relation if you
raise the values. Auto-paginated lists run one request per page within
PAGINATION_TIMEOUT_MS; when that budget ends, the pages read so far come back with
truncated: true and a note, never as a list that looks complete.
When polling fails or the budget runs out after a successful write, the tool returns the write
response (for example the new resource id and a one-time root_password) with
polling_timed_out: true, plus polling_error if polling failed.
MCP protocol
The server speaks MCP over stdio only and opens no network port.
- Protocol revisions: a client that asks for
2024-11-05,2025-03-26,2025-06-18or2025-11-25gets that revision back; a client that asks for a newer one (for example2026-07-28) ininitializegets2025-11-25(tests/server.test.ts). - 2026-07-28 is opt-in: with
MCP_SERVE_MODERN_PROTOCOL=truethe server also answers a client that opens withserver/discoverand serves it the 2026-07-28 revision, with the same tools. A client that opens withinitializestill gets the 2025-era session above (tests/serve-protocol.test.ts). The default isfalse: a client in auto mode (such as the pythonmcpclient) would switch to the new revision as soon as it is offered, so turn it on only after checking the client. Seedocs/adr/0001-mcp-sdk-v2.md. - Message size limit: one inbound JSON-RPC message (one stdin line) may be at most 10 MiB,
the MCP SDK's stdio limit (
tests/transport-lifecycle.test.ts). A longer line closes the transport: the server logsmcp transport erroron stderr and exits with code 1. Keep large arguments (for exampleuser_data) well below that size. Outbound, a tool result is cut atMAX_OUTPUT_BYTES(at most 8 MiB,tests/output-cap.test.ts) and then ends with an[output truncated by MAX_OUTPUT_BYTES=...]marker.
MCP Connector Setup (Claude Desktop / Claude Code)
Append to your client's MCP config (~/Library/Application Support/Claude/claude_desktop_config.json for Claude Desktop, or the equivalent in Claude Code).
Variant A: installed via npm
Variant B: from a git checkout
Variant C: with npx
Restart the client to pick up the change. tools/list should expose the tools pinned in tests/snapshots/tools-contract.json, all named hcloud_*.
Tools: overview
Hand-tuned Wrappers
Generated Tools
One tool per OpenAPI operation, naming scheme hcloud_<verb>_<resource> or hcloud_<resource>_<action>_action. On name collision with a wrapper the generated tool gets the suffix _raw (hcloud_list_servers_raw, hcloud_get_server_raw, hcloud_get_server_metrics_raw).
Run tools/list in the Inspector to see the full list.
Input Validation
Arguments are checked against the tool's declared inputSchema before the
handler runs. The low-level MCP SDK server validates only the shape of the
tools/call request, so this check is what makes the advertised schema binding.
A violation returns an isError result naming the offending property; the
handler is not invoked and no request reaches the Hetzner API.
What is enforced:
- Resource ids must be JSON integers >= 1. String-encoded numbers such as
"42"are rejected rather than coerced. Path parameters that the API declares as strings (id_or_name,rr_name,rr_type) stay strings, but a string used in the path has to name a single segment, see below. - Top-level types,
enum,minimum/maximum,minLength/maxLengthand flat array elements (element type,items.enum,items.minimum/maximum), plusrequired. For a parameter declared as an array of scalars a bare scalar is also accepted and checked against the element schema: for a repeatable query parameter such assortorstatusit serialises to exactly the same single parameter, so rejecting it would break a call that has always worked. The one array-typed parameter that goes into a request body,hcloud_server_rescue.ssh_keys, normalises the scalar into a one-element array, so the value a caller sends is always used or refused, never silently dropped. Per-element messages for a bad array are capped at the first 10 plus a count (tests/validate-input.test.ts), so a large input cannot be amplified into the result or the log. - Unknown top-level properties, for the tools whose schema declares
additionalProperties: false(all wrappers and all generated tools). The out-of-band keysconfirm,waitandauto_paginateare always tolerated, so sendingconfirmwhileHETZNER_CONFIRM_WRITESis disabled, orwait/auto_paginateto a tool that does not declare them, is not an error; those keys are dropped before the request is built. - A path parameter must name exactly one path segment. For the parameters
the API declares as strings (
id_or_name,rr_name) the value is rejected if it is empty, is.or.., contains/or\, or contains a percent-encoded separator or dot (%2f,%5c,%2ein any casing). Reason: percent-encoding keeps such a value inside one segment only as far as the local URL parser is concerned. The actor that resolves the path is the origin, which decodes encoded separators and resolves dot segments before routing, so without this check a crafted value could address a different resource than the tool's own. Legitimate values are untouched: IDN zone names (raw or punycode), a trailing dot,@,*,*.sub,_dmarcand the like all pass and are percent-encoded as before. - Path segments are percent-encoded at every interpolation site, and the
HTTP client refuses any path that URL normalisation would change. Rejected:
?and#(which truncate the path into query/fragment),\(a path separator to the URL parser), characters outside RFC 3986pcharsuch as control characters (which the parser strips, so they could otherwise form a dot segment), empty segments, and./..segments in every spelling, including the percent-encoded ones. The assembled URL is then compared against the intended target: its origin must be the configured one and its path must equal the base path plus the requested path exactly, so any remaining normalisation aborts the request instead of redirecting it. This client-side check only sees what the local URL parser would rewrite, so it is the last line of defence, not the whole guarantee: the per-parameter rule above is what covers what the origin would rewrite. - Rejected input produces no HTTP request at all, not a sanitised one.
What is deliberately not enforced: the contents of a request body. Those
trees are the Hetzner Cloud API's own contract: it validates them and its 400
responses are surfaced to the caller unchanged. format, pattern and
nullable are not evaluated either.
Validation failures are logged with the offending property name and the type
of the offending value; the value itself is only quoted back to the caller, so a
malformed body carrying a private key or password does not end up in the log.
Note on hcloud_raw_request: it remains a deliberate escape hatch that accepts
any path by design, so it is not constrained to a resource whitelist. It is
pinned to the configured API base URL (origin and path prefix), but a caller
granted this tool can reach any endpoint of the Hetzner Cloud API. Like every
other tool it rejects a percent-encoded separator or dot (%2F, %5C, %2E in
any casing) in its path, because the origin, not the local URL parser, decides
what an encoded separator means. Grant hcloud_raw_request accordingly.
Spec Updates
When Hetzner updates the OpenAPI:
A refresh changes tool input schemas and can add tools, which MCP clients and gateways see as
a contract change. List it under "Behaviour changes" in CHANGELOG.md. If the new spec makes a
body field of an existing tool required, keep the old list in PINNED_BODY_REQUIRED in
scripts/generate.ts, so the tool contract does not tighten; the API still rejects a call that
lacks the field. A new tool changes the tool count and name hash of the gateway baseline,
which live in one file, tests/gateway-baseline.json, read by tests/tools-contract.test.ts
and by the CI and release smoke.
Development
Tool contract snapshot
tests/tools-contract.test.ts builds the registry exactly as the stdio server does
(src/build-registry.ts) and compares every tool against tests/snapshots/tools-contract.json:
name, inputSchema.required, a sha256 of the canonical (key-sorted) JSON of inputSchema
(with and without HETZNER_CONFIRM_WRITES=true), a sha256 of the description, and the
annotations. It also pins the tool count and the sha256 of the sorted tool names to the
gateway baseline; those two values live in tests/gateway-baseline.json and are not rewritten by
any script.
npm run refresh-snapshot regenerates both tests/snapshots/tool-registry.json and
tests/snapshots/tools-contract.json. Run it only for a deliberate contract change and review
the diff: a changed required, schema or description hash changes what MCP clients see.
Stdio smoke test
npm run smoke spawns dist/index.js (run npm run build first), sends initialize,
notifications/initialized and tools/list over stdio, and prints the negotiated protocol
version, serverInfo, the tool count and the sha256 of the sorted tool names as JSON. It needs
no network:
Options: --protocol-version <v>, --min-tools <n>, --expect-names-sha256 <hex>,
--baseline <file> (sets both from a JSON file with toolCount and namesSha256),
--server <path> (default dist/index.js) and --timeout-ms <ms>; the defaults are at the top
of scripts/smoke-stdio.mjs. Exit code 0 means all checks passed, 1 a check failed, 2 the
server did not start or answer. CI runs it with --baseline tests/gateway-baseline.json, the file
tests/tools-contract.test.ts also reads.
Manual Verification Recipe
Run before declaring a release ready:
npm run inspectoropens the MCP Inspector with this server.tools/list: verify the count equalstoolCountintests/snapshots/tools-contract.jsonand that every wrapper in the table above appears.hcloud_list_servers(no args): verify against at least one known server in your account.hcloud_get_serverwithname: "<one of your server names>": should return id, type, ip.hcloud_create_ssh_keywith{ name: "mcp-smoke", public_key: "<your test key>" }: note the returned id.hcloud_delete_ssh_keywith that id: confirm clean removal.
Do not run power/rebuild/snapshot operations against production servers as part of a smoke test.
Security
See SECURITY.md for supported versions, how to report a vulnerability privately and the threat model (token authority, the confirm guard, grants by tool name).
License
MIT, see LICENSE, except the vendored Hetzner Cloud API specification
(specs/cloud.spec.json), which is Hetzner's; see NOTICE and
specs/SOURCE.md.
來源:README.md,提交 a5db0f8
工具
0版本歷史
1- v0.2.0最新Oct 29, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分