连接器指南阅读约 8 分钟46 个 MCP 工具7 种语言

如何通过 MCP 将 Tailscale 连接到 ChatGPT

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

HC作者:HelpCode 团队更新于 8 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Tailscale

Tailscale

Tailscale tailnet administration through the API v2: devices with routes, tags, approval and posture attributes, users and roles, auth keys, the policy file (read, validate, preview, replace), DNS and MagicDNS, tailnet settings, configuration audit logs and network flow logs, log streaming, webhooks, Services and posture integrations. Signs in with an OAuth client.

个工具

46

区域

INTL

类别

基础设施

身份验证

OAuth 2.0

所需环境变量

TAILSCALE_OAUTH_CLIENT_IDTAILSCALE_OAUTH_CLIENT_SECRET
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 Tailscale,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

试试这样问

Tailscale 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Tailscale · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Tailscale、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Tailscale + ChatGPT

通过 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 客户端凭据)登录:没有浏览器登录,背后也没有用户账户。

  1. 打开 https://login.tailscale.com/admin/settings/trust-credentials(**Settings**、**Trust credentials**;旧版控制台:Settings、OAuth clients),点击 Credential,再点 OAuth。
  2. 选择 scope。只读时 all:read 就够了。要使用写入工具,请添加对应的写入 scope:devices:core(需要一个或多个标签,例如 tag:server)、devices:routes、users、auth_keys(同样需要标签)、policy_file、dns、feature_settings、webhooks。all 授予全部权限。
  3. 把 Client ID(例如 kAbCdEf1CNTRL)复制到 TAILSCALE_OAUTH_CLIENT_ID,把只显示一次的 Client secret(tskey-client-...)复制到 TAILSCALE_OAUTH_CLIENT_SECRET。API 访问令牌(tskey-api-...)在这里不可用。
  4. 安装连接器并运行 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 — 在 ChatGPT 中添加连接器

