跳到主要内容

TinyShield MCP 服务器:连接 AI Agent

借助 TinyShield 的 MCP 服务器,Claude Code、Codex 和 Cursor 等 AI Agent 可以直接使用 TinyShield。Agent 能查看哪些 App 连接到哪里、处理连接审批请求,并管理 Block List、Allow List 和连接模式,全部用日常语言完成。

MCP 和命令行是 TinyShield PRO 功能。

Claude Code 询问 TinyShield 一个天气 App 连接到哪里,然后阻止它的两个跟踪器。

1. 优势​

  • ✅ 询问某个 App、域名或 IP 地址连接了哪里,以及用了多少流量。
  • ✅ 无人值守的任务不再卡住:在 Require Approval 模式下,Agent 能看到哪些工具正在等待审批,并允许你让它运行的工具,不会因连接超时而失败。
  • ✅ 用一句提示管理 Block List、Allow List、决定和连接模式。
  • ✅ 改动有据可查:Agent 做出的每个决定都会在 TinyShield 的 Decisions 列表中标注 Agent 的名称。
  • ✅ 仅限本地:服务器只在这台 Mac 上监听,需要访问令牌,并且在你开启之前一直处于关闭状态。

2. 开启 MCP 服务器​

  1. 打开 TinyShield › Settings › MCP。
  2. 勾选 Enable MCP & Command Line。状态会显示 Running on 127.0.0.1。

Settings › MCP 还会显示适用于你的 Agent 的设置命令、命令行别名、记录 Agent 和脚本每次调用的 Recent Activity 列表,以及 Regenerate Access Token。

3. 将 TinyShield 添加到 Agent​

请使用你正在运行的 TinyShield App 的路径。如果使用 Setapp 版,请将 /Applications/Tiny Shield.app 替换为 /Applications/Setapp/Tiny Shield.app。

Claude Code​

claude mcp add --scope user tinyshield -- "/Applications/Tiny Shield.app/Contents/MacOS/tinyshield-mcp"

Codex​

codex mcp add tinyshield -- "/Applications/Tiny Shield.app/Contents/MacOS/tinyshield-mcp"

Cursor 和其他 MCP 客户端​

{
"mcpServers": {
"tinyshield": {
"command": "/Applications/Tiny Shield.app/Contents/MacOS/tinyshield-mcp"
}
}
}

启动 Agent 不会打开 TinyShield。Agent 第一次使用 TinyShield 的工具时,TinyShield 才会在后台启动,不显示任何窗口。

4. 提示示例​

  • forecast 在连接哪里?把跟踪器阻止掉。
  • 我的构建下载不了软件包,是 TinyShield 拦住了吗?
  • 允许这次构建中正在等待审批的工具。
  • 今天有哪些 App 连接了新的国家?
  • 列出 Chrome 在过去一小时内连接过的所有地址。
  • Safari 这周用了多少流量?
  • 切换到 Require Approval,并关闭 DNS 例外。

5. 可用工具​

类别工具
状态和设置get_status, set_connection_mode, get_settings, update_settings
Require Approvallist_pending_connections, allow_pending_connections, block_pending_connections, wait_for_pending_connections
决定list_decisions, update_decisions, remove_decisions
Block List 和 Allow Listlist_block_rules, add_block_rules, remove_block_rules, list_allow_rules, add_allow_rules, remove_allow_rules
网络活动list_apps, get_app_details, get_app_connections, get_domain_details, get_ip_details, get_activity_tree, list_countries, list_recently_blocked, clear_recently_blocked, clear_network_activity
带宽get_bandwidth_usage, get_live_traffic
配置和窗口export_configuration, import_configuration, open_window

MCP 客户端会显示每个工具的说明和参数。只读工具带有只读标记,客户端可以直接运行,无需询问。会删除数据或削弱保护的工具则标记为破坏性操作。

get_app_details 和 get_app_connections 接受 App 名称、Bundle ID、路径,或正在运行的进程的 pid。get_status 在没有 PRO 时也能使用,这样 Agent 就能告诉你其他工具为什么不可用。

6. 工作原理​

  • TinyShield 在 127.0.0.1 上运行一个小型服务器。Agent 启动的 tinyshield-mcp 工具会把每次工具调用转发给它。
  • 每次调用都需要访问令牌。TinyShield 会把令牌写入 ~/Library/Application Support/com.proxyman.ProxymanGuard/automation-server.json,该文件只有你的用户帐户可以读取,并且服务器每次启动都会更换令牌。这些工具只会把令牌发送给写入该文件的 TinyShield 进程。
  • 来自网页的请求会被拒绝。
  • 在 Settings 中关闭服务器后,服务器就会停止。之后 Agent 会告诉你服务器已关闭,而不会打开 TinyShield。

7. 故障排除​

消息处理方法
Tiny Shield's MCP & Command Line server is off在 Settings › MCP 中开启。
…tools are part of Tiny Shield PRO在 TinyShield › License 中激活你的许可证。
Network activity isn't available yet安装并允许 Network Extension。
No app is waiting for approval只有在 Require Approval 模式下,请求才会等待审批。
Agent 没有列出 TinyShield 的工具检查设置命令中的路径,然后重启 Agent,例如在 Claude Code 中使用 /mcp。