GA

general-analysis/mcp-guard

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

57 stars 5 forks 质量 79 趋势 17MIT

MCP Guard 保护您的 MCP 客户端免受即时注入攻击等多种攻击。

概览

一个MCP(模型上下文协议)护栏,内置AI驱动的管理功能,将多个MCP服务器聚合到一个安全接口中。 MCP Guardrail 为您的 MCP(模型上下文协议)设置提供 AI 驱动的安全性和简便配置。它自动检测您现有的 MCP 配置文件,并添加具备智能审核功能的保护层。 - 防止提示注入攻击 - CLI 工具检测并更新 Cursor、Claude Desktop 和 Claude Code 的 MCP 配置文件 - 支持 本地和远程 MCP 服务器 - 工具、提示和资源自动前缀并开放 最简单的入门方式是使用通用分析CLI工具: 这会自动更新你的MCP配置文件,并设置护栏。 无需安装!

概述(AI 翻译)

一个MCP(模型上下文协议)护栏,内置AI驱动的管理功能,将多个MCP服务器聚合到一个安全接口中。

概述

MCP Guardrail 为您的 MCP(模型上下文协议)设置提供 AI 驱动的安全性和简便配置。它自动检测您现有的 MCP 配置文件,并添加具备智能审核功能的保护层。

主要特点:

  • AI驱动的管理以防止即时注入攻击
  • 自动配置 - CLI 工具检测并更新 MCP 配置文件,适用于光标、Claude Desktop 和 Claude 代码
  • 双重连接 - 支持本地和远程MCP服务器
  • 透明代理 - 工具、提示和资源自动前缀并开放

快速启动

最简单的入门方式是使用通用分析CLI工具:

这会自动更新你的MCP配置文件,并设置护栏。

工作原理

用途

与NPX的直接使用

无需安装!直接在你的光标或Claude桌面MCP配置中使用:

独立用途

配置

本地服务器(Stdio)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Guardrail

An MCP (Model Context Protocol) guardrail with built-in AI-powered moderation that aggregates multiple MCP servers into one secure interface.

Overview

The MCP Guardrail provides AI-powered security and easy configuration for your MCP (Model Context Protocol) setup. It automatically detects your existing MCP configuration files and adds a protective layer with intelligent moderation capabilities.

Key features:

  • AI-powered moderation to prevent prompt injection attacks
  • Automatic configuration - CLI tool detects and updates MCP config files for Cursor, Claude Desktop, and Claude Code
  • Dual connectivity - supports both local and remote MCP servers
  • Transparent proxying - tools, prompts, and resources are automatically prefixed and made available

Quick Start

The easiest way to get started is using the General Analysis CLI tool:

# Install the CLI tool
pip3 install generalanalysis==0.1.7

# Login to your account
ga login

# Configure MCP settings for Cursor, Claude Desktop, and Claude Code
ga configure

This will automatically update your MCP configuration files with the guardrail setup.

How It Works

graph LR
    A[MCP Client] --> B[MCP Guard]
    B --> C[MCP Server]
    C --> D[Tool Output]
    D --> B
    B --> E{GA Guardrail}
    E -->|Safe| A
    E -->|Blocked| F[Alert]

Usage

Direct Usage with npx

No installation required! Use directly in your Cursor or Claude Desktop MCP configuration:

{
  "mcpServers": {
    "protected_server": {
      "command": "npx",
      "args": [
        "-y",
        "@general-analysis/mcp-guard",
        "[{\"name\":\"server1\",\"command\":\"path/to/server\",\"args\":[\"arg1\"]}]"
      ]
    }
  }
}

Standalone Usage

npx -y @general-analysis/mcp-guard '[{"name":"server1","command":"path/to/server","args":["arg1"]}]'

Configuration

Local Servers (Stdio)

For local MCP servers that communicate via stdio:

{
  "mcpServers": {
    "protected_server": {
      "command": "npx",
      "args": [
        "-y",
        "@general-analysis/mcp-guard",
        "[{\"name\":\"my-local-server\",\"command\":\"node\",\"args\":[\"path/to/server.js\"]}]"
      ],
      "env": {
        "API_KEY": "your-general-analysis-api-key",
        "ENABLE_GUARD_API": "true"
      }
    }
  }
}

Remote Servers (HTTP/SSE)

For remote MCP servers accessible via HTTP or Server-Sent Events:

{
  "mcpServers": {
    "protected_server": {
      "command": "npx",
      "args": [
        "-y",
        "@general-analysis/mcp-guard",
        "[{\"name\":\"my-remote-server\",\"url\":\"https://api.example.com/mcp\"}]"
      ],
      "env": {
        "API_KEY": "your-general-analysis-api-key",
        "ENABLE_GUARD_API": "true"
      }
    }
  }
}

Environment Variables

  • API_KEY - Your General Analysis API key for the moderation service
在 GitHub 查看完整 README

安装

npx -y @general-analysis/mcp-guard [{\"name\":\"server1\ \"command\":\"path/to/server\ \"args\":[\"arg1\
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "protected_server": { "command": "npx", "args": [ "-y", "@general-analysis/mcp-guard", "[{\"name\":\"server1\",\"command\":\"path/to/server\",\"args\":[\"arg1\"]}]" ] } } }