Converting Legacy REST APIs: The End of MCP Middleware with Google Cloud API Gateway
Converting legacy REST APIs into native MCP tools via Google Cloud API Gateway eliminates the need for intermediate servers in your architecture.
Fabiano Brito
CEO & Google Cloud Architect, Autenticare
Converting legacy rest apis is the process of transforming traditional endpoints into native Model Context Protocol (MCP) tools directly at the traffic management layer, allowing AI agents to consume corporate data seamlessly. Adopting Agentic Engineering in large corporations often runs into the architectural complexity of connecting Large Language Models (LLMs) to established transactional systems.
The conventional approach requires developing an intermediary MCP server—a middleware whose sole function is to translate the agent’s intents into calls that the infrastructure understands. This topology adds latency, duplicates security rules, and increases platform maintenance costs. According to an announcement made by Google on September 24, 2026, this fragmented architecture has become obsolete.
Google Cloud API Gateway has introduced remote MCP server capabilities in Public Preview. This update provides a fast and secure path to manage and expose Cloud Run services directly to agents.
0
Intermediary servers required to expose MCP tools with the new API Gateway feature — [Google Developers Blog](https://developers.googleblog.com/en/turn-your-rest-apis-into-mcp-tools-with-google-cloud-api-gateway/)
The Elimination of the Intermediary MCP Server
For IT leaders and cloud architects, the primary technical advantage of this update is a drastic reduction in complexity when integrating agents. Before this update, integrating an agent with a legacy database meant deploying a Node.js or Python service that registered as an MCP server, received invocations via JSON-RPC, re-authenticated the request, executed the REST call, and then formatted the response back to the agent.
This approach is risky from a security standpoint. Every piece of middleware introduced into the architecture is a new attack vector and a single point of failure that must be monitored, updated, and scaled alongside agent traffic.
With the ability to act natively as a remote MCP server, Google Cloud API Gateway intercepts this need. Developers can now expose their existing REST operations as out-of-the-box MCP tools for agents without having to build, host, or maintain isolated infrastructure.
- • Maintaining separate containers for MCP servers.
- • Duplication of authentication and authorization logic (API Keys, JWT).
- • Manual synchronization of logs and distributed tracing.
- • Increased time and cost for deploying new tools.
- • Direct transcoding at the API management layer.
- • Immediate reuse of existing security policies.
- • Zero extra infrastructure to host and monitor.
- • Configurable exposure via annotations in the OpenAPI spec.
JSON-RPC Transcoding and Security Policy Preservation
Tool orchestration by AI agents requires strict communication protocols. The Model Context Protocol operates mostly with structured payloads and remote procedure calls. The engineering behind the new feature focuses on an elegant abstraction of this communication process.
According to the technical specification publicly released by Google, the API Gateway now accepts standard MCP JSON-RPC requests centralized in a single endpoint. When an agent decides it needs to query a database or trigger a workflow, it sends the tools/call instruction.
The gateway receives this instruction and automatically transcodes the JSON-RPC request to the corresponding REST request format in the corporate backend. After execution, it also translates the REST response back into MCP semantics.
The main architectural differentiator here lies in governance: this process occurs while keeping all existing security policies completely unchanged.
| Governance Layer | API Gateway Behavior (MCP Mode) |
|---|---|
| Authentication (JWT / API Key) | Transparently validated before transcoding, reusing the exact REST policies. |
| Quotas and Rate Limiting | Remain active. Agent requests consume the pre-configured quota of the legacy service. |
| Logging and Monitoring | Execution logs maintain the unchanged corporate format, preserving the audit trail. |
This guarantee of non-regression in security is fundamental for large-scale adoption, an approach we discuss in depth in our analyses on the foundation of enterprise agent deployments. When the CTO knows the LLM won’t be able to bypass database usage quotas and will be blocked if the JWT token expires, adoption gains immediate executive traction.
Implementation and OpenAPI Requirements
Transforming a corporate legacy of REST endpoints into available tools isn’t automatic without adhering to strict API documentation standards. Cloud infrastructure requires clear formal contracts to map MCP parameters to HTTP parameters (Path, Query, Body).
For the gateway’s internal MCP server to be enabled, there is a strict prerequisite regarding technical documentation: the specification must be in OpenAPI 3.0.x or 3.1.x format.
Earlier versions, such as OpenAPI 2.0 (formerly Swagger), are not natively supported by this routing feature. Companies running legacy systems under version 2.0 must perform a technical migration of their specifications to version 3.0.x or higher before attempting to expose tools.
The Annotation Flow (Opt-in)
Granular control over what is or isn’t exposed to agents is handled via direct annotations in the OpenAPI specification file (YAML or JSON), eliminating configurations in fragmented visual dashboards. This Infrastructure as Code (IaC) model favors CI/CD pipelines.
Global Enablement in the Document
Developers must enable MCP server exposure globally in the document using the x-google-api-management.mcp annotation.
Granular Operation Selection
Each endpoint (operation) can be customized, included, or omitted individually using the specific x-google-mcp-tool annotation.
Tool Validation Criteria
For the annotation to take effect and the tool to be created, the operation [must imperatively have a backend configuration and a non-empty description](https://developers.googleblog.com/en/turn-your-rest-apis-into-mcp-tools-with-google-cloud-api-gateway/). The description is vital, as it's the text the AI agent will read to decide whether or not to invoke the tool.
# Conceptual example of an annotation structure in an OpenAPI 3.0.x specification
openapi: 3.0.3
info:
title: Corporate Customer API
version: 1.0.0
x-google-api-management.mcp: true # Global opt-in
paths:
/clientes/{id}:
get:
summary: Returns customer data
description: Fetches the full details of a specific customer by ID. # Must not be empty
x-google-mcp-tool: true # Operation exposure
x-google-backend:
address: https://backend-service.internal
Automated Discovery: The Role of API Hub and Agent Registry
The technical creation of tools is only the first half of the challenge. In large corporations, knowing which tools exist, which are deprecated, and which should be used for certain data flows is a governance (discoverability) problem.
The Google Cloud ecosystem addresses this by integrating the process with API Hub. When connecting the API gateway to this hub, the configured MCP server is automatically published with its specific MCP layer metadata.
Once published, this server and its respective back-end tools appear in the Agent Registry. This means corporate tools become instantly discoverable by AI agents and the developers orchestrating them.
This level of governance automation eliminates the friction found in legacy architectures, where data teams had to manually document MCP endpoints in internal repositories and provide the middleware host to the teams managing the LLMs. For organizations already leveraging connected apps strategies in the workspace, expanding this self-discovery capability to their proprietary APIs is the natural evolution of orchestration.
Similar to what is executed in more complex integrations with asynchronous processes and webhook strategies, centralizing routes and their contracts directly at the gateway removes opacity points in the enterprise architecture.
Final Perspectives for Cloud Engineering
Converting legacy REST APIs through API managers with native support for the Model Context Protocol redefines the work of infrastructure teams.
The model imposed by the Google Cloud API Gateway Public Preview proves that the future of enterprise agents will not rely on creating more application silos (like isolated Node.js middlewares), but rather on adapting the network edge (the gateway) to understand the requests generated by Artificial Intelligence.
Responsibility shifts back to API contracts. A rigorous OpenAPI specification, properly annotated and supporting native JWT policies, becomes the true long-term asset. Agent traffic is now treated as just another B2B consumer of the company’s pre-existing infrastructure, keeping additional infrastructure costs close to zero and maintaining airtight security compliance.
Agents orchestrating your corporate APIs
Implement native MCP conversion in your Cloud Run infrastructure and eliminate the technical debt of intermediary middlewares while keeping your data security intact.
Frequently Asked Questions
What is required to enable the MCP server on Google Cloud API Gateway? A properly configured OpenAPI 3.0.x or 3.1.x specification is required. OpenAPI 2.0 versions are not natively supported and must be migrated to newer versions before exposure.
How are authentication rules and quotas handled during MCP conversion? The API Gateway performs transcoding while maintaining the original JWT or API Key-based authentication policies. Furthermore, consumption quotas and access log rules remain active and unchanged for agent requests.
How can agents and developers discover these new tools? When the API Gateway is connected to API Hub, the MCP server is automatically published, sending its metadata to the Agent Registry. This makes the tool inventory instantly discoverable and ready to be orchestrated.
Sources: