MCP Gateway
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Gateway Template
Turn any HTTP API with an OpenAPI 3.x spec into a secure remote MCP server, from config alone:
One container, many APIs. Each API is a folder in
config/apis/<id>/with anapi.yamland a vendored OpenAPI file. Its operations become MCP tools named<api>__<operation>.Secure by default. OAuth 2.1 resource server (Microsoft Entra ID or any OIDC provider). Audience-bound tokens, no token passthrough, and secrets only in Key Vault.
Per-user authorization.
config/policies.yamlmaps app roles, groups and users to APIs, tools and endpoint patterns. Default is deny, and an explicit deny always wins.tools/listis filtered per user, and everytools/callis checked again.Operable. Per-user rate limits, one structured audit record per tool call (Log Analytics), and a landing page that shows each user what they can access and how to connect.
Azure-ready. Terraform for Azure Container Apps, Key Vault, ACR, Log Analytics and the Entra app registration, plus GitHub Actions with OIDC (no stored credentials).
The full design is in SPEC.md; where this implementation deviates from it, the reasons are in docs/open-items.md.
MCP client ──Bearer token──► /mcp ─► AuthN (JWT/JWKS) ─► policy ─► rate limit ─► validate args
│
Browser ──► / (sign in) ──► "your APIs" + connect instructions ▼
upstream API ◄── executor (service credentials,
SSRF guards) ─► audit logQuick start: run and test locally (5 minutes)
Prerequisites: Python 3.12 and uv. Docker is optional. Node is needed only for MCP Inspector.
make install # uv sync
make run # mock OIDC issuer on :8080 + gateway on :8000 (no Docker needed)Leave that running. In a second terminal:
make demo # runs the demo script below end to end
make client USER=bob ROLES=Pets.Reader # list the tools bob can see
make client USER=alice ROLES=Weather.Reader TOOL=open_meteo__forecast \
ARGS='{"latitude":60.17,"longitude":24.94,"daily":["temperature_2m_max"],"timezone":"auto"}'
make token USER=carol ROLES=Pets.Admin # print a bearer token for any other clientOpen http://localhost:8000 and sign in. The mock issuer shows a login form: pick a demo user, or type any username and roles. The page lists exactly the endpoints that user's roles grant, why each one is allowed, and copy-paste setup for each client. Sign in as admin (Gateway.Admin) to also get the read-only Policy explorer at /admin, where you can check what any combination of roles can access.
With Docker you can use make dev instead of make run. It starts the gateway, the mock issuer and Redis with autoreload. make dev-offline also starts Prism mocks for both demo APIs, so no internet access is needed.
Connect a real MCP client locally
Client | How |
MCP Inspector |
|
Claude Code |
|
VS Code |
|
curl |
|
Local auth is real: tokens are validated exactly as in Azure (signature via JWKS, issuer, audience, expiry, scope). The only differences are the issuer (devtools/mock_issuer.py) and the secret source (SECRET_* env vars from .env). There is no "auth disabled" mode.
Demo script (spec section 15)
User | Roles | Result |
alice |
| sees only |
bob |
| sees only the Petstore GET tools. Calling |
carol |
| can add a pet, but still cannot delete one ( |
Audit records are the stdout lines with "log_type": "mcp_audit".
Related MCP server: mcpgate
Developer commands
make test unit + integration tests (incl. policy table tests, golden tests) with coverage
make lint ruff + mypy --strict
make validate validate config (local overlay and production config)
make tools list generated tools make explain ROLES=Pets.Reader who can do what, and why
make gen-schemas regenerate schemas/*.json make update-golden refresh golden tool filesCLI: uv run mcp-gateway validate | tools | explain | fetch-specs | gen-schemas | serve.
Adding an API (no code changes)
mkdir config/apis/<id>, addapi.yaml(see docs/adding-an-api.md) and the OpenAPI file. If the spec lives at a URL, setopenapi.urland runuv run mcp-gateway fetch-specs.Add rules to
config/policies.yamland cases totests/policy_cases/.make validate tools test, then open a PR. After merge, CI builds a new image and deploys it.
Policies are described in docs/policies.md.
Deploying to Azure
Summary (details in docs/entra-setup.md and docs/operations.md):
Bootstrap once (an admin, locally):
cd infra/bootstrap && terraform init && terraform apply -var subscription_id=<sub> -var github_repo=<owner>/<repo>. This creates the state storage and the GitHub OIDC identity, and grants it the roles it needs, including the Graph permissionApplication.ReadWrite.OwnedBy.GitHub environments
devandprod(with required reviewers onprod). Set the bootstrap outputs as environment variables:AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_SUBSCRIPTION_ID,TFSTATE_*.Merge to main.
terraform-applycreates the environment. Then add the post-apply variables fromterraform output(ACR_NAME,ACR_LOGIN_SERVER,CONTAINER_APP_NAME,RESOURCE_GROUP,GATEWAY_URL).Set upstream secrets out of band:
az keyvault secret set --vault-name <kv> --name petstore-api-key --value <value>.Release.
build-pushbuilds and scans the image and pushes it to ACR.deployrolls it out by digest, then runs the smoke test (readiness, metadata, 401 +WWW-Authenticate). Prod is promoted by digest after approval.Assign app roles to users or groups in Entra (Enterprise applications → your gateway → Users and groups).
Connect clients as described in docs/connecting-clients.md. The landing page shows ready-to-paste config.
Repository layout
src/mcp_gateway/ app (FastAPI + MCP low-level server), auth, policy, openapi, tools, upstream_auth, ...
config/ gateway.yaml (+ gateway.local.yaml overlay), policies.yaml, apis/<id>/
schemas/ JSON Schemas generated from the Pydantic config models (editor validation)
devtools/ mock OIDC issuer, token helper, MCP client, demo script, local launcher
tests/ unit, integration (in-process app + MCP client), policy_cases, golden, e2e
infra/ Terraform: bootstrap, modules, envs/dev, envs/prod
.github/ ci, build-push, deploy, terraform-plan/apply, e2e; dependabot; CODEOWNERS
docs/ adding-an-api, policies, connecting-clients, entra-setup, operations, threat-model, open-items
ai/ handover notes for AI agents and new contributors: status, roadmap, architecture, how to workLicense
MIT, see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceGenerates safe-by-default MCP servers from OpenAPI specs, exposing only low-risk GET tools and blocking write operations.5MIT
- AlicenseNot gradedqualityDmaintenanceA stateless gateway that turns any OpenAPI spec into MCP tools on the fly.1MIT
- AlicenseNot gradedqualityDmaintenanceConvert any OpenAPI spec into a secure MCP server with scoped auth, per-tool allow/deny policies, rate limiting, and a redacted audit trail.MIT
- FlicenseNot gradedqualityDmaintenanceA universal MCP server for registering internal, external, and OpenAPI-based APIs as MCP tools. It exposes them to MCP clients via Streamable HTTP and provides admin portal, RBAC/session auth, credential injection, and audit logging.-