By Ren Yun
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.
We have broken down the problem into five core sub-issues:
Below, we will take the Gaode API as an example to detail the implementation process:
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.
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:
1. Configmap global parameter configuration for MCP server
2. 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
3. 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.
As mentioned previously, this actually involves two parts of authentication:
1. Access the previously configured route and click on Policies
2. 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:
Managed through consumer management authentication.
1. Access the 'Consumer Management' interface and create a consumer
2. Select an appropriate name and token source; three authentication methods are supported here, and we will use the simplest KeyAuth authentication.
3. Find the previously created route and click 'Edit'.
4. Enable request validation and specify the consumer.
5. When users publish the MCP service offered by Higress, they will need to carry the API key just specified. For example:
{
"amap-maps": {
"headers": {
"Authorization": "Bearer xxx"
},
"transport": "sse",
"url": "http://12xx.94:8080/amap-maps/sse"
}
}
1. 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.
2. Open your Dify and install the 'SSE Discovery and Invocation MCP Tool' following the example in the image below:
3. If you encounter issues during subsequent use, you can downgrade this tool version to 0.0.10.
4. Click the 'Authorize' button to configure the SSE tool. You can directly paste the MCP Server configuration from Step Three here.
5. Create an Agent and enter it.
6. Following the example in the image below, enable MCP tool invocation, fill in appropriate prompts, and select a suitable model, such as QWEN-MAX.
7. 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.
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.
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.'
The Practice of Integrating Stdio MCP Server with One-click Access by Cherry Studio and Dify
Returning to Open Source, the Inner Monologue of Java and Go Developers Contributing to AI
563 posts | 54 followers
FollowAlibaba Cloud Native Community - April 16, 2025
Alibaba Cloud Native Community - May 20, 2025
Alibaba Cloud Native Community - April 18, 2025
Alibaba Cloud Native Community - May 15, 2025
Alibaba Cloud Native Community - April 3, 2025
Alibaba Cloud Native Community - May 23, 2025
563 posts | 54 followers
FollowAccelerate AI-driven business and AI model training and inference with Alibaba Cloud GPU technology
Learn MoreTop-performance foundation models from Alibaba Cloud
Learn MoreOffline SDKs for visual production, such as image segmentation, video segmentation, and character recognition, based on deep learning technologies developed by Alibaba Cloud.
Learn MoreOpenAPI Explorer allows you to call an API through its web interface or WebCLI, and view the entire process.
Learn MoreMore Posts by Alibaba Cloud Native Community