mcpField
C
consentgate-mcp

consentgate-mcp

本地服务
consentgate.fyi安全021 周前更新

关于 consentgate-mcp

consentgate-mcp 是用于 MCP Agent 的同意策略服务,在敏感操作前检查规则,并可通过 Telegram 等待人工批准。所有非明确允许的结果都会阻止操作。

主要功能

  1. 01按同意规则检查操作
  2. 02通过 Telegram 请求批准
  3. 03等待批准或超时后返回决定
  4. 04默认拒绝非明确允许的操作

适用场景

  1. 01在发送消息前检查是否获准
  2. 02对资金转账请求人工确认
  3. 03删除数据或更改外部状态前执行门控

MCP 相关

作为 MCP 服务,它向 Agent 提供 `check_action` 和 `request_approval` 工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"jessepetersondev-consentgate": {
"command": "npx",
"args": [
"-y",
"consentgate-mcp"
],
"env": {
"CONSENTGATE_API_KEY": "<CONSENTGATE_API_KEY>",
"CONSENTGATE_BASE_URL": "<CONSENTGATE_BASE_URL>"
}
}
}
}
启动命令npx -y consentgate-mcp
需要配置的环境变量
CONSENTGATE_API_KEY密钥ConsentGate API key (cg_…) from https://consentgate.fyi/dashboard/keys
CONSENTGATE_BASE_URLOverride the API base URL (defaults to https://consentgate.fyi)

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npmconsentgate-mcp0.1.1

工具

2

收录的工具列表 · 更新于 2 周前

参数类型必填说明
actionstring是要执行的具体操作,例如 "send_email"、"delete_file"、"transfer_funds"。
categorystring是操作类别。内置类别:email、social_post、message、file_write、file_delete、api_call、spending、calendar、system、custom。接受任何简短标签(<=50 chars)。
metadataobject否操作的结构化详细信息(例如收件人、金额、路径、URL)。所有者的规则会使用这些信息,且这些信息会显示在任何审批提示中。最大 10KB。

详细介绍

consentgate-mcp

一个 Model Context Protocol 服务,让任何支持 MCP 的 Agent(Claude Desktop、Claude Code、Cursor、自定义 Agent 等)都能通过 ConsentGate,根据用户的同意策略来限制自身操作。

Agent 会在执行操作之前征求同意;由你掌控。高风险操作可以等待你在 Telegram 中点击明确的批准 / 拒绝后再继续。

工具

工具是否阻塞?功能说明
check_action否根据你的同意规则评估操作。返回 allow、deny 或 ask(未匹配任何规则)。在执行任何敏感或不可逆操作前使用。
request_approval是(≤120s)向你的 Telegram 发送批准 / 拒绝提示,并阻塞等待你点击或超时。只有在用户明确点击“批准”时才返回 allow;其他情况(拒绝、超时、不可用)均返回 deny。

这两个工具都会默认拒绝:除明确返回 allow 外,其他任何情况都表示不得继续。

前提条件

  1. 拥有 ConsentGate 账户和 API 密钥 → **https://consentgate.fyi/dashboard/keys**(`cg_…`)。
  2. 使用 request_approval(交互式审批):需要 Pro 计划,并且关联 Telegram 账户(Dashboard → Telegram → Connect)。任何计划均可使用 check_action。

配置

环境变量:

变量必需默认值备注
CONSENTGATE_API_KEY✅—你的 cg_… 密钥。
CONSENTGATE_BASE_URL—https://consentgate.fyi用于覆盖可自托管实例的地址。
Claude Desktop

将以下内容添加到 claude_desktop_config.json(Settings → Developer → Edit Config):

{
  "mcpServers": {
    "consentgate": {
      "command": "npx",
      "args": ["-y", "consentgate-mcp"],
      "env": { "CONSENTGATE_API_KEY": "cg_your_key_here" }
    }
  }
}
Claude Code
claude mcp add consentgate --env CONSENTGATE_API_KEY=cg_your_key_here -- npx -y consentgate-mcp
通用 MCP 客户端

在环境中设置 CONSENTGATE_API_KEY,然后运行 npx -y consentgate-mcp(stdio 传输)。

从源代码运行

在软件包发布到 npm 之前,请将客户端指向构建后的文件 (node /abs/path/to/mcp/dist/index.js),而不要使用 npx consentgate-mcp。

cd mcp
npm install        # also builds via the `prepare` script
npm run build      # -> dist/index.js
CONSENTGATE_API_KEY=cg_… npm run smoke   # lists tools + a live check_action

Agent 应如何使用

推荐的 Agent 策略:

在执行任何会发送消息、花费资金、删除数据、公开发布或更改外部状态的操作之前,调用 check_action。如果结果为 allow,则继续。如果为 deny,则停止。如果为 ask(或该操作风险较高),则调用 request_approval,且仅在明确返回 allow 时继续。

示例(request_approval):

{
  "action": "transfer_funds",
  "category": "spending",
  "metadata": { "amount": "$500", "to": "Acme Corp" },
  "wait_seconds": 90
}
// -> blocks; you tap Approve in Telegram -> { "decision": "allow", "resolved_by": "human" }

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。