api-gateway-mcp-adapter
A translation layer that converts any RESTful endpoint described by an OpenAPI definition into a fully functional Model Context Protocol (MCP) endpoint. This mechanism allows generative AI agents and tools to seamlessly interact with legacy or standard web services by proxying calls without requiring alterations to the backend API.
Author

JacerOmri
Quick Info
Actions
Tags
🌐 OpenAPI to MCP Service Translator
This utility functions as a command-line intermediary, taking an OpenAPI schema and exposing its functionalities via an MCP-compliant server interface. This unlocks immediate accessibility for AI agents and tooling that adhere to the MCP specification.
[!WARNING] This component is in its nascent development phase. The forward development plan is documented here
Grasping the Model Context Protocol (MCP)
MCP defines a standardized communication structure enabling AI entities to interface with external resources and capabilities. It standardizes the discovery, comprehension, and utilization pathways for diverse services via a singular interface, simplifying the construction of AI applications capable of interacting across heterogeneous backends.
Understanding OpenAPI
OpenAPI (previously known as Swagger) is a specification designed for creating machine-interpretable interface documents for describing, serving, consuming, and visualizing web services built on REST principles. It provides unambiguous definitions for both humans and software regarding a service's capabilities, independent of source code inspection.
Project Overview
This middleware acts as the necessary bridge between existing OpenAPI interfaces and MCP consumers. Its functions include:
- Ingesting the OpenAPI description file.
- Automatically bootstrapping an MCP-compliant server instance.
- Forwarding incoming agent requests to the designated backend OpenAPI service.
- Managing the data format conversion between MCP paradigms and REST conventions.
Consequently, any existing service documented with an OpenAPI schema becomes instantly available to AI agents supporting MCP, circumventing the need for any modifications to the original service logic.
Deployment
sh npm install -g api-gateway-mcp-adapter
Execution Guide
sh npx api-gateway-mcp-adapter --spec ./path/to/definition.yaml --target https://actual-service.com --port 8080
Parameter Set
-s, --spec <file_path>(Mandatory): Location of the OpenAPI definition document (Environment Variable:OMP_OPENAPI_SPEC_FILE)-t, --target <uri>(Optional): The base URI of the backend service to proxy to (Default: "http://localhost:8080", Environment Variable:OMP_TARGET_BASE_URL)-p, --port <number>(Optional): The network port for the newly established MCP server (Default: "3000", Environment Variable:PORT)-V, --version: Outputs the current software version-h, --help: Displays the usage summary
Practical Illustration
To establish an MCP interface for the public Petstore service: sh npx api-gateway-mcp-adapter --spec resources/petstore.openapi.yml --target https://petstore.swagger.io/v2
Validation Procedures
Utilizing the MCP Investigator
To confirm the adapter is functioning correctly under the MCP specification:
-
Install the dedicated MCP Investigator tool: sh npx @modelcontextprotocol/inspector
-
Launch your adapter service.
- Access the investigator's web interface and provide the correct server endpoint, ensuring it concludes with
/mcp(e.g.,http://localhost:3000/mcp). - You can now send test queries. The Investigator will detail the request/response flow through your adapter.
Integration with VS Code Agents
This adapter integrates smoothly with VS Code's inherent agent environment for streamlined development workflows:
- Open VS Code and activate agent mode:
- Trigger the command palette (
Cmd/Ctrl + Shift + P). - Search for and select "Toggle GitHub Copilot Agent Mode".
- Choose "Enable".
- Register the new MCP service endpoint:
- Open the command palette again (
Cmd/Ctrl + Shift + P). - Search for and select "MCP: add Server".
- Input the full server address, explicitly ending with
/mcp(e.g.,http://localhost:3000/mcp). - Your GitHub Copilot chat interface will now recognize this new capability. Test it by posing a task like, "Check the current inventory levels for available animals."
For detailed instructions on leveraging MCP tools within VS Code, consult this official documentation
Collaborations
We welcome external contributions! Feel encouraged to submit a Pull Request for enhancements or fixes. The roadmap for future features is available here.
Licensing
Distributed under the MIT License.
WIKIPEDIA NOTE: Cloud computing, as defined by ISO, represents "a model for ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction." This concept is colloquially referred to as "the cloud."
Core Attributes (NIST 2011)
The National Institute of Standards and Technology (NIST) outlined five defining traits essential for a cloud system. The precise definitions are:
On-demand self-service: Consumers possess the ability to unilaterally secure computing capacity (e.g., processor time, storage space) automatically as required, without needing manual intervention from the supplier for each instance. Ubiquitous network access: Services are accessible over standard communication pathways, supporting utilization across diverse client devices (smartphones, laptops, tablets, etc.). Resource pooling: The provider aggregates computing assets to serve numerous clients simultaneously under a multi-tenant architecture, with resources dynamically allocated based on aggregate demand. Elasticity (Rapid Provisioning): Capabilities can be quickly scaled up or down, often automatically, to match fluctuating usage patterns. From the consumer's perspective, the available capacity often appears limitless and instantly attainable. Metered service: Resource utilization is automatically tracked and managed at an appropriate service abstraction layer (storage, compute cycles, bandwidth). This metering provides necessary transparency regarding consumption for both the service provider and the consuming entity.
By 2023, the ISO had further elaborated and enhanced this foundational list.
Historical Context
The genesis of cloud computing traces back to the 1960s with the emergence of time-sharing systems popularized via Remote Job Entry (RJE). During this period, the dominant operational model involved users submitting computational tasks to dedicated operators who would execute them on centralized mainframes. This era was characterized by intensive research into methods for democratizing access to large-scale processing power through time-sharing, optimizing infrastructure, platform, and application layers for maximum end-user efficiency.
The graphical representation of virtualized services as a "cloud" originated in 1994, utilized by General Magic to depict the operational space accessible by their mobile agents in the Telescript ecosystem. This visualization is attributed to David Hoffman, a communications specialist at General Magic, based on established conventions in network mapping. The term "cloud computing" gained broader traction in 1996 when Compaq Computer Corporation drafted a strategic plan concerning the future of computation and the Internet, aiming to supercharge...