你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(https://cloud.anythingmcp.com/mcp/…)。本指南中出现 YOUR_SERVER_ID 的地方都用它替换。

ChatGPT 在网页版的 Plugins 页面把 MCP 服务器添加为插件,仅付费套餐可用,不再需要开发者模式。在 Business 工作区中只有管理员和所有者可以添加;在 Enterprise 和 Edu 中,管理员可以授予 Create plugins with MCPs 权限。

  1. 前往 chatgpt.com/plugins,点击 Add,然后选择 Add custom MCP server。
  2. 填写名称,例如 Name: Tailscale。
  3. 在 Connection 下的 Server URL 中填入 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,Authentication 保持为 OAuth。
  4. 选择 I understand and want to continue,然后点击 Create as a plugin。ChatGPT 提示时,登录 AnythingMCP 并允许访问。
  5. 在个人插件中安装这个新插件,然后在对话中输入 @ 并选择它。

可用工具

ToolWhat it does
tailscale_list_devicesList the devices (machines) of the tailnet: nodeId, numeric id, name (MagicDNS name), hostname, user, OS, client version, Tailscale IP…
tailscale_get_deviceOne device with its details: name, hostname, user, OS, addresses, tags, authorized, key expiry, lastSeen, connectedToControl and, with…
tailscale_get_device_routesThe subnet routes a device advertises (advertisedRoutes) and the ones that are approved for it (enabledRoutes)
tailscale_set_device_routesReplace the list of approved (enabled) subnet routes of a device
tailscale_authorize_deviceApprove 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_nameRename 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_tagsReplace the tags of a device
tailscale_set_device_key_expirySwitch key expiry off (key_expiry_disabled=true) or back on for a device
tailscale_expire_device_keyExpire the node key of a device now
tailscale_delete_deviceRemove a device from the tailnet
tailscale_get_device_posture_attributesThe posture attributes of a device as key-value pairs: those Tailscale collects (node:os, node:tsVersion, ...), those from posture…
tailscale_list_usersList the users of the tailnet: id, displayName, loginName (e-mail), role, status (active, idle, suspended, needs-approval…
tailscale_get_userOne user: displayName, loginName, role, status, type, created, lastSeen, deviceCount
tailscale_update_user_roleChange the role of a user
tailscale_approve_userApprove a user whose status is needs-approval (when user approval is on in the tailnet settings)
tailscale_suspend_userSuspend a user: their devices lose access to the tailnet until the user is restored with tailscale_restore_user
tailscale_restore_userRestore a suspended user, giving their devices access to the tailnet again
tailscale_delete_userDelete a user from the tailnet, together with their devices
tailscale_list_user_invitesOpen (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_keysList the keys of the tailnet: auth keys, API access tokens, OAuth clients and federated identities, with id, keyType, description, created…
tailscale_get_keyOne key by id: keyType, description, created, expires, revoked, invalid, capabilities (reusable, ephemeral, preauthorized, tags for auth…
tailscale_create_auth_keyCreate an auth key to add devices to the tailnet
tailscale_delete_keyRevoke a key by id: an auth key, an API access token or a trust credential
tailscale_get_policy_fileThe tailnet policy file (access rules) as JSON: grants and acls, groups, hosts, tagOwners, autoApprovers, ssh, nodeAttrs, postures and…
tailscale_validate_policy_fileCheck a policy file without saving it: Tailscale parses it and runs its tests (and sshTests)
tailscale_preview_policy_rulesWhich rules of a policy file would apply to one user or one IP:port, without saving it
tailscale_set_policy_fileReplace the whole tailnet policy file
tailscale_get_dns_configurationThe full DNS setup of the tailnet in one call: global nameservers, split DNS routes (domain to nameservers), search paths and preferences…
tailscale_set_dns_nameserversReplace the global DNS nameservers of the tailnet
tailscale_set_dns_preferencesSwitch MagicDNS on or off for the tailnet
tailscale_set_dns_search_pathsReplace the DNS search domains of the tailnet
tailscale_update_split_dnsChange split DNS for some domains: only the domains you pass are changed, the others stay
tailscale_get_tailnet_settingsThe tailnet settings: device approval, device auto-updates, key expiry in days, user approval, who may join external tailnets, network flow…
tailscale_update_tailnet_settingsChange one or more tailnet settings; fields you leave out keep their value
tailscale_get_contactsThe account, support and security contact e-mails of the tailnet, each with its fallback and whether it still needs verification
tailscale_list_configuration_audit_logsConfiguration 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_logsNetwork 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_statusWhether streaming of a log type to a SIEM works: last activity, last error, bytes and entries sent, rate
tailscale_get_log_streaming_configurationWhere a log type is streamed: destination type (splunk, elastic, datadog, s3, ...), URL, upload period, compression, S3 bucket and region
tailscale_list_webhooksThe webhook endpoints of the tailnet: endpointId, URL, provider type, the events they receive and who created them
tailscale_get_webhookOne webhook endpoint by id: URL, provider type, subscribed events, creator, created and lastModified
tailscale_create_webhookCreate a webhook that sends tailnet events to a URL
tailscale_list_servicesTailscale Services of the tailnet (virtual services hosted by one or more devices): name (svc:...), addresses, ports, tags and comment
tailscale_get_serviceOne Tailscale Service by name: its addresses, ports, tags and comment
tailscale_list_service_hostsThe devices that host a Tailscale Service, with whether each one is approved to serve it
tailscale_list_posture_integrationsThe 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

ChatGPT 免费套餐能用自定义 MCP 服务器吗? OpenAI 只为付费套餐提供自定义 MCP 服务器的说明,Free 套餐不在其列。

下一步

这份指南对你有帮助吗?

你的 Tailscale 智能体只差一次点击。

安装连接器,粘贴密钥,向 ChatGPT 提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 Tailscale 连接到 Claude

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

连接器

如何通过 MCP 将 Tailscale 连接到 Cursor

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

连接器

如何通过 MCP 将 Tailscale 连接到 Gemini

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

连接器

如何通过 MCP 将 Tailscale 连接到 Meta Muse

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

连接器

Tailscale 接入 MCP:在任意 AI 智能体中管理设备、用户、认证密钥、访问策略、DNS 和审计日志

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。

连接器

如何通过 MCP 将 Tailscale 连接到 Microsoft Copilot

通过 API v2 管理 Tailscale tailnet:带路由、标签、审批和 posture 属性的设备,用户和角色,认证密钥,策略文件(读取、校验、预览),DNS 和 MagicDNS,tailnet 设置,配置审计日志和网络流日志,日志流式传输,Webhook,Services 和 posture 集成。使用 OAuth 客户端登录,无需浏览器登录。