api-gateway-mcp-server
Configures Google Cloud API Gateway to act as a remote Model Context Protocol (MCP) server (Public Preview) that exposes REST APIs as agent tools over HTTP (POST /mcp)
Install / Use
npx skills add google/skills --skill api-gateway-mcp-serverInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Education & ResearchSupported Platforms
Our assessment of api-gateway-mcp-server
api-gateway-mcp-server scores 93/100 on our quality scale, 82nd of 442 Education & Research skills we index (top 19%).
Its SKILL.md is 16 KB long, split into 7 sections with 1 code example: a thorough specification that gives an agent plenty to work with.
With 20,340 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 26 days ago, so api-gateway-mcp-server is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-20. Automated pattern scan on 2026-10-20. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
api-gateway-mcp-server compared with similar skills
All 4 of these similar skills score higher than api-gateway-mcp-server; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| api-gateway-mcp-server (this skill)by google | 93 | 20.3k | 26d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 100.1k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 76.5k | today | CLAUDE.md |
| last30days-skillby mvanhorn | 100 | 64.8k | 1d ago | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.5k | today | CLAUDE.md |
Frequently asked questions
- How do I install api-gateway-mcp-server?
- Run
npx skills add google/skills --skill api-gateway-mcp-server. The install tabs above show the steps for each supported agent. - Which AI agents does api-gateway-mcp-server work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is api-gateway-mcp-server safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is api-gateway-mcp-server still maintained?
- The repository was last updated 26 days ago, so api-gateway-mcp-server is actively maintained.
Skill content
View source on GitHubname: api-gateway-mcp-server metadata: version: "1.0.1" category: AiAndMachineLearning description: >- Configures Google Cloud API Gateway to act as a remote Model Context Protocol (MCP) server (Public Preview) that exposes REST APIs as agent tools over HTTP (POST /mcp). Use when migrating OpenAPI 2.0 specs to OpenAPI 3.x for MCP, annotating specs with x-google-api-management.mcp and x-google-mcp-tool, securing tools/list with JWTs or API keys, connecting Google ADK (McpToolset) or Apigee API hub and Agent Registry, or troubleshooting MCP JSON-RPC errors (-32601, -32602, -32000). Do not use for Apigee X proxy bundles, outbound LLM model routing, or GKE Gateway API.
API Gateway Remote MCP Server (Public Preview)
This skill converts new or existing REST APIs on Google Cloud API Gateway into remote Model Context Protocol (MCP) servers (POST https://{default_hostname}/mcp, Public Preview). By annotating an OpenAPI 3.x (3.0.x or 3.1.x) specification with x-google-api-management.mcp and x-google-mcp-tool, API Gateway translates MCP JSON-RPC 2.0 requests (initialize, notifications/initialized, tools/list, tools/call) into standard HTTP REST requests to your backend while enforcing existing authentication and quota policies.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:api-gateway-mcp-server)"
and append agent-skills/1.0 (skill:api-gateway-mcp-server) to User-Agent headers.
Prerequisites
- Install the Google Cloud CLI and the validator dependency:
- Install the Google Cloud CLI. Then update it to the latest version with
gcloud components update. An old CLI can fail when it uploads an OpenAPI 3.x API config. - Install Python 3.10 or later and
PyYAMLfor the local OpenAPI MCP validator script:pip install "PyYAML>=6.0,<7.0"
- Install the Google Cloud CLI. Then update it to the latest version with
- Authenticate your environment:
- Local CLI session:
gcloud auth login - Application Default Credentials (SDKs / ADK):
gcloud auth application-default login
- Local CLI session:
- Select or create a project, confirm billing, and pick a supported gateway location:
- Select an existing project (
gcloud config set project {project_id}) or create one (gcloud projects create {project_id}). - Confirm that an active billing account is linked to
{project_id}. API Gateway has a free monthly allowance of API calls for each billing account, but you still need an active billing account to deploy. Calls above the allowance and network data transfer out are charged. For current prices, see API Gateway pricing. - Use
us-central1as the default--locationfor gateway commands. For the other supported regions, see API Gateway deployment model.
- Select an existing project (
- Enable the required Google Cloud APIs:
For API hub discovery (optional), enable the API hub API in the API hub host project:gcloud services enable \ apigateway.googleapis.com \ servicemanagement.googleapis.com \ servicecontrol.googleapis.com \ --project={project_id}gcloud services enable apihub.googleapis.com --project={hub_project_id}. To query Agent Registry (optional), also rungcloud services enable agentregistry.googleapis.com --project={project_id}. - Verify the IAM roles (use the most restrictive role for each step):
- To create and update the API, API configs, and gateways: API Gateway Admin (
roles/apigateway.admin) on{project_id}. To run thegcloud services enablecommands: Service Usage Admin (roles/serviceusage.serviceUsageAdmin) on that project. - To reference the gateway service account in an API config: Service Account User (
roles/iam.serviceAccountUser) on{gateway_sa_name}@{project_id}.iam.gserviceaccount.com. - For a Cloud Run backend: grant the gateway service account the Cloud Run Invoker role (
roles/run.invoker) on the service. - To mint test ID tokens as a caller service account: Service Account Token Creator (
roles/iam.serviceAccountTokenCreator) on{caller_sa_email}. - Reference: Configure the development environment.
- To create and update the API, API configs, and gateways: API Gateway Admin (
Decision Matrix: MCP Server Configuration and Client Integration
| Task | Required Mechanism | Critical Guardrail | Detailed Reference |
| --- | --- | --- | --- |
| Migrate OpenAPI 2.0 (swagger: "2.0") or author OpenAPI 3.x for MCP | Root x-google-api-management.mcp + named backends + operation-level x-google-mcp-tool | NEVER add MCP extensions to an OpenAPI 2.0 spec. Rationale: MCP is not supported for OpenAPI 2.0. Use OpenAPI 3.0.x or 3.1.x, and deploy the spec with gcloud api-gateway api-configs create. Keep all MCP operations in one OpenAPI document: if an API config has several documents, API Gateway serves the MCP tools of only one of them. | OpenAPI 2.0 to 3.x Migration |
| Optimize tool names, descriptions, and schemas for LLM tool selection | x-google-mcp-tool (name, description, false) + described requestBody properties | Every operation MUST have an operationId, with or without MCP. Every exposed tool MUST resolve to a unique name that matches [A-Za-z0-9_.-]{1,128} (x-google-mcp-tool.name, or else the operationId), a non-empty description, and a non-empty response body (HTTP 204 is unsupported). Only GET, POST, PUT, PATCH, and DELETE operations can be tools, and a gateway serves at most 1,000 tools. API Gateway rejects complex nested schemas when you create the API config, but a simple nested object body works. In OpenAPI 3.1, give each schema one type, because API Gateway also rejects a type list such as type: ["string", "null"]. Describe each property, and check each tool's inputSchema in tools/list after you deploy. | OpenAPI Agent Tool Optimizer |
| Secure tools/list and hide internal/admin routes | x-google-api-management.mcp.tools-list.security (exactly one JWT or API key scheme; a JWT scheme is also listed in root security) + x-google-mcp-tool: false | tools/list is unauthenticated by default. It accepts one JWT scheme, or one API key scheme sent in the x-api-key header. API Gateway rejects a config whose JWT tools-list.security scheme is missing from the root security list, and that root entry also requires the JWT on every REST operation without its own security. If the root list already has an API key scheme, add the JWT to the same requirement object (AND): API Gateway does not support alternative (OR) requirements with an API key. An mcp object (for tools-list) also enables MCP for every eligible operation, so opt out each operation that agents must not use. x-google-mcp-tool: false hides a route from MCP only; keep REST security on admin routes. | OpenAPI 2.0 to 3.x Migration |
| Connect Google ADK (McpToolset) and discover in API hub / Agent Registry | McpToolset (StreamableHTTPConnectionParams) + API hub project attachment | No separate registration step is needed. After you attach the API Gateway project to API hub, the MCP server appears in API hub as {your_api} (MCP) and in Agent Registry automatically. | ADK and API Hub Discovery |
| Verify /mcp JSON-RPC lifecycle and troubleshoot -32601 / -32602 / -32000 errors | POST https://{default_hostname}/mcp with MCP-Protocol-Version: 2025-11-25 | Keep /mcp at the host root: a servers base path (such as /v2) applies to REST paths only, and {basepath}/mcp returns HTTP 404. Nest JSON request bodies under params.arguments.body ({"body": {...}}). NEVER combine x-google-api-management.mcp with x-google-model-router in one config. Rationale: API Gateway does not allow MCP and model routing in the same API config. | MCP Verification and Troubleshooting |
Execution Workflow and Validation Loop
- Upgrade and annotate the OpenAPI 3.x specification:
- The references in this skill contain the conversion rules: the Swagger 2.0 Construct Conversion Map covers each Swagger 2.0 construct, and the Complete Converted Example shows a finished spec with a Google ID token scheme. Use them before you search other sources.
- Follow OpenAPI 2.0 to 3.x Migration and OpenAPI Agent Tool Optimizer to set
openapito a 3.0.x or 3.1.x version (the examples use3.0.4), remove unsupported OpenAPI 2.0 fields (x-google-allow), definex-google-api-management.backends(withjwtAudienceordisableAuth), configurex-google-api-management.mcp.tools-list.securitywith exactly one JWT or API key scheme (add a JWT scheme to the rootsecuritylist too, in the same requirement object as any API key scheme), authorx-google-mcp-tooldescriptions stating when and why to invoke each tool, and opt out administrative routes (x-google-mcp-tool: false). - Before you deploy, give the user a short summary that states each of these points, and get approval:
- MCP is not supported for OpenAPI 2.0, so you converted the spec to OpenAPI 3.x.
- Which operations you exposed as tools, and which you opted out with
x-google-mcp-tool: false. Opted-out operations stay on REST. - If
tools/listuses a JWT scheme, the rootsecurityentry makes every REST operation without its ownsecurityrequire the JWT. The gateway rejects REST callers without it. - The MCP endpoint is
https://{default_hostname}/mcp, at the host root even when the spec sets aserversbase path. - The limits that apply: only
GET,POST,PUT,PATCH, andDELETEoperations can be tools, a gateway serves at most 1,000 tools, request parameters must be primitive types, API Gateway rejects complex nested schemas and OpenAPI 3.1 type lists (such astype: ["string", "null"]) when you create the API config, tools cannot returnHTTP 204, and MCP is stateless with UTF-8 text responses only.
- Give the same points when the user only asks for the converted spec or for advice, without a deploy.
- Preserve exact quota metric names in
x-google-api-management.metricsacross API configs so existing gateways do not fail with HTTP 500Failed to call Service Control Quota.
- Run the deterministic MCP OpenAPI validation loop before creating the API config:
- Execute
scripts/validate_mcp_openapi.pyon{candidate_openapi_spec}:python3 scripts/validate_mcp_openapi.py --spec={candidate_openapi_spec} - If
scripts/validate_mcp_openapi.pyexits with code1(status: "FAIL"), fix every reported error in{candidate_openapi_spec}(such as OpenAPI 2.0 syntax,x-google-allow, path-levelx-google-mcp-tool, undefined backend names, an operation without anoperationId, missing descriptions, invalid or duplicate tool names, a header parameter with the reservedx-google-prefix, atools-list.securityscheme that is neither anoauth2JWT nor anapiKeyscheme, a JWTtools-list.securityscheme missing from the rootsecuritylist, alternative (OR) security requirements with an API key, or anx-google-model-routeroperation in an MCP spec) and re-run th
- Execute
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
100.1kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
76.5kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
last30days-skill
64.8kAI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
CowAgent
47.5kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
