Search

CN-121984805-A - Large-model MCP micro-service and MCP aggregation gateway system and method thereof

CN121984805ACN 121984805 ACN121984805 ACN 121984805ACN-121984805-A

Abstract

The invention relates to a large-model MCP micro-service and MCP aggregation gateway system and method. The system deeply blends the MCP protocol into a micro-service system by constructing a unified service treatment base, and solves the problems of protocol splitting, treatment deletion, ecological isolation and the like in the integration of the traditional micro-service and a large model. The system core comprises a service management module, a service registration and consumption module, a service security control module, a service load balancing module, a service flow control module, a link tracking and index display module, a gateway access and conversion module, a gateway service discovery and routing module and a gateway configuration and management control module. The invention realizes unified management of MCP protocol and traditional HTTP/gRPC/thread protocol, provides the capabilities of MCP service full life cycle management, intelligent gateway protocol conversion, large model double-mode call, enterprise-level security management and control and the like, remarkably reduces the integration complexity and development operation and maintenance cost of the large model in an enterprise system, and improves the observability, security and expansibility of the system.

Inventors

  • YU FENG
  • LIN XIANFEI
  • HU TAO

Assignees

  • 国泰海通证券股份有限公司

Dates

Publication Date
20260505
Application Date
20251223

Claims (15)

  1. 1. A large model MCP micro-service and MCP aggregation gateway system, comprising: The service management module is used for establishing communication connection with one or more MCP SERVER ends, acquiring and dynamically maintaining Tools, prompts, resources metadata, and forming a unified MCP service bazaar; a service registration and consumption module for registering the MCP service to a service registry in an application dimension and supporting discovery and consumption of other service instances from the registry; The service security control module supports API-KEY, JWT token authentication and role-based access control and is used for finely managing and controlling authority of calling Tools of the client; The service load balancing module is used for realizing connection level load balancing between the MCP client and the server and supporting various load balancing algorithms and multidimensional node selection strategies; the service flow control module is used for providing flow control strategies of flow control degradation, black and white lists, flow dyeing, blue-green release and gray release; The link tracking and index display module supports cross-protocol link tracking and unified index display, and realizes link penetration of HTTP, gRPC, thrift and the MCP; The gateway access and conversion module is used as a unified entry to support bidirectional conversion and routing forwarding between the MCP protocol and the HTTP/gRPC/thread protocol; gateway service discovery and routing module for dynamically sensing the status of a back-end service node, supporting multiple routing policies and load balancing mechanisms, and The gateway configuration and management control module is used for providing a visual configuration interface and supporting dynamic configuration and monitoring of security policies, flow rules and fault injection.
  2. 2. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the service administration module further includes: the timing task unit is used for starting interaction with the MCP SERVER ends according to a preset timing rule; The metadata management unit is used for receiving and analyzing Tools, prompts, resources resource data acquired from the MCP SERVER end, extracting capability information and detailed interface documents which are contained in the Tools, prompts, resources resource data and related to the MCP service provider, and further carrying out arrangement and formatting processing on the acquired capability information and interface documents so as to enable the acquired capability information and interface documents to meet the data storage specification in software; and the service bazaar construction unit is used for integrating the MCP service information, finely classifying Tools, prompts, resources and carrying out label management to form a visual service bazaar interface.
  3. 3. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the service registration and consumption module further includes: The registration center interaction unit is used for acquiring MCP service information, packaging the service information and sending a registration request, and supporting multi-registration center adaptation; the health check unit is used for monitoring the health state of the service node through TCP (transmission control protocol) probe activity, HTTP (hyper text transport protocol) probe activity and custom interface probe activity; And the cache management unit is used for locally caching the service instance information and supporting a real-time updating mechanism.
  4. 4. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the service security control module further includes: a multi-factor authentication unit supporting independent or combined authentication of the API-KEY and the JWT token; the authority granularity control unit is used for realizing the configuration of the operation authority of the client to the specific Tools resource; and the audit log unit is used for recording an operation log of the whole process of access authentication and authority verification and supporting the tracing and analysis of the security event.
  5. 5. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the service load balancing module further includes: A request receiving unit, configured to continuously receive a service call request from an MCP client, and obtain a service identifier and metadata information associated with the request; The node information collection unit is used for periodically acquiring all available service end node information of the target MCP service from the service management registry, including but not limited to IP address, port number, service version, machine room region, current connection number, health state and weight parameters of the node, and constructing a dynamically updated available node list; the load balancing decision unit integrates various load balancing algorithms and is used for selecting one algorithm from the load balancing strategies of random weight, polling and minimum connection number for the current request allocation according to preset configuration; the multidimensional node selection strategy unit is used for screening and sequencing the available node list according to a preset node selection strategy; The request distribution and forwarding unit is used for selecting an optimal service end node according to the joint output of the load balancing decision unit and the node selection strategy unit, forwarding a client request to the node, and recording a distribution log; The load monitoring and dynamic optimizing unit is used for monitoring load indexes of the nodes of each server end in real time, including connection number, response time and CPU/memory utilization rate, and dynamically adjusting load balancing algorithm parameters or switching algorithm according to monitoring data so as to adapt to system load change.
  6. 6. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the service flow control module further includes: The request analysis and feature extraction unit is used for receiving the MCP client request, analyzing the request header, the request body and the metadata, and extracting feature information comprising a request source IP, a client identifier, an interface path and a request parameter; The policy matching engine unit is used for presetting a plurality of flow control policy libraries, rapidly matching the applicable control policies according to the extracted request characteristics and supporting the multi-version management and priority configuration of the policies; the flow limit execution unit is used for executing a control mechanism of current limiting control, fusing degradation and queuing waiting; the black-and-white list filtering unit is used for maintaining a black-and-white list of an IP level and a client level, directly rejecting a black list request and only allowing the white list request to pass through; The traffic dyeing and routing control unit is used for marking a dyeing label for the request according to the service rule, supporting blue-green release and gray release, and distributing different experimental strategies according to the dyeing label; The strategy dynamic configuration and thermal updating unit supports updating the flow control strategy in real time through a configuration center or a management and control interface, changes the second level to take effect, and does not need to restart the service; And the monitoring statistics and alarming unit is used for counting the execution effect indexes of each strategy in real time, including the passing rate, the rejection rate, the average response time and the error rate, and supporting the real-time alarming and visual report based on the threshold value.
  7. 7. The large model MCP micro service and MCP aggregation gateway system of claim 1, wherein the link tracking and index presentation module further includes: The cross-protocol link association unit is used for realizing association and penetration of the multi-protocol call chain based on Trace ID; the multi-stage tracking unit supports the link tracking granularity of a service stage, a method stage and a function number stage; And the visual instrument unit provides a unified display interface for link topology, performance indexes and error statistics.
  8. 8. The large model MCP micro service and MCP aggregate gateway system of claim 1, wherein the gateway access and translation module is of a hierarchical design, including: the protocol access layer is used for realizing monitoring and distribution of the MCP protocol based on an asynchronous network application framework; A control filter layer for realizing authentication and flow control functions; the field check conversion layer is used for carrying out request analysis, field dictionary check and mapping conversion; a protocol conversion layer including a plurality of protocol codecs through which protocol conversion is performed, and And the routing layer is used for realizing routing rule management and routing distribution.
  9. 9. The large model MCP micro service and MCP aggregate gateway system of claim 1, wherein the gateway service discovery and routing module further includes: The multi-cluster isolation unit supports the isolation of service clusters in a machine room and service grouping mode; The routing rule engine supports multidimensional routing rules of path matching, request attribute matching, field condition matching and conditional routing matching; and the dynamic weight and gray level routing unit supports weight routing, request head routing and IP routing, and realizes gray level release and flow scheduling.
  10. 10. The large model MCP micro service and MCP aggregate gateway system of claim 1, wherein the gateway configuration and management module further includes: the AI auxiliary configuration generation and auditing unit is used for intelligently processing the gateway configuration rules based on the large model capacity, and specifically comprises the following steps: The intelligent configuration generating subunit receives the configuration requirement described by a user in natural language, analyzes the requirement semantics through a large model and automatically generates corresponding gateway configuration rules including but not limited to routing rules, field mapping rules, security policies and flow control rules; A configuration semantic auditing subunit performs semantic analysis and compliance checking on rules manually configured or modified by a user, identifies potential configuration conflicts, security risks or performance problems, and provides optimization suggestions; before configuration updating, based on service dependency graph and historical flow data, simulating and analyzing potential influence of configuration change on system stability, performance and upstream and downstream services to generate a risk assessment report; and the intelligent rollback subunit of the configuration version automatically recommends or executes rollback to the history stable version when abnormal indexes appear after the new configuration is detected to be online, and generates rollback reason analysis.
  11. 11. A method for implementing a large model MCP micro service and MCP aggregation gateway based on the system of any one of claims 1 to 10, the method comprising the steps of: (1) The service management step is to interact with MCP SERVER ends at regular time, acquire and store Tools, prompts, resources resources, and construct an MCP service mart; (2) The service registration step, after packaging MCP service information, registering the MCP service information to a service management registration center, wherein the MCP service information comprises a service name, a version, an IP address and a port number; (3) The service discovery step is used for acquiring service instance information from a registry, performing health check and filtering, and generating an available node list; (4) The request processing step is that a MCP client request is received, and after authentication and authorization are carried out, the MCP client request is routed to a target service node based on a load balancing strategy; (5) The protocol conversion and route forwarding step is that the MCP request is converted into HTTP/gRPC/thread protocol through gateway, or the traditional protocol request is converted into MCP protocol and forwarded to the target node according to route rule; (6) Selecting a target service instance from available nodes according to a load balancing algorithm and a node selection strategy; (7) And a link tracking and monitoring feedback step, namely tracking and recording the request full link, collecting performance indexes, visually displaying and supporting strategy dynamic adjustment.
  12. 12. The large model MCP micro service and MCP aggregation gateway implementation method of claim 11, wherein the service governance step further includes: The method comprises the steps of (1.1) monitoring resource variation, namely supporting receiving a MCP SERVER-end resource update notification through a message subscription mechanism; (1.2) metadata synchronization supporting synchronization of tags, documents, and production information of MCP services to a database; (1.3) service classification, supporting multi-dimensional classification of MCP services according to the functional field and the application scene.
  13. 13. The large model MCP micro service and MCP aggregation gateway implementation method of claim 11, wherein the request processing step further includes: (4.1) flow control, supporting to perform throttling, degradation or black and white list filtering according to request source, interface and parameter matching flow control strategy; (4.2) load balancing, namely supporting the selection of service nodes by combining a node selection strategy with a load balancing algorithm; and (4.3) security authentication, supporting API-KEY/JWT authentication and RBAC authority verification in turn, and rejecting unauthorized requests.
  14. 14. The method for implementing the large-model MCP micro-service and MCP aggregation gateway according to claim 11, wherein the protocol conversion and routing forwarding step further includes: (5.1) request mapping supporting mapping and renaming of fields of MCP protocol and legacy protocol; (5.2) type conversion, namely supporting cross-protocol conversion of processing date, number and enumeration types; (5.3) compatibility processing, supporting the solution of compatibility problems between different protocol versions.
  15. 15. The large model MCP micro service and MCP aggregation gateway implementation method of claim 11, wherein the method further supports large model dual mode service invocation: The first mode is manual declaration type quotation, a user selects a service through an MCP service mart and configures the quotation, and the system realizes the RPC call with transparent bottom layer; the second mode is autonomous scheduling of the large model, by intercepting the large model Prompt, utilizing RAG to search a matching tool from a service mart, after multiple rounds of promt optimization, invoking the matching tool by MCP CLIENT, and returning the result to the large model.

