tailnet-mcp
Embeds a Tailscale node using tsnet to join a tailnet as a tagged device and bridges stdio MCP traffic to a Streamable HTTP MCP server exposed through tailscale serve, keeping the MCP server off the public internet.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
tailnet-mcp
A stdio MCP server that forwards everything to a Streamable HTTP MCP server inside your tailnet.
Hosted agents (Grok, cloud coding agents, sandboxed assistants) usually take MCP servers two ways. By URL: the vendor's servers connect, so your server has to be on the public internet. By command: the agent starts a process on its own computer, but that computer is not in your tailnet and you can't run tailscaled there (no root, no TUN). tailnet-mcp is the command: it embeds a Tailscale node (tsnet), joins your tailnet as a tagged device and bridges stdio to the server. Your server stays behind tailscale serve, never on the internet.
agent ──stdio──▶ tailnet-mcp (tag:agent) ══tailnet══▶ tailscale serve ──▶ MCP server on 127.0.0.1Install
Download a static binary for linux or darwin, amd64 or arm64, from Releases and check it against SHA256SUMS. Or build it yourself:
CGO_ENABLED=0 go install github.com/zedong-peng/tailnet-mcp@latestOr run the image ghcr.io/zedong-peng/tailnet-mcp with a volume on /home/nonroot/.local/state/tailnet-mcp. It is also listed in the MCP Registry as io.github.zedong-peng/tailnet-mcp.
Related MCP server: tailscale-rmcp
Use
Publish the server to the tailnet only, on a path nobody can guess:
tailscale serve --bg --https=8443 --set-path=/$(openssl rand -hex 16) http://127.0.0.1:8080/mcpMint a one-time, pre-authorized auth key with a tag for the agent (admin console, or the API), and log in once from the agent's computer:
TS_AUTHKEY=tskey-auth-... tailnet-mcp -hostname my-agent -url https://server.tailnet.ts.net:8443/<path> -check-checkconnects, prints the server's tools on stderr and exits. The node key is kept in-state(default~/.local/state/tailnet-mcp/<hostname>); keep it on persistent storage. Tagged nodes don't expire, so the key is not needed again.Register the same command, without the key, as the agent's MCP server:
tailnet-mcp -hostname my-agent -url https://server.tailnet.ts.net:8443/<path>
Each process is its own tailnet node. For a second server, run a second process with a different -hostname.
Lock it down
The agent reads untrusted input (web pages, mail), so assume it can be talked into anything its tools allow. Three layers, none of which rely on the agent behaving:
Network. Give the tag one grant to the ports it needs and nothing else:
"grants": [ {"src": ["tag:my-agent"], "dst": ["server"], "ip": ["tcp:8443"]}, ], "tests": [ {"src": "tag:my-agent", "accept": ["server:8443"], "deny": ["server:22", "server:443"]}, ],Grants that allow everything (
"src": ["autogroup:member"], "dst": ["*"]) don't cover tagged devices, so that one grant is all the tag gets.Path.
tailscale serve --set-pathanswers only on the secret path; any other path on the port is a 404. Other devices in the tailnet can't use the server by guessing the port.Server. Enforce permissions where the data lives, not in the agent: a mail server that can only save drafts, a password vault account that is a view-only member of one shared collection. examples/private-tools sets up both.
Behaviour
Before the first request it pings the server's node until it answers. Right after a restart the server may still hold a stale path to the node, and the first dial would time out.
Only requests that never reached the server are retried, so a tool call is never sent twice.
When the server restarts and forgets the session (404, or a 400 about the session), the bridge replays
initializeand resends the request. The client doesn't notice.A failed request comes back as a JSON-RPC error with the reason, so the client never waits for an answer that won't come.
On EOF it ends the session with
DELETE. Logs go to stderr; stdout carries only MCP frames.-vadds tsnet's own logs.
Not supported: the optional GET stream that lets a server send messages outside a response. Servers answer each request in its own response, as almost all tool servers do.
Compared with
mcp-remoteand other stdio-to-HTTP bridges need a network path to the server. In an agent's sandbox that means a public URL.tailscale upin the sandbox needs root and a TUN device. If someone logs in as a user instead of with a tagged key, the sandbox gets that user's access to the whole tailnet.Tailscale Aperture is a gateway on the server side: it aggregates HTTP MCP servers and grants tools per user. It doesn't get a sandboxed agent into the tailnet, so the two fit together.
Build and test
go test -race ./...
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" .Tagging v* publishes the four binaries, the image and the registry entry.
This server cannot be deployed
Maintenance
Related MCP Connectors
Tailscale device, route, DNS, key, user, and ACL management over MCP and CLI.
MCP server for Superserve sandboxes: create, exec, and manage Firecracker microVMs
Toolstile is a managed MCP gateway that connects remote MCP servers behind one endpoint, with per-agent permissions, shared accounts and activity logs. Connect at https://mcp.toolstile.com/mcp over Streamable HTTP with OAuth; sign in at https://toolstile.com, select a workspace and connect your upstream servers. Available tools, resources and prompts depend on that workspace and the agent's granted access.
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server for safe programmatic access to the local Tailscale daemon: tailnet discovery, SSH config generation, port sharing via Serve/Funnel, and latency matrices.6902 npm1Creative Commons Attribution Non Commercial No Derivatives 4.0 International
- AlicenseNot gradedqualityCmaintenanceMCP server and CLI for Tailscale that lets agents inspect and manage tailnet devices, routes, users, keys, DNS, and ACL policy over stdio or streamable HTTP.5AGPL 3.0
- FlicenseNot gradedqualityCmaintenanceA local stdio MCP server that bridges remote Streamable HTTP MCP servers to MCP clients, enabling transport normalization and optional outbound HTTP proxy support for restricted networks.-
- AlicenseNot gradedqualityCmaintenanceA fail-closed policy boundary that translates local stdio MCP clients to authenticated Streamable HTTP servers, enforcing allowlists or read-only modes and redacting credentials from audit trails.Apache 2.0