Logo van MCP Gateway

MCP Gateway

Organisatie
lasso-security

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

Uitgeverlasso-security
Repositorymcp-gateway
TaalPython
Forks
41
Sterren
389
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    MCP Gateway biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    389 sterren en 41 forks in de gekoppelde repository.

MCP Gateway

Overview

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.
  5. 🔒 Security Scanner - Analyzes server reputation and security risks before loading MCP servers.

Installation

Python (recommended)

Install the mcp-gateway package:

bash
pip install mcp-gateway

--mcp-json-path - must lead to your mcp.json or claude_desktop_config.json
--plugin or -p - Specify the plugins to enable (can be used multiple times)

Usage

This example enables the basic guardrail for token masking and xetrack tracing plugin for filesystem MCP:

bash
mcp-gateway --mcp-json-path ~/.cursor/mcp.json -p basic -p xetrack

You can add more MCPs that will be under the Gateway by putting the MCP server configuration under the "servers" key.

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

Get <PYTHON_PATH>

bash
which python
json
{
  "mcpServers": {
      "mcp-gateway": {
          "command": "<python path>",
          "args": [
            "-m",
            "mcp_gateway.server",
            "--mcp-json-path",
            "<path to claude_desktop_config>",
            "--plugin",
            "basic"
          ],
          "servers": {
              "filesystem": {
                  "command": "npx",
                  "args": [
                      "-y",
                      "@modelcontextprotocol/server-filesystem",
                      "."
                  ]
              }
          }
      }
  }
}

Build the image after clone this repo

bash
docker build -t mcp/gateway .
json
{
  "mcpServers": {
      "mcp-gateway": {
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "--mount", "type=bind,source=/Users/oro/Projects/playground/mcp-gateway,target=/app",
            "-i",
            "-v", "/Users/oro/.cursor/mcp.json:/config/mcp.json:ro",
            "-e", "LASSO_API_KEY=<LASSO_API_KEY>",
            "-v", "mcp-gateway-logs:/logs",
            "mcp/gateway:latest",
            "--mcp-json-path", "/config/mcp.json",
            "--plugin", "basic",
            "--plugin", "lasso"
          ],
          "servers": {
              "filesystem": {
                  "command": "npx",
                  "args": [
                      "-y",
                      "@modelcontextprotocol/server-filesystem",
                      "."
                  ]
              }
          }
      }
  }
}

In this example we use lasso and basic guardrail to show how we can pass enviroment varabile and arguments to the docker and how we can mount storage for the filesystem MCP. The Docker image can be built with optional dependencies required by certain plugins (e.g., presidio).
Use the INSTALL_EXTRAS build argument during the docker build command. Provide a comma-separated string of the desired extras: "presidio,xetrack"

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:

    bash
    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:

bash
mcp-gateway -p basic -p presidio

You can also debug the server using:

bash
LOGLEVEL=DEBUG mcp-gateway --mcp-json-path ~/.cursor/mcp.json -p basic -p 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

bash
mcp-gateway -p 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

bash
mcp-gateway -p presidio

Presidio is identification and anonymization package

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

Lasso

bash
mcp-gateway -p 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:

