内容
# mcp-tailscale
**MCP 服务器封装 Tailscale CLI** — 从任何支持 MCP 的 AI 代理(Hermes、Claude Code 等)管理设备、提供配置和诊断连接。
## 工具列表
| 工具 | 描述 |
|------|-------------|
| `list_devices` | 所有对等体的状态、操作系统、IP地址、连接类型、流量 |
| `device_info` | 关于自身或特定对等体的详细信息 |
| `netcheck` | NAT/连接诊断 + DERP 中继延迟 |
| `serve_list` | 当前 Tailscale Serve / Funnel 配置 |
| `serve_add` | 通过 Tailscale 公开本地端口(tcp/http/https) |
| `serve_remove` | 删除 Tailscale Serve 配置 |
| `ping` | 通过 Tailscale ping 对等体并显示路由 |
| `whois` | 机器和用户位于 Tailscale IP 后 |
## 快速开始
```bash
pip install mcp-tailscale
# 或
pip install git+https://github.com/gumbyender/mcp-tailscale.git
```
然后在您的 MCP 客户端中配置:
### Hermes 代理
添加到 `~/.hermes/config.yaml`:
```yaml
mcp_servers:
tailscale:
command: "mcp-tailscale"
```
重启 Hermes。工具显示为 `mcp_tailscale_*`。
### Claude 桌面
```json
{
"mcpServers": {
"tailscale": {
"command": "mcp-tailscale"
}
}
}
```
### VS Code / Cline / Continue
```json
{
"mcpServers": {
"tailscale": {
"command": "mcp-tailscale"
}
}
}
```
## 要求
- **Tailscale** — 已安装并登录(`tailscale status` 必须有效)
- **Python 3.11+**
- **mcp** 包(自动作为依赖项安装)
## 开发
```bash
git clone https://github.com/gumbyender/mcp-tailscale.git
cd mcp-tailscale
pip install -e .
```
测试服务器是否正确启动:
```bash
mcp-tailscale
# 或
python -m mcp_tailscale
```
服务器将开始监听标准输入 — 将您的 MCP 客户端连接到它。
## 配套技能
此仓库中的 `SKILL.md` 是适用于 Hermes 的 "使用 Tailscale 和自托管代理的安全家庭实验室联网" 技能。要在 Hermes 中安装它:
```bash
hermes skill create --from SKILL.md
```
或将其复制到 `~/.hermes/skills/devops/tailscale-mcp/SKILL.md`。
## 架构
```
┌─────────────┐ 标准输入 ┌──────────────┐ 子进程 ┌──────────┐
│ MCP 客户端 │ ◄──────────► │ mcp-tailscale │ ◄──────────────► │ tailscale │
│ (Hermes、 │ │ (FastMCP) │ │ CLI │
│ Claude、...)│ │ │ │ │
└─────────────┘ └──────────────┘ └──────────┘
```
所有调用都是围绕 `tailscale` 二进制文件的本地子进程包装器。无需外部 API 密钥,无需云依赖。
## 许可证
MIT