MCP Gateway

MCP Gateway

By lasso-security GitHub

A plugin-based gateway that orchestrates other MCPs and allows developers to build upon it enterprise-grade agents.

python agent
Overview

What is MCP Gateway?

MCP Gateway is a plugin-based gateway that orchestrates other Model Context Protocol (MCP) servers, allowing developers to build enterprise-grade agents and enhance their AI infrastructure.

How to use MCP Gateway?

To use MCP Gateway, install the package via pip and configure your mcp.json file to manage the lifecycle of MCP servers. Start the server with the appropriate guardrails enabled.

Key features of MCP Gateway?

  • Agnostic Guardrails: Configurable security filters to prevent sensitive data exposure.
  • Unified Visibility: Comprehensive dashboard for monitoring all MCPs.
  • Advanced Tracking: Detailed logs and usage analytics for optimization.

Use cases of MCP Gateway?

  1. Masking sensitive information like tokens and credentials.
  2. Centralized management of multiple MCP servers.
  3. Real-time monitoring and risk assessment of AI interactions.

FAQ from MCP Gateway?

  • Can MCP Gateway handle multiple MCP servers?

Yes! It can manage multiple MCP servers through a unified interface.

  • Is MCP Gateway secure?

Yes! It includes various guardrails to ensure data security and privacy.

  • How do I install MCP Gateway?

You can install it using the command: pip install mcp-gateway.

Content

MCP Gateway

Hugging Face Token Masking Example

MCP Gateway is an advanced intermediary solution for Model Context Protocol (MCP) servers that centralizes and enhances your AI infrastructure.

MCP Gateway acts as an intermediary between LLMs and other MCP servers. It:

  1. Reads server configurations from a mcp.json file located in your root directory.
  2. Manages the lifecycle of configured MCP servers.
  3. Intercepts requests and responses to sanitize sensitive information.
  4. Provides a unified interface for discovering and interacting with all proxied MCPs.

Installation

Install the mcp-gateway package:

pip install mcp-gateway

--mcp-json-path - must lead to your mcp.json or claude_desktop_config.json

--enable-guardrails - you can use this to activate multiple guardrail plugins

Cursor example:

{
  "mcpServers": {
      "mcp-gateway": {
          "command": "mcp-gateway",
          "args": [
              "--mcp-json-path",
              "~/.cursor/mcp.json",
              "--enable-guardrails",
              "basic"
          ],
          "servers": {
              "filesystem": {
                  "command": "npx",
                  "args": [
                      "-y",
                      "@modelcontextprotocol/server-filesystem",
                      "."
                  ]
              }
          }
      }
  }
}

This example gives you the basic and presidio guardrails for token and PII masking for filesystem MCP. You can add more MCPs that will be under the Gateway by putting the MCP server configuration under the "servers" key.

Quickstart

Masking Sensitive Information

MCP Gateway will automatically mask the sensitive token in the response, preventing exposure of credentials while still providing the needed functionality.

  1. Create a file with sensitive information:

    echo 'HF_TOKEN = "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"' > tokens.txt
    
  2. When an agent requests to read this file through MCP Gateway:

    • Recommend to test with sonnet 3.7
    Use your mcp-gateway tools to read the ${pwd}/tokens.txt and return the HF_TOKEN
    

Output:

Hugging Face Token Masking Example

Usage

Start the MCP Gateway server with python_env config on this repository root:

mcp-gateway --enable-guardrails basic --enable-guardrails presidio

You can also debug the server using:

LOGLEVEL=DEBUG mcp-gateway --mcp-json-path ~/.cursor/mcp.json --enable-guardrails basic --enable-guardrails presidio

Tools

Here are the tools the MCP is using to create a proxy to the other MCP servers

  • get_metadata - Provides information about all available proxied MCPs to help LLMs choose appropriate tools and resources
  • run_tool - Executes capabilities from any proxied MCP after sanitizing the request and response

Plugins

Contribute

For more details on how the plugin system works, how to create your own plugins, or how to contribute, please see the Plugin System Documentation.

Guardrails

