Enterprise Mcp Gateway

io.github.BenjaminJ由 GitHub 帳號 BenjaminJ 發布v1.0.0更新於 Oct 24, 2026

Production-grade MCP Gateway in Go with RBAC, in-flight PII redaction, and audit logging.

概覽

AI 產生的概覽

一個自託管的 Go MCP 閘道,將企業後端暴露為工具,並提供角色型工具權限、PII 遮蔽與 JSON 稽核日誌。

可以做什麼
從 OpenAPI 3.0 或 Swagger 規格自動註冊 MCP 工具,並將呼叫轉送到 CRM 介面、Java/Go 微服務與資料庫等後端,README 中的範例工具包括列出客戶、查詢客戶詳情與建立支援工單。依權杖對應角色的規則,限制每個呼叫端可見與可呼叫的工具。在工具回應送達模型前,遮蔽信用卡號、SSN、電子郵件、電話、AWS 金鑰、JWT、GitHub 權杖及自訂正規表達式。輸出結構化 JSON 稽核紀錄,包含呼叫端身分、工具名稱、參數雜湊、延遲與遮蔽次數。支援供桌面用戶端使用的 stdio 傳輸,以及供共用或分散式部署使用的 HTTP SSE 傳輸。
適用情境
適用於組織希望在 AI 助理與內部 API 之間建立單一受控入口,並需要依角色控管工具權限、遮蔽 PII 與保留稽核軌跡的情境。也適合已用 OpenAPI 規格描述後端、希望不必撰寫串接程式碼即可產生工具的團隊。
執行需求
以本機程序方式執行,需以 Go 1.24 以上版本從原始碼建置,或使用 Docker 映像;未發布任何套件。需要一份 YAML 設定檔,列出權杖、角色、遮蔽規則、稽核設定與 OpenAPI 連接器規格,並需要可存取的後端服務。權杖透過命令列參數傳入,後端憑證寫在設定檔的連接器標頭中。
安裝前請注意
README 將角色權杖以命令列參數傳入,可能出現在程序清單與用戶端設定檔中,應視為機密。Authorization 等後端憑證保存在設定檔內。閘道可建立支援工單等紀錄,授予寫入權限前應先審查角色規則。稽核日誌會記錄呼叫端身分與工具使用情形,遮蔽效果取決於設定規則是否完整。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Enterprise Mcp Gateway,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Enterprise MCP Gateway

[CI Status] [Last Commit] [Go Version] [MCP Version] [Glama Score] [Security] [License]

Production-grade, high-performance Model Context Protocol (MCP) Gateway in Go.
A secure, audited, and PII-sanitized bridge connecting AI agents (Claude Desktop, Cursor, Antigravity, LangGraph) to enterprise backends (OpenAPI, Java/Spring Boot, Go microservices, relational databases).

[enterprise-mcp-gateway Glama Card]

[Enterprise MCP Gateway Live Demo]
Live Demo: AI Agent querying CRM with in-flight PII & card redaction (left) while the Gateway streams structured JSON audit logs in real-time (right).


🚀 Key Features

  • ⚡ Blazing Fast & Lightweight: Single static Go binary (<25MB resident memory footprint, sub-millisecond routing overhead, zero external runtime dependencies).
  • 🛡️ High-Performance PII & Secret Redaction: Real-time stream and JSON-key masking (Credit Cards with Luhn checksum validation, SSNs, emails, phone numbers, AWS keys, JWTs, GitHub PATs, and custom regex rules) before tool responses reach LLMs.
  • 🔐 Role-Based Tool Governance (RBAC): Token-to-role resolution that limits tool visibility in tools/list and enforces execution permissions during tools/call.
  • 🔌 Dynamic OpenAPI / Swagger Connector: Instantly registers validated MCP tools directly from OpenAPI 3.0/Swagger YAML or JSON specs without writing backend glue code.
  • 📜 Structured JSON Audit Logging: Emits tamper-resistant, structured JSON logs containing caller identity, tool invoked, SHA-256 hashed parameters, execution latency, and PII redaction metrics.
  • 🔄 Dual Transport Support: Fully compliant JSON-RPC 2.0 engine supporting both standard stdio (for Claude Desktop / Cursor) and HTTP Server-Sent Events (SSE) for distributed microservices.

🏗️ Architecture

┌────────────────────────────────────────────────────────┐│           AI Client (Claude / Cursor / Agent)          │└──────────────────────────┬─────────────────────────────┘                           │ JSON-RPC 2.0 (stdio or SSE)                           ▼┌────────────────────────────────────────────────────────┐│           Enterprise MCP Gateway (Single Go Binary)    ││                                                        ││  1. Transport Layer (pkg/mcp/transport)                ││     - Stdio & HTTP-SSE Transceivers                    ││  2. Security & Auth Guard (pkg/governance/rbac)        ││     - Token authentication & least-privilege filtering ││  3. Router & Tool Registry (pkg/mcp/protocol)          ││     - JSON-RPC 2.0 & MCP handshake engine              ││  4. Backend Dispatcher (pkg/connector/openapi)         ││     - Dynamic OpenAPI 3.0 path/query/body mapper       ││  5. Sanitization Engine (pkg/sanitizer/pii)            ││     - Zero-alloc PII, secret, & JSON key redactor      ││  6. Structured Audit Logger (pkg/audit)                ││     - Cryptographic JSON event trail for SIEM          │└──────────────────────────┬─────────────────────────────┘                           │ Authorized & Sanitized Calls                           ▼┌────────────────────────────────────────────────────────┐│      Internal Enterprise Services (Java / Go / DBs)    │└────────────────────────────────────────────────────────┘

