How Higress AI Gateway Turns Business APIs into an MCP Server
The article explains how to replace manual MCP Server development with Higress AI Gateway's API‑to‑MCP feature, showing step‑by‑step Docker setup, configuration of a simple SpringBoot service, MCP tool definition, request‑template options, and the resulting zero‑code deployment for AI agents.
Background
Previous MCP Server tutorials required writing Java or TypeScript code for each service, similar to developing a regular business API and adding tool annotations. The goal is to expose a REST API as an MCP Server without writing new server code.
Why use Higress AI Gateway
Higress is an open‑source cloud‑native API gateway built on Istio and Envoy. Its MCP Server capability allows declarative conversion of any REST API into an MCP Server, eliminating the need for custom MCP server code.
Setup
Create a Docker network for MCP services: docker network create mcp Pull and run the all‑in‑one Higress image. The example maps ports 8001, 8080, 8443 to host ports 9001, 9080, 9443 to avoid conflicts:
mkdir higress && cd higress
# Pull the latest Higress all‑in‑one image
docker pull higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/all-in-one:latest
docker run -d --rm --name higress-ai -v ${PWD}:/data \
-p 9001:8001 -p 9080:8080 -p 9443:8443 --network mcp \
higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/all-in-one:latestPull a Redis image for state storage:
docker run -d --rm --name higress-redis -p 6379:6379 --network mcp higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/redis-stack-server:7.4.0-v3Configure MCP Server in Higress
Develop a simple SpringBoot endpoint (e.g., a GET /test1 returning weather data).
In the Higress console, create a service source that points to the SpringBoot service.
Create an MCP service and add a tool definition. Example YAML:
server:
description: "获取指定城市的天气"
name: "mcp-weather"
tools:
- args:
- description: "城市名称"
name: "name"
position: "query"
required: true
type: "string"
description: "根据指定城市获取指定的天气信息."
name: "get-weather"
requestTemplate:
argsToUrlParam: true
method: "GET"
url: "http://192.168.4.3:8001/test1"
responseTemplate:
body: |-
# 天气信息
{{.data}}Saving the configuration creates an MCP Server that forwards AI Agent requests to the original REST endpoint without changing backend code.
Request template options
The gateway supports four mutually exclusive ways to map tool arguments to the downstream request:
body : Manually construct the request body using a template.
argsToJsonBody : Set argsToJsonBody: true to send all unspecified arguments as a JSON object in the body and automatically add Content‑Type: application/json; charset=utf-8.
argsToUrlParam : Set argsToUrlParam: true to encode unspecified arguments as URL query parameters.
argsToFormBody : Set argsToFormBody: true to encode arguments as application/x-www-form-urlencoded in the body.
Only one option may be used per tool; configuring more than one results in a validation error.
Additional fields prependBody and appendBody allow preserving the original JSON response while adding explanatory or usage information, useful when converting OpenAPI specifications to MCP tools.
Additional features of Higress MCP Server
Unified authentication and authorization for secure AI tool calls.
Fine‑grained rate limiting.
Comprehensive audit logs of tool invocations.
Observability for performance and health monitoring.
Support for multiple MCP protocol versions (e.g., 20241105 and 20250326) and transport modes such as POST+SSE, Streamable HTTP, and native WebSocket.
With these steps, developers can expose existing REST APIs as MCP Servers in minutes, enabling AI agents to access databases, external services, and other data sources without additional code.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubiquitous Tech
A ubiquitous public account for pirate enthusiasts, regularly sharing curated experiences, tech learning, and growth insights. Currently publishing articles on AI RAG customer service, AI MCP technology, and open-source design. Personal free Knowledge Planet: Awakening New World Programmer.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