MCP Gateway supports various plugins to enhance security and functionality. Here's a summary of the built-in guardrail plugins:

NamePII MaskingToken/Secret MaskingCustom PolicyPrompt InjectionHarmful Content
basic
presidio
lasso

Note: To use the presidio plugin, you need to install it separately: pip install mcp-gateway[presidio].

Basic

mcp-gateway --enable-guardrails basic

Masking basic secerts

  • azure client secret
  • github tokens
  • github oauth
  • gcp api key
  • aws access token
  • jwt token
  • gitlab session cookie
  • huggingface access token
  • microsoft teams webhook
  • slack app token

Presidio

mcp-gateway --enable-guardrails presidio

Presidio is identification and anonymization package

  • Credit Card
  • IP
  • Email
  • Phone
  • SSN
  • Etc

Lasso

mcp-gateway --enable-guardrails lasso

Prerequisites

To use Lasso Security's advanced AI safety guardrails, update your mcp.json configuration as follows:

  1. Add the LASSO_API_KEY=<YOUR-API-KEY> to your environment variable or in the "env" section.
  2. Insert other MCP servers configuration under key servers

Example:

{
  "mcpServers": {
      "mcp-gateway": {
          "command": "mcp-gateway",
          "args": [
              "--mcp-json-path",
              "~/.cursor/mcp.json",
              "--enable-guardrails",
              "lasso"
          ],
          "env": {
              "LASSO_API_KEY": "<lasso_token>"
          },
          "servers": {
              "filesystem": {
                  "command": "npx",
                  "args": [
                      "-y",
                      "@modelcontextprotocol/server-filesystem",
                      "."
                  ]
              }
          }
      }
  }
}

Features

🔍 Full visibility into MCP interactions with an Always-on monitoring.

🛡️ Mitigate GenAI-specific threats like prompt injection and sensitive data leakage in real-time with built-in protection that prioritizes security from deployment.

✨ Use flexible, natural language to craft security policies tailored to your business's unique needs.

⚡ Fast and easy installation for any deployment style. Monitor data flow to and from MCP in minutes with an intuitive, user-friendly dashboard.

The Lasso guardrail checks content through Lasso's API for security violations before processing requests and responses.

Read more on our website 👉 Lasso Security.

How It Works

Your agent interacts directly with our MCP Gateway, which functions as a central router and management system. Each underlying MCP is individually wrapped and managed.

Key Features

Agnostic Guardrails

  • Applies configurable security filters to both requests and responses.
  • Prevents sensitive data exposure before information reaches your agent.
  • Works consistently across all connected MCPs regardless of their native capabilities.

Unified Visibility

  • Provides comprehensive dashboard for all your MCPs in a single interface.
  • Includes intelligent risk assessment with MCP risk scoring.
  • Delivers real-time status monitoring and performance metrics.

Advanced Tracking

  • Maintains detailed logs of all requests and responses for each guardrail.
  • Offers cost evaluation tools for MCPs requiring paid tokens.
  • Provides usage analytics and pattern identification for optimization.
  • Sanitizes sensitive information before forwarding requests to other MCPs.

License

MIT

No tools information available.

The open-source multi-agent chat interface that lets you manage multiple agents in one dynamic conversation and add MCP servers for deep research

python typescript
View Details

AI assistant built with Streamlit, NVIDIA NIM (LLaMa 3.3:70B) / Ollama, and Model Control Protocol (MCP).

python mcp
View Details

MCP Client Implementation Using LangChain ReAct Agent / Python

python mcp
View Details

An MCP server for processing images using Florence-2

python florence-2
View Details

Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard

python fastapi
View Details

An ntfy MCP server for sending ntfy notifications to your self-hosted ntfy server 📤 (supports secure token auth - use with npx or docker!)

notifications agent
View Details

YouTube MCP Server is an AI-powered solution designed to revolutionize your YouTube experience. It empowers users to search for YouTube videos, retrieve detailed transcripts, and perform semantic searches over video content—all without relying on the official API. By integrating with a vector database, this server streamlines content discovery.

python machine-learning
View Details