From OpenAPI to MCP: Revitalizing Enterprise APIs within AI Assistants
Ren Yun
|
May 7, 2025
|
Background

The MCP (Model Context Protocol) is an open-source communication standard released by Anthropic in November 2024. Its core goal is to eliminate integration barriers between large language models (LLMs) and heterogeneous data sources and tools by establishing a unified interaction paradigm. This protocol addresses the data silo problem in AI through three levels of innovation, realizing a de facto 'Internet of Everything' based on MCP, including but not limited to data and file systems, operating any resources on Alibaba Cloud, browser automation, etc.
This technological breakthrough allows AI applications to truly achieve 'Internet of Everything'—intelligent interactions can be completed through a unified protocol, from document processing on personal devices to enterprise-level cloud resource scheduling.

Figure 1: Official Architecture Diagram of MCP Protocol
However, the challenge commonly faced by enterprises is: how to efficiently convert existing OpenAPI into MCP tools that can be directly invoked by AI assistants? This article will detail how to implement this transformation process through Higress, enabling your existing APIs to be revitalized on AI platforms like Dify.
Problem Breakdown and Implementation Plan
We have broken down the problem into five core sub-issues:
Convert the schema of the existing OpenAPI to MCP configuration
Route requests to OpenAPI via Higress
Implement dual authentication for OpenAPI and MCP
Select suitable protocols to connect with the AI assistant
Optimize prompts to enhance the efficacy of MCP tools
Below, we will take the Gaode API as an example to detail the implementation process:
Step One: Convert OpenAPI Schema to MCP Configuration
OpenAPI is written in YAML or JSON, defining a language-agnostic HTTP API interface, providing a uniform information transfer method for all stages of the API lifecycle. This allows developers to discover and use corresponding services without needing access to the source code. For example, a social APP wanting to obtain geographic location information for both parties does not need to build its own Gaode map or acquire the source code for Gaode map; instead, it can obtain the functionality to get this geographic location information through the Gaode map API.
A standard OpenAPI.json schema is as follows:

We need a tool to extract key information from it, such as paths, methods, parameters, response formats, etc., and then convert it to a new description based on MCP specifications to return to the client.
Here, we can use the openapi-to-mcp tool developed by Higress to automate this repetitive and cumbersome process, inputting a JSON to obtain a standard MCP configuration.
Step Two: Configure API Routing via Higress
As a cloud-native gateway, Higress can elegantly route requests to the backend OpenAPI services. For complete manual operations, please refer to this article, with the general process as follows:
Configmap global parameter configuration for MCP server
Configure the service source for existing APIs. If there are multiple existing API blocks here, it is recommended to create a service source for each block
Create a new routing configuration and input the MCP YAML configuration from Step One.
We recommend an automated operation method, where the OpenAPI from Higress can be fed into the Deepseek large model to assist in creating a client that automatically configures the above steps.
You can access Higress's OpenAPI at this address.
Step Three: Implementing Dual Authentication
As mentioned previously, this actually involves two parts of authentication:
Authentication between Higress and the existing OpenAPI when routing
Authentication between the user and Higress while accessing the SSE link from Higress
Authentication between Higress and the Backend API:
Access the previously configured route and click on Policies
Locate the MCP server configuration. In the generated MCP configuration, you can find the request headers for each request based on the actual authentication method of the existing API and add the corresponding headers as shown below:
Authentication between the User and Higress:
Managed through consumer management authentication.
Access the 'Consumer Management' interface and create a consumer
Select an appropriate name and token source; three authentication methods are supported here, and we will use the simplest KeyAuth authentication.
Find the previously created route and click 'Edit'.
Enable request validation and specify the consumer.
When users publish the MCP service offered by Higress, they will need to carry the API key just specified. For example:
Step Four: Use the Published MCP Tool on Dify
If you have not deployed Dify, it is recommended to use the one-click deployment link on Jisuan Nest to avoid the troubles of installation and environment configuration.
Open your Dify and install the 'SSE Discovery and Invocation MCP Tool' following the example in the image below:
If you encounter issues during subsequent use, you can downgrade this tool version to 0.0.10.
Click the 'Authorize' button to configure the SSE tool. You can directly paste the MCP Server configuration from Step Three here.
Create an Agent and enter it.
Following the example in the image below, enable MCP tool invocation, fill in appropriate prompts, and select a suitable model, such as QWEN-MAX.
Start a conversation to invoke the MCP tool.
Note: The use of SSE protocol currently is due to AI assistants' inadequate support for streamable HTTP. Higress natively supports streamable HTTP interaction, and a seamless switch can occur after the AI assistant's functionality improves.
Step Five: How to Optimize Prompts
Higress supports fine-tuning of request and response templates using go templates and gjson expressions.
If practical testing reveals that the model's understanding of MCP is not very clear, you may refer to this article for manual tuning.
Conclusion
How AI will develop in the future is likely unpredictable. Perhaps models will be able to call meteorological satellites to predict monsoons, weaving the climate's longitude and latitude with data; perhaps they will control robotic arms to carve nano chips, making algorithms the creators of the microscopic world; or even unravel metaphors of human civilization across millennia, deciphering subconscious codes in the rhythms of the 'Iliad' and the cracks of Dunhuang murals, the codes we ourselves have yet to realize.
Perhaps the truly disruptive moment will not be when AI learns to manipulate satellites or machines, but when it suddenly gazes at Van Gogh's 'Starry Night' and says: 'I understand the loneliness within this whirlpool, but human suffering is ultimately just a beautiful probability cloud to me.'