📦 Quick Start

1. Build from Source

Ensure you have Go 1.24+ installed:

bash
# Clone the repositorygit clone https://github.com/BenjaminJ/enterprise-mcp-gateway.gitcd enterprise-mcp-gateway
# Build gateway and mock backend servergo build -o bin/mcp-gateway ./cmd/gatewaygo build -o bin/mockserver ./cmd/mockserver

2. Run the Mock Enterprise Backend (Terminal 1)

bash
./bin/mockserver --port 8081

3. Run the Gateway with Sample Config (Terminal 2)

Option A: Stdio Mode (Default)
bash
./bin/mcp-gateway --config ./examples/config.yaml --token "agent-support-key"
Option B: HTTP Server-Sent Events (SSE) Mode
bash
./bin/mcp-gateway --config ./examples/config.yaml --transport sse --port 8080

4. Stream Live Audit Logs in Real-Time (Terminal 3)

Follow and format structured audit records as tools execute:

PowerShell (Windows):

powershell
Get-Content -Path .\audit.log -Wait -Tail 10 | ForEach-Object {    if ($_ -match '^\s*\{') {        $e = $_ | ConvertFrom-Json        $time = ([DateTime]$e.timestamp).ToLocalTime().ToString("HH:mm:ss")        $statusColor = if ($e.status -eq "SUCCESS") { "Green" } else { "Red" }        $redactColor = if ($e.pii_redacted_count -gt 0) { "Yellow" } else { "DarkGray" }        Write-Host "[$time] " -NoNewline -ForegroundColor DarkGray        Write-Host "[$($e.status)] " -NoNewline -ForegroundColor $statusColor        Write-Host "$($e.tool) " -NoNewline -ForegroundColor Cyan        Write-Host "(Role: $($e.role), Latency: $($e.duration_ms)ms, Redacted: $($e.pii_redacted_count))" -ForegroundColor $redactColor    }}

Bash / Linux / macOS (jq):

bash
tail -f audit.log | jq -c '{time: .timestamp, status: .status, tool: .tool, role: .role, latency_ms: .duration_ms, redacted: .pii_redacted_count}'

🔍 Verification with Anthropic Official MCP Inspector

You can test and inspect the gateway using Anthropic's official @modelcontextprotocol/inspector:

Test via Stdio:

bash
npx @modelcontextprotocol/inspector ./bin/mcp-gateway --config ./examples/config.yaml --token agent-support-key

Test via SSE:

  1. Start the gateway in SSE mode:
    bash
    ./bin/mcp-gateway --config ./examples/config.yaml --transport sse --port 8080
  2. Open the inspector pointing to the SSE endpoint:
    bash
    npx @modelcontextprotocol/inspector http://localhost:8080/sse

💻 Claude Desktop Integration

To connect Claude Desktop to your enterprise systems through enterprise-mcp-gateway:

  1. Open your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add enterprise-mcp-gateway to the mcpServers object:

json
{  "mcpServers": {    "enterprise-gateway": {      "command": "/absolute/path/to/enterprise-mcp-gateway/bin/mcp-gateway",      "args": [        "--config",        "/absolute/path/to/enterprise-mcp-gateway/examples/config.yaml",        "--token",        "agent-support-key"      ]    }  }}
  1. Restart Claude Desktop. The enterprise tools (listCustomers, getCustomerDetails, createSupportTicket, etc.) will appear with a hammer icon in the prompt interface.

⚙️ Configuration Guide (config.yaml)

yaml
server:  name: "enterprise-mcp-gateway"  version: "1.0.0"  transport: "stdio"       # "stdio" or "sse"  host: "0.0.0.0"  port: 8080
governance:  enabled: true  default_role: "support_agent"  tokens:    "agent-ro-secret": "readonly_agent"    "agent-support-secret": "support_agent"    "admin-master-secret": "admin"  roles:    readonly_agent:      allowed_tools:        - "list*"        - "get*"    support_agent:      allowed_tools:        - "list*"        - "get*"        - "createSupportTicket"    admin:      allowed_tools:        - "*"
sanitizer:  enabled: true  mask_card_numbers: true  # Luhn-verified Credit Card masking  mask_ssn: true           # US SSN masking  mask_secrets: true       # Private keys, AWS keys, JWTs, PATs  sensitive_keys:    - "password"    - "secret"    - "token"    - "apiKey"    - "ssn"    - "creditCard"  custom_regex:    - name: "Internal Employee ID"      pattern: "\\bEMP-[0-9]{6}\\b"      replacement: "[REDACTED-EMP-ID]"
audit:  enabled: true  log_path: "stdout"       # "stdout" or path to file e.g. "/var/log/mcp-audit.log"  hash_inputs: true        # SHA-256 hashes tool arguments for compliance
connectors:  - name: "enterprise-crm"    type: "openapi"    spec_file: "./examples/crm-openapi.yaml"    base_url: "http://localhost:8081"    headers:      Authorization: "Bearer backend-secret-token"      X-Gateway-Source: "enterprise-mcp-gateway"    timeout_seconds: 15

🧪 Testing

Run all unit and end-to-end integration tests:

bash
# Run all unit and integration testsgo test -v ./...
# Run tests with the Go race detector enabledgo test -race ./...

🐳 Docker Deployment

bash
# Build lightweight Docker imagedocker build -t enterprise-mcp-gateway:latest .
# Run container in SSE modedocker run -d -p 8080:8080 -p 8081:8081 enterprise-mcp-gateway:latest --transport sse --port 8080

📄 License

MIT License.

來源:README.md,提交 76bbf14

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分