Quick Start
Prerequisites
Section titled “Prerequisites”- Docker and Docker Compose installed
- A PostgreSQL database (or use the bundled one)
1. Download and configure
Section titled “1. Download and configure”curl -O https://raw.githubusercontent.com/gatesuite/mcpgate/main/docker-compose.ymlGenerate a strong admin key:
export ADMIN_API_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")echo "Save this somewhere safe: $ADMIN_API_KEY"Create a .env file:
cat > .env << EOFDATABASE_URL=postgresql+asyncpg://mcpgate:mcpgate@postgres:5432/mcpgateADMIN_API_KEY=$ADMIN_API_KEYKEY_PREFIX=mcp_sk_EOF2. Start MCPGate
Section titled “2. Start MCPGate”docker compose up -dCheck it’s healthy:
curl http://localhost:8000/health# {"status": "ok", "service": "mcpgate"}3. Create your first API key
Section titled “3. Create your first API key”The ADMIN_API_KEY is your master credential — your backend uses it to manage keys on behalf of your users.
curl -X POST http://localhost:8000/api/v1/keys \ -H "Authorization: Bearer $ADMIN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "user_id": "user_123", "name": "Claude Desktop", "scopes": {"read": true, "write": true} }'Response:
{ "id": "a1b2c3d4-...", "key": "mcp_sk_3f8a1c2e9b4d7f6a_4a7b2c9e1d3f8a5b...", "prefix": "mcp_sk_3f8a1c2e9b4d7f6a_...5b", "user_id": "user_123", "name": "Claude Desktop", "created_at": "2026-04-16T10:00:00Z"}4. Verify a key
Section titled “4. Verify a key”Your MCP server calls this on every incoming request:
curl -X POST http://localhost:8000/api/v1/verify \ -H "Content-Type: application/json" \ -d '{"key": "mcp_sk_3f8a1c2e9b4d7f6a_4a7b2c9e1d3f8a5b..."}'Response when valid:
{ "valid": true, "user_id": "user_123", "scopes": {"read": true, "write": true}, "error": null}Response when invalid:
{ "valid": false, "user_id": null, "scopes": null, "error": "Invalid API key"}5. List and revoke keys
Section titled “5. List and revoke keys”List all keys for a user:
curl http://localhost:8000/api/v1/keys/user_123 \ -H "Authorization: Bearer $ADMIN_API_KEY"Revoke a key by its ID:
curl -X DELETE http://localhost:8000/api/v1/keys/a1b2c3d4-... \ -H "Authorization: Bearer $ADMIN_API_KEY"Pin a version
Section titled “Pin a version”The root docker-compose.yml defaults to latest. For production, pin to a specific release:
MCPGATE_VERSION=1.2.3 docker compose up -dOr set it in your .env:
MCPGATE_VERSION=1.2.3Next steps
Section titled “Next steps”- How It Works — key format, hashing, O(1) lookups
- Integration Guide — wiring MCPGate into your app
- API Reference — full endpoint documentation
- Deployment — Kubernetes with Helm