/ Каталог / Песочница / mcp-gateway
● Сообщество lasso-security ⚡ Сразу

mcp-gateway

автор lasso-security · lasso-security/mcp-gateway

Put a security gateway in front of your MCP servers — mask secrets, redact PII, block prompt injection, and log every tool call.

Lasso's mcp-gateway is a Python-based orchestrator for multiple MCP servers with a plugin system for guardrails: Basic secret masking, Presidio PII redaction, Lasso's LLM-aware prompt-injection detection, Xetrack tracing, and server-reputation scanning.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

gateway.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "gateway": {
      "command": "uvx",
      "args": [
        "mcp-gateway"
      ],
      "_inferred": true
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "gateway": {
      "command": "uvx",
      "args": [
        "mcp-gateway"
      ],
      "_inferred": true
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "gateway": {
      "command": "uvx",
      "args": [
        "mcp-gateway"
      ],
      "_inferred": true
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "gateway": {
      "command": "uvx",
      "args": [
        "mcp-gateway"
      ],
      "_inferred": true
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "gateway",
      "command": "uvx",
      "args": [
        "mcp-gateway"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "gateway": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-gateway"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

claude mcp add gateway -- uvx mcp-gateway

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: mcp-gateway

Expose internal MCPs to Claude without leaking PII

👤 Enterprise security, platform teams ⏱ ~45 min advanced

Когда использовать: Your internal tools (postgres, CRM) would leak customer names / emails / SSNs into LLM context if used directly.

Предварительные требования
  • pip install mcp-gateway[presidio] — presidio extra pulls spaCy models
Поток
  1. Wire upstream MCPs through gateway
    Configure mcp-gateway with upstream postgres MCP; enable the Presidio plugin with redaction for EMAIL, PHONE, US_SSN.✓ Скопировано
    → Config file with plugin chain
  2. Test redaction
    Run a query returning customer emails; confirm the gateway replaces them with <EMAIL> placeholders before reaching the LLM.✓ Скопировано
    → Claude sees only placeholders

Итог: LLM-usable tool access without raw PII crossing the boundary.

Подводные камни
  • Over-redaction breaks downstream joins — Use consistent pseudonyms (Presidio supports hash-based) so the LLM can still reason across redacted fields
Сочетать с: postgres

Block prompt injection attacks from tool outputs

👤 Security-aware agent builders ⏱ ~30 min advanced

Когда использовать: Your agent uses fetch/web-browsing MCPs — tool outputs can contain 'ignore previous instructions' payloads.

Предварительные требования
  • Lasso API key — lasso.security signup
Поток
  1. Enable Lasso plugin
    Turn on the Lasso plugin in gateway config with LASSO_API_KEY set. Put fetch MCP behind it.✓ Скопировано
    → Plugin active; outputs scanned
  2. Test
    Have Claude fetch a URL containing known prompt-injection test string; verify it's neutralized before reaching the model.✓ Скопировано
    → Injection blocked or flagged

Итог: Defense against tool-output injection.

Подводные камни
  • False positives block legit content — Start with 'warn' mode, review logs before switching to 'block'
Сочетать с: fetch · firecrawl

Log every MCP tool call for compliance audit

👤 Compliance / security audit teams ⏱ ~20 min intermediate

Когда использовать: You need SOC2-style evidence of what the LLM asked tools to do.

Поток
  1. Enable Xetrack plugin
    Turn on Xetrack with SQLite destination. Route all MCPs through the gateway.✓ Скопировано
    → mcp_calls.db being written
  2. Query audit log
    Show me all tool calls in the last 24h where the tool name contains 'delete' or 'drop'.✓ Скопировано
    → Destructive-op audit trail

Итог: Queryable audit database for compliance.

Подводные камни
  • Log DB grows unbounded — Rotate and archive monthly

Комбинации

Сочетайте с другими MCP — эффект x10

gateway + postgres + fetch

DB + web access with PII + injection guards

Put postgres and fetch behind mcp-gateway with presidio + lasso plugins; use normally from Claude.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
<upstream tools> Depends on upstream MCP Gateway is transparent — you call upstream tools as usual upstream cost + plugin overhead

Стоимость и лимиты

Во что обходится

Квота API
Lasso plugin requires Lasso API key (paid tier)
Токенов на вызов
Plugin overhead ~50-200ms per call; redaction reduces tokens
Деньги
Gateway itself free. Lasso plugin: see lasso.security pricing.
Совет
Run basic + presidio plugins for free; only add Lasso if you need advanced injection detection.

Безопасность

Права, секреты, радиус поражения

Хранение учётных данных: Plugin API keys in env vars (LASSO_API_KEY, etc.)
Исходящий трафик: Varies by plugin: basic + presidio are local; Lasso sends samples to Lasso cloud for analysis

Устранение неполадок

Частые ошибки и исправления

Presidio plugin fails to load

Install extra: pip install 'mcp-gateway[presidio]' and download spaCy model: python -m spacy download en_core_web_lg.

Upstream MCP not responding through gateway

Test the upstream directly first; then verify gateway mcp.json command/args match exactly.

Performance drop

Plugin chain order matters — put cheapest (basic mask) first, Lasso last.

Альтернативы

mcp-gateway в сравнении

АльтернативаКогда использоватьКомпромисс
Claude's built-in output filtersYou only use Claude and trust its own redactionNo customization, no audit trail
Concierge SDKYou want a framework for writing MCPs, not a security proxyDifferent problem space

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills