跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Tailscale,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
AnythingMCP 已收录在 Claude 的连接器目录中:一键添加到 Claude (在新标签页中打开),然后登录并选择 Claude 可以使用哪些 MCP 服务器。
摘要
通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。
试试这样问
Tailscale 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Tailscale、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Tailscale + Claude
通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
TAILSCALE_OAUTH_CLIENT_ID, TAILSCALE_OAUTH_CLIENT_SECRET
步骤 1 — 获取凭证
设置大约需要 5 分钟,需要一位具有 Owner、Admin、Network admin 或 IT admin 角色的 tailnet 用户。连接器使用 Tailscale OAuth 客户端(OAuth2 客户端凭据)登录:没有浏览器登录,背后也没有用户账户。
- 打开 https://login.tailscale.com/admin/settings/trust-credentials(**Settings**、**Trust credentials**;旧版控制台:Settings、OAuth clients),点击 Credential,再点 OAuth。
- 选择 scope。只读时
all:read就够了。要使用写入工具,请添加对应的写入 scope:devices:core(需要一个或多个标签,例如tag:server)、devices:routes、users、auth_keys(同样需要标签)、policy_file、dns、feature_settings、webhooks。all授予全部权限。 - 把 Client ID(例如
kAbCdEf1CNTRL)复制到TAILSCALE_OAUTH_CLIENT_ID,把只显示一次的 Client secret(tskey-client-...)复制到TAILSCALE_OAUTH_CLIENT_SECRET。API 访问令牌(tskey-api-...)在这里不可用。 - 安装连接器并运行
tailscale_list_devices:它会列出 tailnet 中的设备并确认客户端可用。
连接器在 https://api.tailscale.com/api/v2/oauth/token 用客户端换取有效期一小时的访问令牌,并自动续期。API 访问令牌最长有效 90 天,而 OAuth 客户端不会过期。每次调用都发往拥有该客户端的 tailnet(路径中的 -)。客户端没有相应 scope 的写入会返回 403。
响应中的机密:AI 能看到工具返回的一切。tailscale_create_auth_key 返回新的认证密钥(tskey-auth-...),tailscale_create_webhook 返回 Webhook 签名密钥,二者都只显示这一次,并且都会进入对话和 AI 提供商。AI 只把它们交给提出请求的人,绝不传给其他工具、文件或消息。tailscale_list_user_invites 会显示邀请链接,任何拿到链接的人都能加入。tailscale_list_keys 和 tailscale_get_key 从不返回密钥值;tailscale_list_webhooks、tailscale_get_webhook 和 tailscale_get_log_streaming_configuration 中的签名密钥、令牌和云凭据都已移除。
设备:tailscale_list_devices 可用 filter 筛选(例如 hostname=web-1、tags=tag:prod、authorized=false),fields=all 会加上路由和连接信息;另有 tailscale_get_device、tailscale_get_device_routes 和 tailscale_get_device_posture_attributes。修改:tailscale_authorize_device(审批设备或撤回审批)、tailscale_set_device_routes(批准子网路由和出口节点)、tailscale_set_device_tags、tailscale_set_device_name(新名称立即成为 MagicDNS 名称)和 tailscale_set_device_key_expiry(关闭密钥过期,适合服务器而非笔记本)。
用户:按角色或类型列出的 tailscale_list_users、tailscale_get_user、tailscale_list_user_invites;tailscale_update_user_role、tailscale_approve_user,以及 tailscale_suspend_user 和 tailscale_restore_user(暂停可通过恢复撤销)。
密钥:tailscale_list_keys(all=true 会加上认证密钥和 API 访问令牌)、tailscale_get_key,以及用于添加服务器、容器或 CI runner 的 tailscale_create_auth_key:可重复使用或一次性、临时(ephemeral)、预授权,最长有效 90 天。使用本连接器的 OAuth 客户端时,密钥必须带标签,即客户端自己的标签或它们所拥有的标签。
访问规则:tailscale_get_policy_file 读取策略文件(grants 和 acls、groups、hosts、tagOwners、autoApprovers、ssh、nodeAttrs、postures、tests)及其 etag。tailscale_preview_policy_rules 显示哪些规则作用于某个用户或某个 IP:端口,tailscale_validate_policy_file 检查草稿并运行其中的测试;二者都不会做任何更改。
DNS 和设置:tailscale_get_dns_configuration 一次显示域名服务器、split DNS、搜索域和 MagicDNS。修改通过 tailscale_set_dns_nameservers、tailscale_set_dns_preferences(开启或关闭 MagicDNS;开启需要全局域名服务器)、tailscale_set_dns_search_paths 和 tailscale_update_split_dns(只修改传入的域名)完成。tailscale_get_tailnet_settings 和 tailscale_update_tailnet_settings 涵盖设备和用户审批、密钥过期、自动更新、网络流日志、HTTPS 证书等;tailscale_get_contacts 显示账户、支持和安全联系人。
日志和集成:tailscale_list_configuration_audit_logs(谁改了什么,保留 90 天,可按操作者、目标或事件筛选)、tailscale_list_network_flow_logs(设备之间的流量,适用于开启了流日志的 Premium 和 Enterprise 套餐;由于响应增长很快,AI 按分钟而不是按天查询)、用于向 SIEM 流式传输的 tailscale_get_log_streaming_status 和 tailscale_get_log_streaming_configuration、Webhook(tailscale_list_webhooks、tailscale_get_webhook、tailscale_create_webhook)、Tailscale Services(tailscale_list_services、tailscale_get_service、tailscale_list_service_hosts)以及 posture 集成(tailscale_list_posture_integrations)。
修改会替换整个列表:路由、标签、域名服务器和搜索域都以完整列表发送。AI 会先读取当前值,再发送原有条目加上新条目;被遗漏的路由会被禁用。
安装时关闭:tailscale_expire_device_key、tailscale_delete_device、tailscale_delete_user 和 tailscale_delete_key 无法撤销;tailscale_set_policy_file 会在一次调用中替换 tailnet 的整个访问策略,一条错误规则就会把用户和设备挡在外面。由工作区管理员在团队需要时有意开启。
数据格式:设备的 nodeId(例如 nAbCdEf1CNTRL)是首选的设备 id,数字 id 也可以用。name 是 MagicDNS 名称(web-1.tailnet-name.ts.net),addresses 是 Tailscale IP(100.x.y.z 和 fd7a:115c:a1e0::/48)。时间为 UTC 的 RFC 3339 格式;设备在线时(connectedToControl: true)lastSeen 为空。expires 为 0001-01-01 表示密钥过期已关闭。标签形如 tag:name。
分页:列表在一次响应中返回,不分页。日志工具改为接受 start 和 end 时间。
常见错误:401 表示 OAuth 客户端已被删除或密钥错误。403 表示客户端缺少此调用所需的 scope 或标签,或套餐不包含该功能。404 表示该 id 在此 tailnet 中不存在。400 表示输入无效,并附有 message,包括测试未通过的策略文件。412 表示策略在你获取 etag 之后已被修改。429 表示触发速率限制:等一分钟再重试。
连接器不会创建 OAuth 客户端或 API 访问令牌,不会通告路由或让设备登录(这些在设备上完成);使用安装时开启的工具,它不会删除设备、用户或密钥,也不会替换策略文件。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Claude 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
推荐路径:在 claude.ai web 上工作,无需触碰任何配置文件。
- 在 Claude 中打开 Customize → Connectors。
- 点击 +,然后点击 Add custom connector。
- 输入名称(例如
Tailscale)和远程 MCP 服务器 URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,然后点击 Add。 - 点击 Connect,登录 AnythingMCP(OAuth)并允许访问。
下面所有工具都会出现在你的聊天中,开始输入提示。
可用工具
| Tool | What it does |
|---|---|
tailscale_list_devices | List the devices (machines) of the tailnet: nodeId, numeric id, name (MagicDNS name), hostname, user, OS, client version, Tailscale IP… |
tailscale_get_device | One device with its details: name, hostname, user, OS, addresses, tags, authorized, key expiry, lastSeen, connectedToControl and, with… |
tailscale_get_device_routes | The subnet routes a device advertises (advertisedRoutes) and the ones that are approved for it (enabledRoutes) |
tailscale_set_device_routes | Replace the list of approved (enabled) subnet routes of a device |
tailscale_authorize_device | Approve a device that waits for device approval (authorized=true), or take the approval back (authorized=false), which cuts it off from the… |
tailscale_set_device_name | Rename a device: the new name becomes its MagicDNS name at once, so links and scripts that use the old name stop working |
tailscale_set_device_tags | Replace the tags of a device |
tailscale_set_device_key_expiry | Switch key expiry off (key_expiry_disabled=true) or back on for a device |
tailscale_expire_device_key | Expire the node key of a device now |
tailscale_delete_device | Remove a device from the tailnet |
tailscale_get_device_posture_attributes | The posture attributes of a device as key-value pairs: those Tailscale collects (node:os, node:tsVersion, ...), those from posture… |
tailscale_list_users | List the users of the tailnet: id, displayName, loginName (e-mail), role, status (active, idle, suspended, needs-approval… |
tailscale_get_user | One user: displayName, loginName, role, status, type, created, lastSeen, deviceCount |
tailscale_update_user_role | Change the role of a user |
tailscale_approve_user | Approve a user whose status is needs-approval (when user approval is on in the tailnet settings) |
tailscale_suspend_user | Suspend a user: their devices lose access to the tailnet until the user is restored with tailscale_restore_user |
tailscale_restore_user | Restore a suspended user, giving their devices access to the tailnet again |
tailscale_delete_user | Delete a user from the tailnet, together with their devices |
tailscale_list_user_invites | Open (not yet accepted) invitations to join the tailnet: id, e-mail, role, inviter and when the e-mail was last sent. inviteUrl lets… |
tailscale_list_keys | List the keys of the tailnet: auth keys, API access tokens, OAuth clients and federated identities, with id, keyType, description, created… |
tailscale_get_key | One key by id: keyType, description, created, expires, revoked, invalid, capabilities (reusable, ephemeral, preauthorized, tags for auth… |
tailscale_create_auth_key | Create an auth key to add devices to the tailnet |
tailscale_delete_key | Revoke a key by id: an auth key, an API access token or a trust credential |
tailscale_get_policy_file | The tailnet policy file (access rules) as JSON: grants and acls, groups, hosts, tagOwners, autoApprovers, ssh, nodeAttrs, postures and… |
tailscale_validate_policy_file | Check a policy file without saving it: Tailscale parses it and runs its tests (and sshTests) |
tailscale_preview_policy_rules | Which rules of a policy file would apply to one user or one IP:port, without saving it |
tailscale_set_policy_file | Replace the whole tailnet policy file |
tailscale_get_dns_configuration | The full DNS setup of the tailnet in one call: global nameservers, split DNS routes (domain to nameservers), search paths and preferences… |
tailscale_set_dns_nameservers | Replace the global DNS nameservers of the tailnet |
tailscale_set_dns_preferences | Switch MagicDNS on or off for the tailnet |
tailscale_set_dns_search_paths | Replace the DNS search domains of the tailnet |
tailscale_update_split_dns | Change split DNS for some domains: only the domains you pass are changed, the others stay |
tailscale_get_tailnet_settings | The tailnet settings: device approval, device auto-updates, key expiry in days, user approval, who may join external tailnets, network flow… |
tailscale_update_tailnet_settings | Change one or more tailnet settings; fields you leave out keep their value |
tailscale_get_contacts | The account, support and security contact e-mails of the tailnet, each with its fallback and whether it still needs verification |
tailscale_list_configuration_audit_logs | Configuration audit log: who changed what in the tailnet (devices, users, keys, policy file, DNS, settings) between start and end, in time… |
tailscale_list_network_flow_logs | Network flow logs between start and end: which devices talked to which addresses and ports, with packet and byte counts per sample period… |
tailscale_get_log_streaming_status | Whether streaming of a log type to a SIEM works: last activity, last error, bytes and entries sent, rate |
tailscale_get_log_streaming_configuration | Where a log type is streamed: destination type (splunk, elastic, datadog, s3, ...), URL, upload period, compression, S3 bucket and region |
tailscale_list_webhooks | The webhook endpoints of the tailnet: endpointId, URL, provider type, the events they receive and who created them |
tailscale_get_webhook | One webhook endpoint by id: URL, provider type, subscribed events, creator, created and lastModified |
tailscale_create_webhook | Create a webhook that sends tailnet events to a URL |
tailscale_list_services | Tailscale Services of the tailnet (virtual services hosted by one or more devices): name (svc:...), addresses, ports, tags and comment |
tailscale_get_service | One Tailscale Service by name: its addresses, ports, tags and comment |
tailscale_list_service_hosts | The devices that host a Tailscale Service, with whether each one is approved to serve it |
tailscale_list_posture_integrations | The device posture integrations of the tailnet (CrowdStrike Falcon, Intune, Jamf Pro, Kandji, Kolide, SentinelOne): provider, cloud id… |
示例提示
- “哪些设备超过 30 天没有上线?显示名称、用户和最后在线时间。”
- “router-1 通告了哪些子网路由,其中哪些还没有批准?”
- “创建一个带标签 tag:ci、7 天后过期、可重复使用且预授权的认证密钥。”
- “上周是谁修改了策略文件或 DNS 设置?”
- “我们策略文件中的哪些规则适用于 [email protected]?”
FAQ
Claude Code 和 Claude Desktop 一样工作吗? 是的,两者都指向 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。
下一步
这份指南对你有帮助吗?