The Higress OPS MCP Server implements the Model Context Protocol (MCP) to provide comprehensive configuration and management capabilities for Higress. It's paired with an MCP client built using LangGraph and LangChain MCP Adapters to enable interaction through a structured agent flow architecture.
Before getting started, you need to configure your environment variables:
Copy the example environment file to create your own:
cp .env.example .env
Edit the .env
file and fill in the appropriate values for your setup.
The MCP server operates in stdio mode, which means it's started by the MCP client program. To launch both the client and server:
uv run client.py
This command starts both the MCP client and server processes together.
The MCP server provides several tool categories for managing Higress:
Each tool follows a standard pattern for invocation. For example, to manage routes:
# To get all routes
get_routes()
# To add a new route
add_route(name="example-route", domain="example.com", path="/api/*", ...)
The server will provide feedback and results for each tool execution.
Certain operations like adding routes, updating service sources, and other write operations require human confirmation before execution. These tools include:
The system will prompt for confirmation before executing these sensitive operations.
Tools for general Higress management operations.
Tools for configuring request blocking rules and policies.
Tools for managing inbound traffic routing rules, including domain routing, path-based routing, and traffic splitting.
Tools for managing backend service sources that Higress connects to.
Each tool is accessible through the MCP client interface and accepts specific parameters based on its function. The server provides detailed help information for each tool when requested.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.