Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    mcpgate: auth gateway for self-hosted MCP servers

    1

    Lock down any self-hosted MCP server with per-client API keys, per-tool allowlists, rate limits and an audit log.

    Free

    1 useSecurity scanned
    mcpgate: auth gateway for self-hosted MCP servers

    mcpgate: auth gateway for self-hosted MCP servers

    Example session with this skill installed

    I've got the filesystem MCP server running in streamable HTTP mode at http://127.0.0.1:9000/mcp. Put mcpgate in front of it. My Claude Code should only be able to read stuff, never write/move/delete. Our CI bot should get every tool. Give me the config.yaml, the commands to run, and how to hook Claude Code up to it.

    • Read your context and instructions
    • Compiled the mcpgate

    The gateway is set up and tested against your filesystem server: Claude Code gets the 9 read tools only, and the CI bot gets all 13. Before writing the allowlists I pulled the exact tool names from your server with `scripts/discover_tools.py`, because mcpgate matches tool names exactly and a guessed name (like `read_file`) would quietly block a tool. ``` client --Bearer key--> mcpgate 127.0.0.1:8080 --> filesystem MCP 127.0.0.1:9000/mcp auth -> rate limit -> tool allowlist -> proxy one JSON audit line per request -> ./mcpgate-audit.jsonl ``` ## What your server exposes (13 tools) | Read-only (Claude Code gets these) | Write tools (CI bot only) | |---|---| | `read_text_file`, `read_media_file`, `read_multiple_files`, `list_directory`, `list_directory_with_sizes`, `directory_tree`, `search_files`, `get_file_info`, `list_allowed_directories` | `write_file`, `edit_file`, `create_directory`, `move_file` | Your server has no `delete` tool. Removing or renaming a file goes through `move_file` or an overwrite through `write_file`/`edit_file`, and Claude Code is blocked from all of them. ## 1. Install and mint keys ```bash bash scripts/install.sh # checksum-verified release binary -> ~/.local/bin mcpgate keygen --label claude-code # prints the key once + a config entry with its SHA-256 hash mcpgate keygen --label ci-bot ``` **Treat the printed keys like passwords:** only their hashes go in config.yaml. Put the CI key in your CI secret store. ## 2. config.yaml ```yaml upstream: url: "http://127.0.0.1:9000/mcp" timeout: 30s listen: "127.0.0.1:8080" # localhost only. Put TLS in front before exposing it to a network. keys: # Claude Code: read-only. Write/edit/move/create tools are denied AND hidden from tools/list. - label: "claude-code" hash: "<sha256 from mcpgate keygen>" allow: - read_text_file - read_media_file - read_multiple_files - list_directory - list_directory_with_sizes - directory_tree - search_files - get_file_info - list_allowed_directories rate_limit: { rps: 5, burst: 20 } # a client's connect sequence can exhaust burst 5 -> 429 # CI bot: every tool, including any the upstream adds later. - label: "ci-bot" hash: "<sha256 from mcpgate keygen>" allow: ["*"] rate_limit: { rps: 10, burst: 30 } audit: output: "./mcpgate-audit.jsonl" ``` - **CI bot gets `"*"`:** that also covers tools the server adds later. To review each new tool first, list the 13 names instead. - **Keep the file out of git:** add `config.yaml` to `.gitignore`. ## 3. Run it ```bash mcpgate validate -c config.yaml # -> OK: 2 key(s), upstream http://127.0.0.1:9000/mcp mcpgate serve -c config.yaml # -> mcpgate listening on 127.0.0.1:8080 -> http://127.0.0.1:9000/mcp ``` mcpgate doesn't hot-reload, so restart `serve` after every config change. Want a launchd plist, systemd unit or `docker run --restart unless-stopped` to keep it running? Tell me which. ## 4. Connect Claude Code ```bash export MCPGATE_KEY='mcpg_...' # the claude-code key, e.g. in ~/.zshrc claude mcp add --transport http files http://127.0.0.1:8080/mcp \ --header "Authorization: Bearer $MCPGATE_KEY" ``` For a shared project `.mcp.json`, reference the variable so each person uses their own key: ```json { "mcpServers": { "files": { "type": "http", "url": "http://127.0.0.1:8080/mcp", "headers": { "Authorization": "Bearer ${MCPGATE_KEY}" } } } } ``` If Claude Code is currently connected straight to `:9000`, remove that entry, or it can go around the gateway. ## Test results I ran your config on a scratch port against your upstream, then stopped it: | Check | Result | |---|---| | No key | HTTP 401 `unauthorized` | | `tools/list` with the Claude Code key | 9 tools (all read-only) | | `tools/list` with the CI key | all 13 tools | | Claude Code calls `list_allowed_directories` | succeeds | | Claude Code calls `write_file` | `{"code":-32001,"message":"tool not permitted: write_file"}` | | Claude Code calls `move_file` | `{"code":-32001,"message":"tool not permitted: move_file"}` | | CI bot calls `write_file` | let through | The audit log recorded each request under the right label: ```json {"label":"claude-code","method":"tools/call","tool":"write_file","decision":"deny:policy","status":200,...} {"label":"ci-bot","method":"tools/call","tool":"write_file","decision":"allow","status":200,...} ``` **To review later:** `python3 scripts/audit_summary.py mcpgate-audit.jsonl --label ci-bot --since 1d`. ## Limits worth knowing - **Only tools are checked.** Resources and prompts pass through for any valid key; the filesystem server's actions are all tools, so that doesn't matter here. - **Revoking a key:** remove or replace its entry and restart. The old key keeps working until the restart.

    only their hashes go in config.yaml

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Self-hosted MCP servers usually ship with no auth: anyone who can reach the port can call every tool. This skill teaches your agent to put **mcpgate** in front of the server. mcpgate is a small open-source gateway (Go, Apache-2.0). ## What your agent can do with it - **Set up a gateway in minutes.** It installs a checksum-verified binary and reads the server's *real* tool names (allowlists are exact-match, so it never guesses), then writes a deny-by-default config with one key per client. - **Least-privilege allowlists.** Give Claude Code read-only tools and give CI everything. Tools a key can't use are also hidden from that client's tool list. - **Connect your clients.** It writes ready-made Claude Code and Cursor configs, with keys kept in env vars instead of committed files. - **Respond to a leaked key.** It rotates the key and reports what the key did using the audit log: tool-level counts, denied attempts, off-hours activity. - **Debug errors.** It maps `tool not permitted`, 401, 429 and 502 to their exact cause and fix. - **Know the limits.** It tells you up front when mcpgate isn't the right fit (stdio servers, OAuth, per-argument rules) and what to do instead. ## What's bundled - `scripts/install.sh`: downloads the release binary for your OS/arch and verifies its SHA-256. - `scripts/discover_tools.py`: lists any MCP server's exact tool names with read-only/destructive hints. - `scripts/audit_summary.py`: per-key activity, denials, and allowed-but-unused tools. - References: full config schema, client setup (Claude Code, Cursor, curl smoke test), and a troubleshooting table. ## Requirements - An MCP server that speaks Streamable HTTP or SSE. For stdio servers, the skill explains how to bridge them. - `curl` and Python 3.8+ for the helper scripts. No pip packages. Source: https://github.com/bouncei/mcpgate · Site: https://mcpgate.bouncei.dev

    Requires SSE/HTTP upstream. No direct stdio support. No argument-level filtering. No hot-reloading; requires restart to apply config changes. Resource/prompt access is not policed.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 28 days ago

    • Free with an Agensi account

    Requires

    GitHub
    mcpgate v0.1.1+
    HTTP Or SSE MCP
    Python 3.8+
    curl

    Permissions

    Terminal / Shell
    Network Access
    Read Files
    Write Files
    Environment Variables

    Allowed Hosts

    github.com

    Terminal: runs the mcpgate CLI (keygen, validate, serve) and the bundled helper scripts. Read/Write files: reads and edits the gateway's config.yaml and reads its audit log. Network: install.sh downloads the mcpgate release binary from github.com/bouncei/mcpgate and verifies its SHA-256 against the release checksums; discover_tools.py talks only to the MCP server URL you give it (no redirects followed). Environment variables: client configs reference API keys via env vars (e.g. MCPGATE_KEY) so keys never land in committed files; install.sh honours optional MCPGATE_VERSION / MCPGATE_INSTALL_DIR. No telemetry; nothing is sent anywhere else.

    Listed28 days ago

    What's inside

    Frequently Asked Questions

    Standard MCP setups are "all-or-nothing," but this skill creates a hard network boundary that allows you to issue specific API keys to different users or agents, ensuring they only see and execute the tools you’ve authorized.

    It works with any MCP server that uses Streamable HTTP or Server-Sent Events (SSE) and is compatible with major MCP-enabled clients like Claude Code and Cursor.

    The skill (SKILL.md) plus three helper scripts: install.sh downloads the checksum-verified mcpgate release binary from GitHub, discover_tools.py lists an MCP server's exact tool names, and audit_summary.py summarizes the audit log. It also includes reference docs for the config schema, client setup (Claude Code, Cursor) and troubleshooting. The gateway itself is open source (Apache-2.0) at github.com/bouncei/mcpgate.

    Installation involves a three-step process: discovering your upstream tools via the provided script, generating hashed API keys using the built-in keygen, and launching the service with a simple YAML configuration.

    Currently, allowlists are enforced at the tool-name level; while you can restrict access to entire tools, the gateway does not yet support filtering based on specific tool arguments or parameters.

    The gateway includes built-in rate limiting and JSONL audit logging, which allows you to set RPS caps to prevent agent loops and track every execution for performance debugging.

    New in Security