# gateway

Runs MCP servers on demand from an index while blocking access to sensitive environment variables and saving model context.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 1
- Author: mcprating
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/mcprating/mcp-gateway
- Updated: 2026-10-16
- HTML: https://affpapa.org/en/nevibecode/mcp/gateway

## What it does

The gateway acts as a meta-server. Instead of loading dozens of tool definitions into every prompt, it exposes 13 meta-tools with a flat overhead of 2,644 tokens. Other servers spin up on demand. Their schemas enter the prompt only after an explicit connection.

Process spawning strips ambient secrets. Child servers receive an allowlist containing `PATH`, `HOME`, `USER`, and explicitly named values. Reading sensitive files like `~/.ssh` or `.env` remains possible unless container isolation with Docker is turned on.

Context savings depend on inventory size. Break-even happens around three to five servers. With just one server, discovery and connection turns make the gateway roughly 2.7 times more expensive than a static configuration.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add gateway -- npx -y @mcp-rating/gateway
```

### Codex

**Platform CLI**
```bash
codex mcp add gateway -- npx -y @mcp-rating/gateway
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "gateway": {
            "command": "npx",
            "args": [
                "-y",
                "@mcp-rating/gateway"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "gateway": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@mcp-rating/gateway"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add gateway npx -y @mcp-rating/gateway
```

## When to use it
- Prevent MCP utilities from reading arbitrary environment variables
- Cut context token overhead when keeping many integrations available
- Attach servers on demand without editing client configuration files
- Enforce Docker container sandboxing against local credential files

## Example prompts
- Search the MCP catalog for a Postgres tool and connect to it
- List active gateway meta-tools and currently attached servers
- Find and connect an MCP server for GitHub operations

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

## Other versions with the same name
- [gateway · recordist-app](https://affpapa.org/en/nevibecode/mcp/recordist-app-gateway.md)

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
