Skip to main content
Glama
tailnet-agent-mcp
by MC-intel

tailnet-agent-mcp

MCP servers that let an AI assistant work with devices on Tailscale tailnets: list them, ping them, probe their ports and web services, and (only where a human has allowed it) run a command or copy a file. Two servers share one safety model:

Server

Entry point

Scope

tailnet-agent-mcp

tailnet_agent_mcp

The machine's one active Tailscale profile

multi-tailnet

tailnet_agent_mcp.multi

Several tailnets at once, one userspace tailscaled each, no profile switching

Why it exists

I use one workstation against more than one tailnet (personal, a lab, and at one point an employer's), and Tailscale lets only one profile be active on a machine's daemon. Two problems came out of that:

  1. Switching the active profile silently broke things. A health-check job that reached hosts over the active tailnet went blind the moment the profile was switched for something unrelated. So the first server checks the active profile before every call and refuses, printing the exact switch command for a human to run. It never switches by itself.

  2. I wanted the assistant to reach several tailnets without any switching. The second server runs one userspace tailscaled per tailnet as a systemd user unit (own socket, own state directory, local SOCKS5 port). It needs no root and never touches the system daemon or its active profile.

Related MCP server: @yawlabs/tailscale-mcp

Tools

Tool

What it does

Access

tailnets / tailnet_up / tailnet_down

(multi) which tailnets are configured and running; start or stop a node

tailnet_up returns a login URL a human must approve the first time

tailnet_status / fleet_status

all devices: IP, OS, tags, online, direct vs relay

read-only

device_info

one device in detail: OS, versions, key expiry, routes, traffic

read-only

ping_device

path (direct or relay) and latency

read-only

check_ports

TCP connect check of a port list

read-only

http_probe

GET a service: status, headers, title, TLS certificate summary

read-only

tailscale_health

local profile, health warnings, netcheck

read-only

access_config

show per-device access settings

read-only

run_command, push_file, pull_file

ssh / scp to a device

needs exec = true and an ssh_user

Safety model

All of this is covered by offline tests in tests/test_config_and_gate.py.

  • Remote execution is off by default and gated per device, by a human. A device needs both exec = true and an explicit ssh_user in the config file. ssh_user alone is not enough (tested). The assistant is instructed never to edit that file or guess usernames; when access is missing, the error tells it exactly what to ask the user for.

  • One choke point. run_command, push_file and pull_file all go through a single _access() function, so the gate cannot be bypassed by one tool forgetting to check.

  • ssh runs in BatchMode (never prompts), with its own known_hosts file, and through a ProxyCommand that uses that tailnet's own daemon socket. No credentials are stored: auth is the Tailscale SSH identity or your normal keys.

  • Wrong-tailnet guard. Each tailnet's expected name is configured; a node that logged in somewhere else is refused.

  • Offline devices are refused even when enabled, with when they were last seen.

  • Config is re-read on every call, so the human can open or close the gate without restarting the server.

  • Tailscale SSH "check" mode is handled: the tool returns the approval URL immediately instead of hanging.

Run it

cp config.example.toml ~/.config/tailnet-agent-mcp/config.toml          # single-profile server
cp config.multi.example.toml ~/.config/multi-tailnet/config.toml        # multi-tailnet server
uv run python tests/smoke.py my-laptop                                  # exercise the read-only tools
# register with your MCP client: command = `uv --directory <repo> run tailnet-agent-mcp` (or `multi-tailnet`)

Python >= 3.12, the mcp SDK, and the tailscale CLI. The multi-tailnet server needs tailscaled available for userspace nodes.

Tests

PYTHONPATH=src python -m unittest discover -s tests -p 'test_*.py'    # 10 offline tests

tests/smoke*.py are live checks against a real tailnet and are not run by the unit-test command.

Available Tools

10 tools
access_configA
Read-only

Show the config file path and per-device access settings (no secrets are stored there - auth is Tailscale SSH identity or your SSH keys).

Inputs: no named parameters. Returns: result

check_portsB
Read-only

TCP-connect check for ports on a device (default: a common set - ssh, http(s), smb, rdp, vnc, winrm, databases...). Reports open / closed / filtered.

Inputs: device (required), ports, timeout_s. Returns: result

device_infoA
Read-only

Full details for one device (hostname, MagicDNS name or tailnet IP): addresses, OS, owner/tags, online state, endpoints, key expiry, traffic, Tailscale SSH, and this server's configured access for it.

Inputs: device (required). Returns: result

http_probeB
Read-only

HTTP GET a web service on a device; returns status, key headers, page , TLS certificate subject/issuer/expiry (for https) and the start of the body. Read-only.

Inputs: device (required), path, port, scheme, +2 more. Returns: result

ping_deviceA
Read-only

Tailscale-level ping (works even if the device firewalls ICMP). Shows whether the path is direct or via a DERP relay and the latency.

Inputs: device (required), count. Returns: result

pull_fileB
Destructive

Copy a file or directory from a device to this machine (scp -r). Requires exec=true.

Inputs: device (required), local_path (required), remote_path (required), timeout_s. Returns: result

push_fileB
Destructive

Copy a local file or directory to a device (scp -r). Requires exec=true.

Inputs: device (required), local_path (required), remote_path (required), timeout_s. Returns: result

run_commandB
Destructive

Run a shell command on a device over SSH as its configured ssh_user. Requires exec=true for the device in the config. Windows devices need OpenSSH server enabled.

Inputs: device (required), command (required), timeout_s. Returns: result

tailnet_statusB
Read-only

List devices on the tailnet: name, IP, OS, owner, online/last seen, connection path, Tailscale SSH availability and whether this server has exec access configured.

Inputs: include_offline. Returns: result

tailscale_healthA
Read-only

This machine's Tailscale state: active profile/tailnet, own IPs, health warnings, and a netcheck (NAT type, UDP, nearest DERP relays).

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools target a distinct action+resource (ping vs port check vs HTTP probe vs file transfer) and descriptions clarify the boundaries. Minor overlap: tailnet_status (tailnet-wide listing) vs tailscale_health (local node state) vs device_info (single device) could be momentarily confused, and access info appears in both device_info and access_config.

    Naming Consistency3/5

    All names are snake_case, which helps, but the conventions are mixed: verb_noun forms (ping_device, check_ports, run_command, push_file, pull_file) sit alongside noun phrases (tailnet_status, device_info, tailscale_health, access_config) and an ambiguous 'http_probe'.

    Tool Count5/5

    Ten tools is well within the sweet spot and each one maps to a clear, non-redundant capability: discovery, inspection, connectivity, port/web probing, health, exec, and file transfer. Nothing feels padded or missing from a count perspective.

    Completeness4/5

    Covers the practical lifecycle for a tailnet agent: enumerate devices, inspect one, test reachability at ICMP/TCP/HTTP layers, check local health/netcheck, and perform remote exec and file copy with a config introspection tool. Gaps are minor — no tailnet administration (key expiry reauth, node removal, ACL/DNS inspection) and no traceroute or DNS resolution check, but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers