$git clone https://github.com/lasso-security/mcp-gateway</div>
| 1 | <div align="center"> |
| 2 | <a href="https://pypi.org/project/mcp-gateway/"> |
| 3 | <img src="https://img.shields.io/pypi/v/mcp-gateway.svg?color=blue" alt="PyPI version"> |
| 4 | </a> |
| 5 | <a href="https://pypi.org/project/mcp-gateway/"> |
| 6 | <img src="https://img.shields.io/pypi/pyversions/mcp-gateway.svg" alt="Python Versions"> |
| 7 | </a> |
| 8 | <a href="./LICENSE"> |
| 9 | <img src="https://img.shields.io/github/license/lasso-security/mcp-gateway" alt="License"> |
| 10 | </a> |
| 11 | |
| 12 | # MCP Gateway |
| 13 | |
| 14 | </div> |
| 15 | |
| 16 | # Overview |
| 17 |  |
| 18 | |
| 19 | MCP Gateway is an advanced intermediary solution for Model Context Protocol (MCP) servers that centralizes and enhances your AI infrastructure. |
| 20 | |
| 21 | MCP Gateway acts as an intermediary between LLMs and other MCP servers. It: |
| 22 | |
| 23 | 1. 📄 Reads server configurations from a `mcp.json` file located in your root directory. |
| 24 | 2. ⚙️ Manages the lifecycle of configured MCP servers. |
| 25 | 3. 🛡️ Intercepts requests and responses to sanitize sensitive information. |
| 26 | 4. 🔗 Provides a unified interface for discovering and interacting with all proxied MCPs. |
| 27 | 5. 🔒 **Security Scanner** - Analyzes server reputation and security risks before loading MCP servers. |
| 28 | |
| 29 | ## Installation |
| 30 | |
| 31 | ### Python (recommended) |
| 32 | Install the mcp-gateway package: |
| 33 | ```bash |
| 34 | pip install mcp-gateway |
| 35 | ``` |
| 36 | |
| 37 | > `--mcp-json-path` - must lead to your [mcp.json](https://docs.cursor.com/context/model-context-protocol#configuration-locations) or [claude_desktop_config.json](https://modelcontextprotocol.io/quickstart/server#testing-your-server-with-claude-for-desktop) |
| 38 | > `--plugin` or `-p` - Specify the plugins to enable (can be used multiple times) |
| 39 | |
| 40 | ### Usage |
| 41 | This example enables the basic guardrail for token masking and xetrack tracing plugin for filesystem MCP: |
| 42 | |
| 43 | ```bash |
| 44 | mcp-gateway --mcp-json-path ~/.cursor/mcp.json -p basic -p xetrack |
| 45 | ``` |
| 46 | |
| 47 | You can add more MCPs that will be under the Gateway by putting the MCP server configuration under the "servers" key. |
| 48 | |
| 49 | <details> |
| 50 | <summary>Cursor example:</summary> |
| 51 | |
| 52 | ```json |
| 53 | { |
| 54 | "mcpServers": { |
| 55 | "mcp-gateway": { |
| 56 | "command": "mcp-gateway", |
| 57 | "args": [ |
| 58 | "--mcp-json-path", |
| 59 | "~/.cursor/mcp.json", |
| 60 | "--plugin", |
| 61 | "basic", |
| 62 | "--plugin", |
| 63 | "xetrack" |
| 64 | ], |
| 65 | "servers": { |
| 66 | "filesystem": { |
| 67 | "command": "npx", |
| 68 | "args": [ |
| 69 | "-y", |
| 70 | "@modelcontextprotocol/server-filesystem", |
| 71 | "." |
| 72 | ] |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | ``` |
| 79 | </details> |
| 80 | |
| 81 | <details> |
| 82 | <summary>Claude example:</summary> |
| 83 | |
| 84 | Get `<PYTHON_PATH>` |
| 85 | ```bash |
| 86 | which python |
| 87 | ``` |
| 88 | ```json |
| 89 | { |
| 90 | "mcpServers": { |
| 91 | "mcp-gateway": { |
| 92 | "command": "<python path>", |
| 93 | "args": [ |
| 94 | "-m", |
| 95 | "mcp_gateway.server", |
| 96 | "--mcp-json-path", |
| 97 | "<path to claude_desktop_config>", |
| 98 | "--plugin", |
| 99 | "basic" |
| 100 | ], |
| 101 | "servers": { |
| 102 | "filesystem": { |
| 103 | "command": "npx", |
| 104 | "args": [ |
| 105 | "-y", |
| 106 | "@modelcontextprotocol/server-filesystem", |
| 107 | "." |
| 108 | ] |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | ``` |
| 115 | </details> |
| 116 | |
| 117 | <details> |
| 118 | <summary>Docker</summary> |
| 119 | |
| 120 | |
| 121 | Build the image after clone this repo |
| 122 | ```bash |
| 123 | docker build -t mcp/gateway . |
| 124 | ``` |
| 125 | |
| 126 | ```json |
| 127 | { |
| 128 | "mcpServers": { |
| 129 | "mcp-gateway": { |
| 130 | "command": "docker", |
| 131 | "args": [ |
| 132 | "run", |
| 133 | "--rm", |
| 134 | "--mount", "type=bind,source=/Users/oro/Projects/playground/mcp-gateway,target=/app", |
| 135 | "-i", |
| 136 | "-v", "/Users/oro/.cursor/mcp.json:/config/mcp.json:ro", |
| 137 | "-e", "LASSO_API_KEY=<LASSO_API_KEY>", |
| 138 | "-v", "mcp-gateway-logs:/logs", |
| 139 | "mcp/gateway:latest", |
| 140 | "--mcp-json-path", "/config/mcp.json", |
| 141 | "--plugin", "basic", |
| 142 | "--plugin", "lasso" |
| 143 | ], |
| 144 | "servers": { |