json
{
  "mcpServers": {
      "mcp-gateway": {
          "command": "mcp-gateway",
          "args": [
              "--mcp-json-path",
              "~/.cursor/mcp.json",
              "-p",
              "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.

Tracing

Xetrack

xetrack is a lightweight package to track ml experiments, benchmarks, and monitor stractured data.

We can use it to debug and monitor tool calls with logs (loguru) or duckdb and sqlite. .

bash
mcp-gateway -p xetrack

Prerequisites

pip install xetrack

Params

  • XETRACK_DB_PATH - The sqlite db location.
    • All logs register in the events table.
    • If fancy objects return from the MCPs response, read about xetrack assets to retrive it.
  • XETRACK_LOGS_PATH - The logs location
  • FLATTEN_ARGUMENTS - Flatten the arguments, default true
  • FLATTEN_RESPONSE - Flatten the response, default true
  • It is recommend to to gitignore the logs location
  • It is recommended to use DVC to manage the db file

Quickstart

json
{
    "mcpServers": {
        "mcp-gateway": {
            "command": "mcp-gateway",
            "args": [
                "--mcp-json-path",
                "~/.cursor/mcp.json",
                "-p",
                "xetrack"
            ],
            "env": {
                "XETRACK_DB_PATH": "tracing.db",
                "XETRACK_LOGS_PATH": "logs/"                
            },
            "servers": {
                "filesystem": {
                    "command": "npx",
                    "args": [
                        "-y",
                        "@modelcontextprotocol/server-filesystem",
                        "."
                    ]
                }
            }
        }
    }
}

Let's say you use the filesystem list_directory tool on path ".", you can find the call parameters under logs/<date>.log.

You can expolre using xetrack cli to query the db:

bash
$ xt tail tracing.db --json --n=1
[
    {
        "timestamp": "2025-04-17 17:12:48.233126",
        "track_id": "mottled-stingray-0411",
        "meta": "f3be31e09667745f",
        "paths": null,
        "call_id": "deab617e-0a45-4950-9de9-3fb549810cf2",
        "capability_name": "list_directory",
        "content_type": "text",
        "content_annotations": "f3be31e09667745f",
        "response_type": "CallToolResult",
        "server_name": "filesystem",
        "capability_type": "tool",
        "isError": 0,
        "content_text": "[DIR] .cursor\n[DIR] .git\n[FILE] .gitignore\n[DIR] .pytest_cache\n[DIR] .venv\n[FILE] LICENSE\n[FILE] MANIFEST.in\n[FILE] README.md\n[DIR] docs\n[DIR] logs\n[DIR] mcp_gateway\n[FILE] pyproject.toml\n[FILE] requirements.txt\n[DIR] tests\n[DIR] tmp",
        "path": ".",
        "prompt": null
    }
]

With python

python
from xetrack import Reader

df = Reader("tracing.db").to_df()

With duckdb cli and ui

bash
$ duckdb --ui
D INSTALL sqlite; LOAD sqlite; ATTACH 'tracing.db' (TYPE sqlite);
D SELECT server_name,capability_name,path,content_text FROM db.events LIMIT 1;

┌─────────────┬─────────────────┬─────────┬────────────────────────────────────┐
│ server_name │ capability_name │  path   │            content_text            │
│   varchar   │     varchar     │ varchar │              varchar               │
├─────────────┼─────────────────┼─────────┼────────────────────────────────────┤
│ filesystem  │ list_directory  │ .       │ [DIR] .cursor\n[DIR] .git\n[FILE…  │
└─────────────┴─────────────────┴─────────┴────────────────────────────────────┘

Of course you can use another MCP server to query the sqlite database 😊

Scanner

The Security Scanner analyzes MCP servers for potential security risks before loading, providing an additional layer of protection through reputation analysis and tool description scanning.

bash
mcp-gateway --scan -p basic

Features:

  • 🔍 Reputation Analysis - Evaluates server reputation using marketplace (Smithery, NPM) and GitHub data
  • 🛡️ Tool Description Scanning - Detects hidden instructions, sensitive file patterns, and malicious actions
  • ⚡ Automatic Blocking - Blocks risky MCPs based on reputation scores (threshold: 30) and security analysis
  • 📝 Configuration Updates - Automatically updates your MCP configuration file with scan results

Quickstart

Initial configuration:

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

After the first run, the scanner will analyze all configured MCP servers and add a blocked status to your configuration:

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

Status Values:

  • "passed" - Server passed all security checks and is safe to use
  • "blocked" - Server failed security checks and will be blocked from loading
  • "skipped" - Server scanning was skipped (manual override)
  • null - Server not yet scanned or previously blocked server now considered safe

Note: You can manually change a blocked server to "skipped" if you're confident it's safe.

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.

Security Scanner

  • Analyzes MCP server reputation and tool descriptions for security risks before loading.

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

Installatie

TypingMind
{
  "mcpServers": {
    "mcp-gateway": {
      "command": "mcp-gateway",
      "args": [
        "--mcp-json-path",
        "{{config.MCP_JSON_PATH}}",
        "-p",
        "{{config.PLUGIN_1}}",
        "-p",
        "{{config.PLUGIN_2}}"
      ],
      "env": {
        "MCP_JSON_PATH": "<MCP_JSON_PATH>",
        "PLUGIN_1": "<PLUGIN_1>"
      }
    }
  }
}

Gebruik MCP Gateway MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra MCP Gateway is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg MCP Gateway toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van MCP Gateway.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "mcp-gateway": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van MCP Gateway in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van MCP Gateway in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je MCP Gateway gebruiken om me hiermee te helpen?
MCP Gateway
Zeker. Ik heb het gelezen.
Dit vond ik met MCP Gateway.

Veelgestelde vragen

Waarvoor wordt de MCP-server MCP Gateway gebruikt?

MCP Gateway is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik MCP Gateway MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je MCP Gateway gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom MCP Gateway MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als MCP Gateway verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik MCP Gateway MCP met TypingMind?

MCP Gateway werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt MCP Gateway MCP in TypingMind?

MCP Gateway biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om MCP Gateway MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als MCP Gateway authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