Price Per TokenPrice Per Token
MCP Guardrail

MCP Guardrail

by general-analysis

GitHub 50 20 uses Remote
0

About

MCP Guardrail is an AI-powered security layer that aggregates multiple MCP servers into a single protected interface with intelligent content moderation. It prevents prompt injection attacks and malicious content by scanning all interactions through the General Analysis moderation API, acting as a transparent proxy between MCP clients (Cursor, Claude Desktop, Claude Code) and backend servers. Key features: - **AI-powered content moderation** to detect and block prompt injection attacks, malicious inputs, and inappropriate content using the General Analysis API. - **Multi-server aggregation** combining local (stdio) and remote (HTTP/SSE) MCP servers with automatic tool name prefixing to prevent conflicts. - **Zero-configuration setup** via CLI tool that automatically detects and updates MCP config files for Cursor, Claude Desktop, and Claude Code. - **Transparent proxying** that seamlessly manages tools, prompts, and resources between clients and aggregated backend servers without code changes. - **Zero-install deployment** via npx without local installation requirements, or standalone usage with environment variable configuration.

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
  • ENABLE_GUARD_API - Set to "true" to enable AI-powered moderation (requires API_KEY)
  • Complete Example for Cursor/Claude Desktop

    Add this to your MCP configuration file:

    {
      "mcpServers": {
        "guardrail": {
          "command": "npx",
          "args": [
            "-y",
            "@general-analysis/mcp-guard",
            "[{\"name\":\"local-filesystem\",\"command\":\"npx\",\"args\":[\"@modelcontextprotocol/server-filesystem\",\"/path/to/files\"]},{\"name\":\"remote-api\",\"url\":\"https://api.example.com/mcp\"}]"
          ],
          "env": {
            "API_KEY": "your-general-analysis-api-key",
            "ENABLE_GUARD_API": "true"
          }
        }
      }
    }
    

    Standalone Command Line Example

    # Set environment variables
    export API_KEY="your-general-analysis-api-key"
    export ENABLE_GUARD_API="true"

    Run with mixed local and remote servers

    npx -y @general-analysis/mcp-guard '[ { "name": "local-filesystem", "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/path/to/files"] }, { "name": "remote-api", "url": "https://api.example.com/mcp" } ]'

    Requirements

  • Node.js >= 18.0.0
  • Valid General Analysis API key (when moderation is enabled)
  • License

    MIT

    Related MCP Servers

    AI Research Assistant

    AI Research Assistant

    hamid-vakilzadeh

    AI Research Assistant provides comprehensive access to millions of academic papers through the Semantic Scholar and arXiv databases. This MCP server enables AI coding assistants to perform intelligent literature searches, citation network analysis, and paper content extraction without requiring an API key. Key features include: - Advanced paper search with multi-filter support by year ranges, citation thresholds, field of study, and publication type - Title matching with confidence scoring for finding specific papers - Batch operations supporting up to 500 papers per request - Citation analysis and network exploration for understanding research relationships - Full-text PDF extraction from arXiv and Wiley open-access content (Wiley TDM token required for institutional access) - Rate limits of 100 requests per 5 minutes with options to request higher limits through Semantic Scholar

    Web & Search
    12 8
    Linkup

    Linkup

    LinkupPlatform

    Linkup is a real-time web search and content extraction service that enables AI assistants to search the web and retrieve information from trusted sources. It provides source-backed answers with citations, making it ideal for fact-checking, news gathering, and research tasks. Key features of Linkup: - Real-time web search using natural language queries to find current information, news, and data - Page fetching to extract and read content from any webpage URL - Search depth modes: Standard for direct-answer queries and Deep for complex research across multiple sources - Source-backed results with citations and context from relevant, trustworthy websites - JavaScript rendering support for accessing dynamic content on JavaScript-heavy pages

    Web & Search
    2 24
    Math-MCP

    Math-MCP

    EthanHenrickson

    Math-MCP is a computation server that enables Large Language Models (LLMs) to perform accurate numerical calculations through the Model Context Protocol. It provides precise mathematical operations via a simple API to overcome LLM limitations in arithmetic and statistical reasoning. Key features of Math-MCP: - Basic arithmetic operations: addition, subtraction, multiplication, division, modulo, and bulk summation - Statistical analysis functions: mean, median, mode, minimum, and maximum calculations - Rounding utilities: floor, ceiling, and nearest integer rounding - Trigonometric functions: sine, cosine, tangent, and their inverses with degrees and radians conversion support

    Developer Tools
    22 81