Security Guard MCP

Security Guard MCP

Enables secure interaction between LLMs and MCP tools by applying zero-trust security controls, including sensitive data masking, file system protection, and policy enforcement.

Category
Visit Server

README

🛡️ Security Guard MCP

License: MIT Framework: NestJS MCP: Enabled

Security Guard MCP is an enterprise-grade security gateway designed specifically for the Model Context Protocol (MCP). It acts as a zero-trust intermediary between Large Language Models (LLMs) and MCP tools, ensuring that every interaction is audited, sanitized, and compliant with corporate security policies.


🌟 Overview

As LLMs gain the ability to execute tools and access local/remote contexts via MCP, the risk of accidental data leakage or unauthorized system access increases. Security Guard MCP provides a robust defense layer that:

  • Prevents Exfiltration: Automatically masks sensitive data (API keys, tokens, passwords) from tool outputs.
  • Enforces Least Privilege: Implements RBAC and granular policy control over tool execution.
  • Secures the File System: Blocks access to sensitive system files and configuration directories.
  • Ensures Accountability: Logs every tool call and context exchange for audit and compliance.

🤖 For AI Agent Developers

If you are building AI Agents (using LangChain, AutoGPT, or custom MCP clients), Security Guard MCP solves the "Trust Gap" between your agent and your infrastructure.

Why use this?

When you give an AI Agent a tool (e.g., "Read File" or "Execute SQL"), you are essentially giving it a "shell" into your environment. Security Guard MCP ensures:

  • Prompt Injection Defense: Filters malicious intent before it reaches your sensitive tools.
  • Context Isolation: Limits what the agent can "see" and "touch" based on strictly defined scopes.
  • Safe Experimentation: Developers can test autonomous agents without worrying about them accidentally deleting data or leaking .env files.

🔄 The Security Flow

graph LR
    subgraph "Untrusted Zone"
        A[AI Agent / LLM]
    end

    subgraph "Security Guard MCP (Safe Zone)"
        B{Gateway}
        C[Policy Engine]
        D[Sanitizer]
        E[Audit Log]
    end

    subgraph "Internal Infrastructure"
        F[File System]
        G[Database]
        H[Internal APIs]
    end

    A -- "MCP Request" --> B
    B -- "Check RBAC" --> C
    C -- "Allowed" --> F & G & H
    F & G & H -- "Raw Output" --> D
    D -- "Masked Output" --> B
    B -- "Secure Context" --> A
    B -- "Async Event" --> E

🏗️ Architecture

Built on a modular NestJS Monorepo architecture, the project is divided into specialized micro-services and libraries:

Applications

  • Gateway (apps/gateway): The main entry point. Handles incoming MCP requests, performs authentication, and dispatches tasks through the security pipeline.

Core Libraries

  • libs/sanitizer: Deep-content inspection engine for auto-masking sensitive strings.
  • libs/scanner: Security scanner for file path validation and protocol-level threat detection.
  • libs/policy: Policy engine for RBAC and dynamic tool-access rules.
  • libs/auth: Unified authentication layer.
  • libs/audit: High-performance audit logging via Kafka.

🛡️ Security Controls

1. Auto-Masking (DLP)

The system automatically detects and masks sensitive keys in JSON payloads and tool responses, including:

  • password, secret, token, apikey, privateKey, clientSecret.

2. File System Protection

Protects the host environment by blocking access to:

  • Configurations: .env*, application-prod.yml, terraform.tfvars
  • Credentials: *.pem, *.key, id_rsa, known_hosts, secrets/*
  • Certificates: *.p12, *.jks

3. Enterprise Features

  • Audit Logging: Asynchronous logging to Kafka for long-term retention and SIEM integration.
  • Observability: Native OpenTelemetry support for distributed tracing and Prometheus metrics.
  • High Performance: Built on Fastify for ultra-low latency security overhead.

🛠️ Tech Stack


🚀 Getting Started

Prerequisites

  • Node.js v20+
  • Docker & Docker Compose
  • A running MCP-compatible Client (e.g., Claude Desktop, Gemini CLI)

Installation

  1. Clone the repository:

    git clone https://github.com/your-org/security-guard-mcp.git
    cd security-guard-mcp
    
  2. Install dependencies:

    npm install
    
  3. Environment Setup:

    cp .env.example .env
    # Update .env with your local database and Kafka credentials
    
  4. Spin up Infrastructure:

    docker compose up -d
    
  5. Run the Application:

    # Development mode
    npm run start:dev
    
    # Production build
    npm run build
    npm run start:prod
    

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured