A Model Context Protocol (MCP) server implementation that enables comprehensive configuration and management of Higress. This repository also provides an MCP client built on top of LangGraph and LangChain MCP Adapters, facilitating interaction with the Higress MCP Server through a well-designed agent flow architecture. Copy the .env.example file to .env and fill in the corresponding values. In std
Add this skill
npx mdskills install higress-group/higress-ops-mcp-serverWell-structured MCP server for Higress management with extensible architecture and clear tool guidelines
1# Higress OPS MCP Server23A Model Context Protocol (MCP) server implementation that enables comprehensive configuration and management of [Higress](https://higress.cn/). This repository also provides an MCP client built on top of [LangGraph](https://www.langchain.com/langgraph) and [LangChain MCP Adapters](https://github.com/langchain-ai/langchain-mcp-adapters), facilitating interaction with the Higress MCP Server through a well-designed agent flow architecture.45## Demo67https://github.com/user-attachments/assets/bae66b77-a158-452e-9196-98060bac0df789## Config Environment Variables1011Copy the `.env.example` file to `.env` and fill in the corresponding values.1213## Start MCP Client and MCP Server1415In stdio mode, the MCP server process is started by the MCP client program. Run the following command to start the MCP client and MCP server:1617```python18uv run client.py19```2021## Add a new tool2223**Step 1: Create a new tool class or extend an existing one**2425- Create a new file in the tools directory if adding a completely new tool category26- Or add your tool to an existing class if it fits an existing category2728```python29from typing import Dict, List, Any30from fastmcp import FastMCP3132class YourTools:33 def register_tools(self, mcp: FastMCP):34 @mcp.tool()35 async def your_tool_function(arg1: str, arg2: int) -> List[Dict]:36 """37 Your tool description.3839 Args:40 arg1: Description of arg141 arg2: Description of arg24243 Returns:44 Description of the return value4546 Raises:47 ValueError: If the request fails48 """49 # Implementation using self.higress_client to make API calls50 return self.higress_client.your_api_method(arg1, arg2)51```525354**Step 2: Add a new method to HigressClient if your tool needs to interact with the Higress Console API**5556- Add methods to utils/higress_client.py that encapsulate API calls57- Use the existing HTTP methods (get, put, post) for actual API communication585960```python61def your_api_method(self, arg1: str, arg2: int) -> List[Dict]:62 """63 Description of what this API method does.6465 Args:66 arg1: Description of arg167 arg2: Description of arg26869 Returns:70 Response data7172 Raises:73 ValueError: If the request fails74 """75 path = "/v1/your/api/endpoint"76 data = {"arg1": arg1, "arg2": arg2}77 return self.put(path, data) # or self.get(path) or self.post(path, data)78```7980**Step 3: Register your tool class in the server**8182- Add your tool class to the tool_classes list in server.py83- This list is used by ToolsRegister to instantiate and register all tools84- The ToolsRegister will automatically set logger and higress_client attributes8586```python87tool_classes = [88 CommonTools,89 RequestBlockTools,90 RouteTools,91 ServiceSourceTools,92 YourTools # Add your tool class here93]94```9596**Step 4: Add your tool to `SENSITIVE_TOOLS` if it requires human confirmation**9798- Tools in this list will require human confirmation before execution99100```python101# Define write operations that require human confirmation102SENSITIVE_TOOLS = [103 "add_route",104 "add_service_source",105 "update_route",106 "update_request_block_plugin",107 "update_service_source",108 "your_tool_function" # Add your tool name here if it requires confirmation109]110```111
Full transparency — inspect the skill content before installing.