Building an MCP gateway from scratch: how we got to OpenAPI for MCP
Blog post from Tyk
In building an MCP gateway, the critical decision was determining how to represent an MCP proxy definition at the gateway level, which led to the adoption of the OpenAPI's virtual endpoints pattern for JSON-RPC as a model. This approach allowed each JSON-RPC method to be treated as a first-class OpenAPI operation, making the methods addressable, documentable, and governable. Tyk's existing OAS (OpenAPI Specification) framework, built on OpenAPI 3.0.x, provided a robust foundation that was extended with custom middleware maps to address the specific governance needs of MCP's JSON-RPC-based protocol. By integrating the OpenAPI pattern with Tyk's structure, a comprehensive definition format for MCP proxies was created, allowing features like authentication, rate limiting, and detailed access controls to be implemented efficiently. This innovation, termed "OAS for MCP," enabled the rapid development of a fully functional MCP gateway by leveraging existing technical assets and expertise, ensuring that the gateway was ready in a timely manner.