Description

Large-model MCP micro-service and MCP aggregation gateway system and method thereof Technical Field The invention relates to the technical field of computer software, in particular to the field of a micro-service management system and a gateway architecture, and specifically relates to a large-model MCP micro-service and MCP aggregation gateway system and a method thereof. Background 1. Summary of the prior art Currently, micro-service architecture has become a mainstream technical solution of core systems in the financial industry, especially in the securities industry, where high concurrency, low latency RPC communication and multi-protocol compatibility are critical requirements. In the prior art, the micro-service framework and the API gateway are widely applied to service management and support HTTP, gRPC, thrift protocols. Meanwhile, with the application of large models in the financial field, how to combine traditional micro services with large model capabilities becomes a new challenge. MCP (Model Context Protocol ) is an open communication protocol proposed by Anthropic, and aims to establish a standardized connection framework between a Large Language Model (LLM) and external data sources and tools, wherein the core positioning and technical characteristics are that (1) a unified 'language' interface is provided for the LLM as a communication bridge, so that the LLM can be connected with external resources such as databases, APIs, local files and the like in a plug-and-play manner like a USB-C interface, and bidirectional communication and operation interaction are realized. (2) The method comprises the steps of adopting a Client-Server architecture, designing a three-layer component, namely MCP Host, an application body running LLM and responsible for initiating task requests, MCP CLIENT, converting the Host requests into protocol standard messages, establishing a session with a Server, MCP SERVER, interfacing external capabilities (such as reading a database and calling weather API), and returning the result to a Client. The core functions of MCP include: (1) Tools and data integration, dynamic extension of LLM capability boundaries, support of invoking three types of external Resources, tools, resources, raw data (e.g., log, configuration file) and Prompts, optimization of context interaction logic, wherein the Tools and data integration support the invocation of three types of external Resources, tools perform specific tasks (e.g., write database, invoke third party system), resources provide raw data (e.g., log, configuration file). (2) And the real-time bidirectional communication is realized, namely a request-response mode of the traditional API is broken through, and the AI is allowed to dynamically acquire and feed back the information flow. (3) Automatic service discovery-without manual configuration-LLM can autonomously detect and integrate newly accessed tools or data sources. Application of large models before MCP occurs: (1) And the high-customization integration is realized by writing special integrated codes and complex prompt words for each external tool or data source by a developer, and the development work of 'tailoring' is needed for each new access capability, so that the efficiency is low and the maintenance is difficult. (2) The system island problem is that interoperability among tools is poor, API interfaces and parameter formats are not uniform, so that a large model is difficult to cooperatively call a plurality of tools to form a split ecosystem. (3) Data access is limited-large models rely primarily on training data, and it is difficult to safely and efficiently access external real-time data sources (such as local files, databases, or APIs), and the ability is severely limited by "data islands". (4) The development threshold is high, a large number of repeated codes are needed for constructing the complex intelligent body system, the cross-model migration cost is high, and the large-scale landing of AI application is hindered. Core meaning of MCP occurrence: (1) Unified connection standard, providing standardized protocol similar to 'USB-C interface of AI interface', and greatly reducing integration complexity by implementing plug and play of large model and tool/data source. (2) The ecological fracture is broken, the ecology of an open tool is built, and the mainstream model and the tool can be interconnected and communicated through MCP to promote cross-platform cooperation. (3) The capability expansibility is enhanced, namely, the large model is supported to dynamically call external resources (such as a code base, a browser and a database), the limitation of training data is broken through, and the 'hand and foot' elasticity capability expansion is realized. (4) The development and migration cost is reduced, a developer does not need to repeatedly construct wheels, quickly construct complex workflow through a unified protocol, and does not need to reconstruct cod