Cover image
Try Now
2025-03-29

模型上下文协议(MCP)服务器实现,可实现Higress的全面配置和管理。

3 years

Works with Finder

7

Github Watches

2

Github Forks

9

Github Stars

Higress OPS MCP Server

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.

Demo

https://github.com/user-attachments/assets/bae66b77-a158-452e-9196-98060bac0df7

Config Environment Variables

Copy the .env.example file to .env and fill in the corresponding values.

Start MCP Client and MCP Server

In 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:

uv run client.py

Add a new tool

Step 1: Create a new tool class or extend an existing one

  • Create a new file in the tools directory if adding a completely new tool category
  • Or add your tool to an existing class if it fits an existing category
from typing import Dict, List, Any
from fastmcp import FastMCP

class YourTools:
    def register_tools(self, mcp: FastMCP):
        @mcp.tool()
        async def your_tool_function(arg1: str, arg2: int) -> List[Dict]:
            """
            Your tool description.
            
            Args:
                arg1: Description of arg1
                arg2: Description of arg2

            Returns:
                Description of the return value
            
            Raises:
                ValueError: If the request fails
            """
            # Implementation using self.higress_client to make API calls
            return self.higress_client.your_api_method(arg1, arg2)

Step 2: Add a new method to HigressClient if your tool needs to interact with the Higress Console API

  • Add methods to utils/higress_client.py that encapsulate API calls
  • Use the existing HTTP methods (get, put, post) for actual API communication
def your_api_method(self, arg1: str, arg2: int) -> List[Dict]:
    """
    Description of what this API method does.
    
    Args:
        arg1: Description of arg1
        arg2: Description of arg2
        
    Returns:
        Response data
        
    Raises:
        ValueError: If the request fails
    """
    path = "/v1/your/api/endpoint"
    data = {"arg1": arg1, "arg2": arg2}
    return self.put(path, data)  # or self.get(path) or self.post(path, data)

Step 3: Register your tool class in the server

  • Add your tool class to the tool_classes list in server.py
  • This list is used by ToolsRegister to instantiate and register all tools
  • The ToolsRegister will automatically set logger and higress_client attributes
tool_classes = [
    CommonTools,
    RequestBlockTools,
    RouteTools,
    ServiceSourceTools,
    YourTools  # Add your tool class here
]

Step 4: Add your tool to SENSITIVE_TOOLS if it requires human confirmation

  • Tools in this list will require human confirmation before execution
# Define write operations that require human confirmation
SENSITIVE_TOOLS = [
    "add_route", 
    "add_service_source",
    "update_route",
    "update_request_block_plugin", 
    "update_service_source",
    "your_tool_function"  # Add your tool name here if it requires confirmation
]

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • albert tan
  • Japanese education, creating tailored learning experiences.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    5 (1)
    Avatar
    user_LaJ0utPb
    2025-04-16

    I've been using the higress-ops-mcp-server developed by the higress-group, and it has significantly streamlined my microservices control processes. The server's robust capabilities offer seamless integration and management, ensuring a smooth operational workflow. Highly recommended for anyone looking to enhance their microservices architecture. Check it out at https://github.com/higress-group/higress-ops-mcp-server!