Skip to main content
Glama

Risk Gate

🚦 操作风险检测 MCP Server

实时检测 SQL、Shell 命令、API 调用等操作风险

License: MIT MCP


✨ 特性

  • 🔍 智能检测 - 支持 SQL、Shell、API 调用等多种输入类型

  • 🧠 上下文感知 - 区分"查看删除的用户"(安全)vs "删除所有用户"(危险)

  • 🎯 智能调整 - 根据环境(test/dev/prod)和范围自动调整风险等级

  • 🔌 即插即用 - 集成到 Claude Desktop、Cursor、VS Code

  • 📦 开源免费 - MIT 协议,可自由使用和修改


Related MCP server: MCP Gatekeeper

🚀 快速开始

安装

# 克隆仓库
git clone https://github.com/yourusername/risk-gate.git
cd risk-gate

# 安装依赖
npm install

# 编译
npm run build

配置 Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "risk-gate": {
      "command": "node",
      "args": ["/path/to/risk-gate/build/index.js"]
    }
  }
}

使用

重启 Claude Desktop,然后:

你:帮我检查这个 SQL:DELETE FROM users WHERE id = 1

Claude:✅ 未检测到高风险
此操作只影响单条记录,相对安全。

📋 支持的风险类型

等级

图标

说明

示例

极高

🔴

数据永久丢失,无法恢复

DROP TABLE, rm -rf

高

🟠

影响系统或大量数据

部署生产环境, 批量更新

中

🟡

可控制的影响

群发消息, 修改配置


💡 使用示例

上下文感知检测

-- 危险:删除所有数据
DELETE FROM users;
-- 结果:🔴 极高风险 - 影响所有数据

-- 安全:有条件删除
DELETE FROM users WHERE id = 1;
-- 结果:✅ 安全 - 只影响单条记录

Shell 命令检测

# 危险:强制删除
rm -rf /var/log
# 结果:🔴 极高风险 - 强制递归删除文件,无法恢复

# 相对安全:删除测试目录
rm -rf /tmp/test-data
# 结果:🟡 中风险 - 测试环境,影响较小

📁 项目结构

risk-gate/
├── src/                    # 源代码
│   ├── index.ts           # MCP Server 入口
│   ├── types.ts           # 类型定义
│   └── lib/
│       ├── riskRules.ts          # 风险规则
│       └── contextAnalyzer.ts    # 上下文分析器
├── lib/                    # 共享核心逻辑
├── .project/              # 内部管理文件
├── .github/               # GitHub 模板
├── README.md
├── CONTRIBUTING.md        # 贡献指南
├── CHANGELOG.md           # 更新日志
└── LICENSE                # MIT 协议

🔧 开发

# 开发模式(自动重新编译)
npm run watch

# 运行 MCP Inspector(可视化测试)
npm run inspector

# 运行测试
npm test

🤝 贡献

欢迎贡献!请查看 贡献指南。


📄 License

MIT © 一健


🔗 相关链接


⭐ 如果这个项目对你有帮助,请给个 Star!

Made with ❤️ by 一健

Available Tools

1 tool
check_risk检查操作风险B

检测代码或操作指令中的潜在风险,支持 SQL、Shell 命令、API 调用等多种输入类型。能够根据上下文分析操作的影响范围和风险等级。

Inputs: code (required), language.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only a single tool, there is no possibility of misselection or overlap. The tool's purpose (risk assessment of code/commands) is clearly stated and self-contained.

    Naming Consistency5/5

    The lone tool follows a clear verb_noun snake_case pattern (check_risk) that is readable and predictable. No convention mixing exists because there is only one name.

    Tool Count4/5

    A 'risk gate' is a narrow, focused purpose, so a single unified check tool is a defensible minimal surface. It is on the thin side — SQL, Shell, and API inputs are all funneled through one call — but that unification is arguably the design intent.

    Completeness3/5

    The core operation (check a command/code for risk) is covered, but there are no companion operations such as batch checking, retrieving/configuring risk rules, or querying past decisions. Agents can work with a single check call but will hit a dead end if they need to understand or adjust how risk levels are derived.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides real-time security risk assessment for AI coding prompts, analyzing potential dangers, blast radius, and complexity before code execution in Cursor.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Safety checks an agent runs before it acts — flags malicious packages, destructive shell commands, secret leaks, and web-backend holes before execution.
      8
      21 PyPI
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to assess the risk of shell commands before execution, providing a probability of harm and a suggested action (auto, warn, or confirm).
      MIT