Headscale MCP connector
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., "@Headscale MCP connector show me all nodes in my Headscale network"
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.
headscale-mcp (Headscale MCP connector)
MCP connector for a self-hosted Headscale control server. It speaks the Headscale HTTP API over stdio and over stateless Streamable HTTP on localhost.
Headscale is BSD-3-Clause software. This connector is an independent HTTP client of that API. It is not affiliated with the Headscale project or with Tailscale. Bring your own API key from the server you run.
This connector covers all 29 operations in headscale.openapi.json (Headscale v0.29.6) plus one virtual policy diff. Operations are grouped into 8 toolsets. Enable a subset with HEADSCALE_TOOLSETS so the model only sees the tools you need.
Self-hosted Headscale only. There is no default base URL. HEADSCALE_URL is required and must be your server origin, for example http://127.0.0.1:8080. A trailing /api/v1 is stripped. Calls go to {HEADSCALE_URL}/api/v1. Hosts on tailscale.com and tailscale.io are refused. This connector does not speak the Tailscale SaaS API.
Setup
npm install
npm run ci
npm start
npm run start:httpnpm start speaks stdio. npm run start:http serves Streamable HTTP at http://127.0.0.1:3000/mcp and GET /health. HTTP mode has no authentication. Keep it on localhost.
Create an API key with headscale apikeys create. The connector sends it as Authorization: Bearer and never prints it.
{
"mcpServers": {
"headscale": {
"command": "node",
"args": ["/workspace/connectors/headscale/dist/index.js"],
"env": {
"HEADSCALE_URL": "http://127.0.0.1:8080",
"HEADSCALE_API_KEY": "...",
"HEADSCALE_ALLOW_WRITES": "false",
"HEADSCALE_TOOLSETS": "nodes,users,policy,meta",
"HEADSCALE_CONTACT": "you@example.com"
}
}
}
}Docker (HTTP, no authentication, localhost only):
docker build -t headscale-mcp .
docker run -p 3000:3000 \
-e HEADSCALE_URL=http://host.docker.internal:8080 \
-e HEADSCALE_API_KEY=... \
headscale-mcpDo not put the API key in the image.
Regenerate the operations registry after a Swagger bump:
npm run gen:operationssrc/operations.ts is generated. Do not edit it by hand.
Related MCP server: tailscale-mcp
Config
Variable | Meaning |
| Required. Self-hosted Headscale origin. |
| API key. Sent as |
| Must be the literal |
| Comma list of toolsets, or |
| Local request budget. Default 30. |
| Upstream timeout. Default 20000. |
| GET cache TTL. Default 60. Writes clear the cache. |
| Contact token in the User-Agent. Must not be the API key. |
|
|
| HTTP port. Default 3000. |
Safety
Reads run without confirm. check_policy is a read. Headscale validates the policy in a sandbox and does not save it. diff only GETs the current policy.
Every other non-GET is a write. A write needs confirm: true (a boolean, not the string "true") and HEADSCALE_ALLOW_WRITES=true. Otherwise the tool returns a dry-run preview of the method, path, query, and redacted body, and it sends no write. set_policy is the exception on the read side of a preview. Its preview GETs the current policy so the preview can include a line diff. It still does not PUT until both gates pass. A confirmed set_policy with an empty policy string is refused before any request.
Preview and tool descriptions warn on node delete and expire, user delete, pre-auth key create, delete, and expire, API key create, delete, and expire, node tags, approved routes, policy set (a bad policy can lock all nodes out), node register, auth approve, and the debug node creator.
Creating a pre-auth key or an API key returns the secret once, with a note that it is shown only once. List and get responses, and every preview, keep the id or prefix and mask the secret. The caller's own HEADSCALE_API_KEY is redacted everywhere, including inside that one-time response.
Node ids and user ids stay strings and must be numeric. The spec has no pagination parameters.
Errors use a stable prefix. [unauthorized] is 401. [forbidden] is 403. [not-found] is 404. [invalid] is 400 or 422. [rate-limit] is 429 and includes Retry-After. Server errors, network errors, and timeouts have their own codes. Stack traces and filesystem paths are stripped. Responses larger than 1 MB are rejected.
Tools
Default HEADSCALE_TOOLSETS publishes 4 tools. HEADSCALE_TOOLSETS=all publishes 8 tools (30 actions). Each tool takes action plus params, query, body, and confirm when the tool has writes.
Toolset | Tool | Actions | Default |
nodes |
| 9 | yes |
users |
| 4 | yes |
policy |
| 4 | yes |
meta |
| 1 | yes |
preauth_keys |
| 4 | no |
api_keys |
| 4 | no |
auth |
| 3 | no |
debug |
| 1 | no |
debug is only enabled by all. debug_create_node inserts a node without a real client. It is for tests. The tool description says so.
Policy actions are get_policy, check_policy, diff, and set_policy. diff takes a proposed HuJSON or JSON policy string and returns added and removed line counts plus a compact line diff.
Example. List users, preview a create, then confirm it:
{ "action": "list_users" }{ "action": "create_user", "body": { "name": "lab" } }{ "action": "create_user", "body": { "name": "lab" }, "confirm": true }Live check
npm run live-check talks to a real Headscale when HEADSCALE_URL and HEADSCALE_API_KEY are set. It creates throwaway users, keys, and a debug node, checks previews first, then deletes them. It reads policy, checks and diffs a permissive policy, sets that policy, and restores the previous policy. If the previous policy was empty, it writes the same permissive default back. If those variables are unset, it prints a skip message and exits 0. It prints pass and fail lines only.
LIVE-CHECK.md says what the script covers. This session did not run it against a server.
What this is not
This is not a Tailscale.com or Tailscale SaaS client. Those hosts are rejected.
This is not a WireGuard or Tailscale node. It does not join a tailnet, ship DERP, or install tailscaled.
This is not a full replacement for the headscale CLI install path. Server bootstrap, config files, and database migrations stay on the host.
debug_create_node is not a supported way to enroll production devices. Use register or a pre-auth key for that, and treat the debug tool as test-only.
Compared with a small community server that exposes about 17 tools and no ACL actions, this connector covers the v0.29.6 Swagger, gates writes, and adds policy get, check, diff, and set.
Attribution
Headscale is BSD-3-Clause. This connector does not copy Headscale source. It calls the HTTP API described by the Swagger file in this repo.
License
MIT, see LICENSE. This is an independent, unofficial connector and is not endorsed by the Headscale project or its owners.
headscale.openapi.json is generated from juanfont/headscale (BSD-3-Clause, Copyright (c) 2020, Juan Font).
Available Tools
4 toolsheadscale_metaARead-only
headscale_meta calls the meta toolset on a self-hosted Headscale server (1 actions). Authorization is Bearer. Actions: health: GET /api/v1/health. Report database connectivity.
Inputs: action (required), body, query, params.
headscale_nodesADestructiveIdempotent
headscale_nodes calls the nodes toolset on a self-hosted Headscale server (9 actions). Authorization is Bearer. Writes need confirm set to the boolean true and HEADSCALE_ALLOW_WRITES=true. Omit confirm for a dry-run preview that does not send the write. Warnings: This rewrites node IP assignments and can disrupt existing nodes. This deletes a node and removes it from the tailnet. This expires a node and disconnects it. This registers a node and can admit a device onto the tailnet. This approves subnet routes and can expose those networks to the tailnet. This changes node tags and can change which networks the node can reach. Actions: backfill_node_ips: POST /api/v1/node/backfillips. Backfill node IP addresses. delete_node: DELETE /api/v1/node/{nodeId}. Delete a node. expire_node: POST /api/v1/node/{nodeId}/expire. Expire a node. get_node: GET /api/v1/node/{nodeId}. Get one node. Node key material is redacted. list_nodes: GET /api/v1/node. List nodes. Node key material is redacted. register_node: POST /api/v1/node/register. Register a node with a registration key. rename_node: POST /api/v1/node/{nodeId}/rename/{newName}. Rename a node. set_approved_routes: POST /api/v1/node/{nodeId}/approve_routes. Approve subnet routes for a node. set_tags: POST /api/v1/node/{nodeId}/tags. Set tags on a node.
Inputs: action (required), body, query, params, +1 more.
headscale_policyADestructiveIdempotent
headscale_policy calls the policy toolset on a self-hosted Headscale server (4 actions). Authorization is Bearer. Writes need confirm set to the boolean true and HEADSCALE_ALLOW_WRITES=true. Omit confirm for a dry-run preview that does not send the write. Warnings: A bad policy can lock all nodes out of the tailnet. Actions: check_policy: POST /api/v1/policy/check. Validate a policy. Headscale does not save it. diff: GET /api/v1/policy. Compare a proposed policy with the saved policy. Sends only the policy read. get_policy: GET /api/v1/policy. Get the current policy. set_policy: PUT /api/v1/policy. Replace the tailnet policy.
Inputs: action (required), body, query, params, +1 more.
headscale_usersADestructiveIdempotent
headscale_users calls the users toolset on a self-hosted Headscale server (4 actions). Authorization is Bearer. Writes need confirm set to the boolean true and HEADSCALE_ALLOW_WRITES=true. Omit confirm for a dry-run preview that does not send the write. Warnings: This deletes a user and the nodes and keys that belong to that user. Actions: create_user: POST /api/v1/user. Create a user. delete_user: DELETE /api/v1/user/{id}. Delete a user. list_users: GET /api/v1/user. List users. rename_user: POST /api/v1/user/{oldId}/rename/{newName}. Rename a user.
Inputs: action (required), body, query, params, +1 more.
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 map to clearly distinct domains: server health (meta), tailnet policy, nodes, and users. There is no overlap in resource or action scope, so an agent can select the correct toolset unambiguously.
All tools follow the same headscale_<resource> pattern with singular, predictable nouns (meta, policy, nodes, users). The convention is uniform across the entire surface.
Four resource-grouped tools cleanly encapsulate 18 underlying actions without bloating the top-level surface. Each tool earns its place, and the grouping mirrors the Headscale API structure.
Core areas (health, policy, nodes, users) are covered, but pre-auth key management is missing even though register_node requires a registration key, creating a workflow dead end. API key management is also absent, so the surface is not fully lifecycle-complete for Headscale administration.
Maintenance
Related MCP Connectors
Tailscale device, route, DNS, key, user, and ACL management over MCP and CLI.
Read devices, users, keys, ACLs and DNS for a tailnet; manage devices, routes and auth keys.
Manage cron/heartbeat checks, read pings and flips, pause/resume/delete on Healthchecks.io.
Manage ngrok from your agent: endpoints, domains, and traffic policy.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables administrators to manage Keycloak realms, users, roles, clients, groups, and more through its Admin REST API, with safe-by-default configuration and destructive operation confirmation.5677 npm3MIT
- AlicenseNot gradedqualityBmaintenanceEnables an MCP client to inspect and administer a Tailscale node through the local tailscale CLI and the wider tailnet through the control-plane REST API, exposing 186 read, write, and destructive tools plus resources, prompts, and completions. Tier and preset dials keep dangerous operations unlisted until explicitly enabled, and both surfaces degrade gracefully when the CLI or a credential is absent.20Apache 2.0
- AlicenseAqualityCmaintenanceEnables managing a self-hosted media library through its HTTP API, with scoped toolsets, confirm-gated writes, dry-run previews, and read caching. Supports libraries, items, collections, playlists, podcasts, sessions, stats, tags, genres, and administrative operations.13MIT
- AlicenseBqualityBmaintenanceEnables interaction with self-hosted Miniflux instances through the HTTP API, covering feeds, categories, entries, enclosures, icons, OPML, users, and API keys. Write operations are confirm-gated with dry-run previews and secret redaction.7MIT