Management method and system of MCP server instance
By dynamically configuring the management method and system of MCP server instances, the high cost and long cycle problems of traditional MCP server construction are solved, and rapid release, secure isolation and low-cost MCP server management are achieved to meet the needs of different business scenarios.
Patent Information
- Application Number
- CN202510775912.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-16
AI Technical Summary
The traditional MCP Server construction process requires repeated development of multiple MCP Server services, resulting in high development and deployment costs and a long cycle. In addition, the MCP Server has complex functions, which increases the difficulty of call permission management and token consumption.
Dynamically configure multiple MCP server instances through the MCP server registration management page, and achieve secure isolated operation by leveraging the collaboration of the HTTP interface service layer, session manager, tool manager, and API key permission verifier. It supports rapid creation and deletion of MCP server instances within a process, and performs isolated management through the Session manager and API key permission verifier.
It enables the rapid release of multiple MCP server instances according to business scenarios, reduces development and maintenance costs, focuses on MCP Server functions, simplifies permission control, and reduces token consumption.
Smart Images

Figure CN120658596A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and system for managing an MCP server instance. Background Art
[0002] With the development of large-scale model technology, Model Context Protocol (MCP) has become the mainstream standard for integrating external extension capabilities into large models. Enterprises are releasing MCP Tool services and are demanding the release of multiple MCP servers based on different business scenarios.
[0003] Currently, the traditional MCP Server setup process involves running an MCP Server service within a program. Function parameters, function names, and descriptions within the process are registered as tools in the MCP protocol's JSON Schema format. This also exposes SSE and Message endpoints for client calls. When an enterprise needs to release multiple MCP Server service scenarios based on different business marketing strategies, this approach requires repeated development of separate MCP Servers for each business, resulting in high development and deployment costs and a long development cycle.
[0004] Application Contents
[0005] The purpose of the embodiments of the present application is to provide a method and system for managing MCP server instances to address the defects of the prior art in that the development and deployment costs are high and the development cycle is long.
[0006] In order to solve the above technical problems, this application is implemented as follows:
[0007] In a first aspect, a method for managing an MCP server instance is provided, comprising the following steps:
[0008] Receive configuration changes for multiple MCP server instances or multiple MCP tools through the MCP Server Registration Management page;
[0009] The MCP server registration management terminal saves the configuration data corresponding to the configuration change to a storage medium and publishes a configuration change event message, wherein the configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool;
[0010] Multiple MCP server instances are run in isolation according to the configuration data through the MCP server process. Each MCP server instance is run in secure isolation under the collaborative support of the HTTP interface service layer, session manager, tool manager and Apikey permission verifier provided by the MCP server process.
[0011] In a second aspect, a management system for an MCP server instance is provided, including:
[0012] A receiving module, configured to receive configuration changes for multiple MCP server instances or multiple MCP tools via the MCP server registration management page;
[0013] A publishing module, configured to save the configuration data corresponding to the configuration change to a storage medium through the MCP server registration management terminal, and publish a configuration change event message, wherein the configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool;
[0014] The operation module is used to isolate and run multiple MCP server instances according to the configuration data through the MCP server process. Each MCP server instance is securely isolated and run under the collaborative support of the HTTP interface service layer, session manager, tool manager and Apikey permission verifier provided by the MCP server process.
[0015] The embodiment of the present application dynamically configures multiple MCP server instances and multiple MCP tools through the MCP server registration management page, which can quickly release multiple MCP server instances according to business scenarios and reduce development and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flow chart of a method for managing an MCP server instance provided in an embodiment of the present application;
[0017] Figure 2 Schematic diagram of the MCP configuration management interface provided in an embodiment of the present application;
[0018] Figure 3 This is an architectural diagram of the MCP Server container provided in an embodiment of the present application;
[0019] Figure 4 This is a schematic diagram of starting the MCP Server container provided in an embodiment of the present application;
[0020] Figure 5 This is the apiKey permission verification and Tool call flow chart provided in the embodiment of this application;
[0021] Figure 6 This is a diagram illustrating the implementation principle of the Session manager provided in an embodiment of the present application;
[0022] Figure 7 This is a structural diagram of a management system for an MCP server instance provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0024] With the development of large language model technology, higher requirements are placed on model calls to applications. The traditional model calls applications through ToolCallback and FunctionCallback. However, there is no unified standard implementation for large language models. Therefore, MCP was introduced to solve this problem. LLM vendors support standard MCP on the model side. The application side provides capabilities based on MCP. LLM, with the assistance of the MCP client, calls the capabilities provided by the application's MCP server. The main communication process of MCP is as follows:
[0025] 1) The client and the server establish an SSE (Server Sent Event) channel;
[0026] 2) The client initiates an RPC (remote procedure call) to the server and obtains a list of tool capabilities provided by the server through the tool / list method;
[0027] 3) The client initiates an RPC call to the server, and drives the server to execute the corresponding capability-related functions through the tool / call method. The server pushes back the relevant results obtained after the tool / call executes the specific functional logic through the SSE channel;
[0028] 4) After the client completes the MCP call, it closes the SSE channel.
[0029] The traditional technical solution is to build an MCP Server within a process, extract the calling parameters in MCP format from the functions or methods in the program, publish them as Tools, and then convert the MCP Tool / call requests into function or method calls within the process. If you want to publish MCP Servers for multiple business areas, you can only do so by creating multiple code projects to write tool logic code separately and deploying multiple MCP Servers in runtime. The LLM large model client can integrate and call functions provided by external services by configuring various MCP Servers. The MCP Server provides the client with a toolist function list to inform it of the various capabilities it can provide. In this way, if an enterprise has many business scenarios and needs different Tools for different businesses provided by the large model, providing multiple business Tools on one MCP Server has the following main disadvantages:
[0030] 1. The MCP Server, mixed with tools for different business functions, will cause trouble for the caller due to its large and complex functions. Different callers may only need to call tools provided by some specific business scenarios and will not use tools for other business scenarios.
[0031] 2. It increases the difficulty for MCP server providers to control tool call permissions. By placing all tools on a single MCP server, clients request an APIKey from the MCP server to call each tool it provides. If the service provider does not want a single APIKey to be able to call all tools, they must implement tool call permission control based on the APIKey.
[0032] 3. Before calling a tool, the LLM large model needs to read the tool list to find a tool that meets the conditions. If the tool is too large, it will cause a large token consumption and increase the cost of calling the large model.
[0033] 4. Under the traditional development model, each business area within the enterprise needs to develop and operate its own MCPServer, which has high labor costs and is difficult to maintain.
[0034] To address the above shortcomings of the existing technology, the embodiments of the present application design an efficient and flexible MCP Server construction method and device. A set of programs is developed to build MCP Servers for different business domains, quickly implement MCP Server online release, reduce development and maintenance costs, and at the same time, focus the functions of each MCP Server without clutter. This meets the needs of enterprises to quickly build and release MCP Servers for different business scenarios, as well as the needs to release different MCP Servers on different MCP service markets.
[0035] Among them, one MCP server process supports dynamic publishing of multiple MCP servers, and each MCP server is isolated from each other; a single process with multiple MCP servers implements endpoint management and session manager. Each MCP server uses a unique endpoint path, and separate session management and session verification are performed on different MCP servers.
[0036] Specifically, based on the standard MCP protocol implementation, the MCP Server service instance provides standard MCP protocol SSE and message interfaces on the public network, supporting integration with various mainstream large-scale model client tools. SSE (Server-Sent Events) is a one-way communication technology based on the HTTP protocol that allows the server to actively push messages to the client in real time. The client only needs to establish a single persistent connection to the server through the SSE interface.
[0037] In the embodiment of this application, multiple MCP Server instances are first configured and managed through interface configuration, supporting the rapid creation and deletion of MCP Server instances at runtime without starting or stopping the MCP Server process program. Then, multiple MCP Server instances are run simultaneously within a runtime process, and resources are isolated between different MCP Servers without affecting each other. The key points of the implementation scheme are:
[0038] 1. Provide a set of standard MCP protocol HTTP interfaces through the web container: / mcp / {serverName} / sse, / mcp / {serverName} / message, / forward / mcp / {serverName} / message. In the interface path, {serverName} is a dynamic parameter used to distinguish the target MCPServer to be called. / mcp / {serverName} / sse and / mcp / {serverName} / message are interfaces that must be provided by the MCP protocol.
[0039] 2. The core modules of the MCP Server are the Session Manager and the Tools Manager. The Session Manager is used to manage persistent SSE connections initiated by clients and associate them with corresponding MCP Server instances. The Tools Manager is used to manage the Tools under each MCP Server instance, ensuring that the Tools under each MCP Server instance are isolated. When the MCP server process starts, different MCP Server instances are started based on the MCP Server registration management configuration data. During service operation, the MCP Server instances can also be dynamically managed through the MCP Server Registration Manager. Secondly, the MCP Server also provides an APIKey permission verifier to check the identity and permission validity of requests initiated by clients and intercept client requests that fail verification.
[0040] 3. Provide MCP Server registration management function, support creation / deletion of MCP Server instances through the interface, and send interface change operation events to the runtime process service in real time, triggering the MCP server process to dynamically refresh the MCP Server instance.
[0041] 4. The web container provides the / forward / mcp / {serverName} / message HTTP interface internally. This interface is defined by the solution of the present invention and is used to forward requests between different horizontally scaled running instances of the same MCP server to solve the problem that SSE persistent connections only exist on a certain node in the cluster.
[0042] The following describes in detail the management method of the MCP server instance provided by the embodiment of the present application through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0043] like Figure 1 FIG. 1 is a flow chart of a method for managing an MCP server instance provided in an embodiment of the present application, the method comprising the following steps:
[0044] Step 101: Receive configuration changes for multiple MCP server instances or multiple MCP tools through the MCP server registration management page.
[0045] The MCP server registration management page includes the MCP server maintenance page and the MCP tool maintenance page.
[0046] Specifically, the MCP server maintenance page can receive configuration changes for multiple MCP server instances, including creating, publishing, and deleting MCP server instances, and binding a list of callable tools to MCP server instances. The MCP tool maintenance page can also receive configuration changes for multiple MCP tools, including adding and deleting tools, and maintaining tool lists grouped by MCP server instance.
[0047] Step 102: The MCP server registration management terminal saves the configuration data corresponding to the configuration change to a storage medium and publishes a configuration change event message. The configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool.
[0048] The MCP server process is an MCP server container that provides external service capabilities. The MCP server container includes a Web service layer and an MCP server container layer. The Web service layer provides HTTP interface service capabilities and provides service interfaces to the calling client. The MCP server container layer provides MCP service core capabilities, reads the configuration data, and launches multiple MCP server instances based on the configuration data. The MCP server container layer includes a session manager and a tool manager. The session manager manages client-initiated SSE persistent connections and associates them with corresponding MCP server instances. The tool manager manages the tools under each MCP server instance.
[0049] Step 103: Multiple MCP server instances are run in isolation according to the configuration data through the MCP server process. Each MCP server instance is run in secure isolation under the collaborative support of the HTTP interface service layer, session manager, tool manager, and Apikey permission verifier provided by the MCP server process.
[0050] In this embodiment, the configuration data includes MCP server instance configuration data, mapping data between the MCP server instance and the apiKey, and mapping data between the apiKey and the tool list. Accordingly, upon receiving a / sse or / message request initiated by a client, the MCP server process checks whether the apiKey exists in the request, whether the apiKey is valid, and whether the call permission for the server name specified in the current request path has been enabled. Upon receiving a tool call request sent by the client via the / message endpoint, the MCP server process verifies whether the apiKey has the call permission for the target tool, locates the MCP server instance based on the server name in the request path, and determines whether the target tool is included in the tool list of the MCP server instance. If so, the tool call request is allowed; otherwise, the tool call request is intercepted.
[0051] The embodiment of the present application dynamically configures multiple MCP server instances and multiple MCP tools through the MCP server registration management page, which can quickly release multiple MCP server instances according to business scenarios and reduce development and maintenance costs.
[0052] In the embodiment of the present application, multiple MCP Server instances are dynamically constructed and run within one MCP server process. The key processes and steps are as follows:
[0053] 1: Set up the MCP Server registration management terminal to maintain the configuration data. The management terminal provides the MCP Server maintenance page, such as Figure 2 As shown, the system supports creating, publishing, and deleting MCP Server instances, as well as binding a list of callable Tools to MCP Server instances. The management side also provides an MCP Tools maintenance page, which maintains the Tools list for each MCP Server instance and supports adding and deleting Tools. Additions, deletions, and changes made by the management side trigger the saving of configuration data to storage media and simultaneously publishes a configuration change event message, which notifies the running MCP server process to trigger a refresh action to implement changes to the MCP Server instance or Tools. If the MCP server process is not running, it waits for it to start and initialize and load the new configuration data.
[0054] The storage medium can be a database, Redis, Nacos, or other middleware for persistent data storage. After a successful add, delete, or modify operation, a configuration change event message is sent to the MCP server process to complete the corresponding change event. This change event notification can be implemented using Redis's pub / sub messaging mechanism or Nacos's configuration hot update mechanism. Tools maintenance requires binding to the MCP server to ensure isolation between different MCP server instances.
[0055] In this embodiment, the MCP Server data storage structure, Tools data storage structure, and apiKey data storage structure are shown in Tables 1-3, respectively.
[0056] Table 1 MCP Server data storage structure
[0057]
[0058] Table 2 Tools data storage structure
[0059]
[0060] Table 3 apiKey data storage structure
[0061]
[0062] 2: Build the MCP Server container service. The MCP Server container is used as the MCP server process to provide external service capabilities. The MCP Server container includes: Web service layer, MCP Server container layer, such as Figure 3 shown.
[0063] The Web service layer provides HTTP interface services, offering the following service interfaces for client calls: / mcp / {serverName} / sse and / mcp / {serverName} / message. In the interface path, {serverName} is a dynamic variable, representing the MCP server instance identification code. Upon receiving an interface request, the MCP server process routes the request to the target MCP server instance using {serverName}. The service interface for internal cluster nodes is / forward / mcp / {serverName} / message, used to forward requests between nodes within the cluster. Support for forward requests within the cluster is required because the SSE connection established between the client and the MCP server is a persistent connection. The server connection is established on a specific node, but the client subsequently connects via / mcp / {serverName} / message. The sessionId=xxx interface sends a request to the server. The request may be distributed to any node in the server cluster. If the distributed node does not hold the SSE persistent connection, the request cannot be processed normally. In this case, the target node is found based on the sessionId information in the server's shared storage. After calling the / forward / mcp / {serverName} / message?sessionId=xxx interface on the target node, the request can be processed normally and the response data can be sent to the client through the SSE connection.
[0064] The MCP Server container layer provides the core capabilities of the MCP server. It first reads the MCP Server and Tools configuration data, and then configures and starts each MCP Server instance separately. Figure 4 As shown in the figure, the core steps of instance startup are: building the MCP Server Endpoint, building the MCP Server runtime, and loading the tools provided by the MCP Server. Building the MCPServer Endpoint registers the SSE endpoint according to the current service instance serverName for the client to initiate a connection. Building the MCPServer runtime mainly processes the message request initiated by the client and parses the request message, calls the target tool and responds to the client. Loading the tools provided by the MCP Server is to register the Tools configured on each MCPServer with the MCP Server instance, and push the Tools list to the client that has established an SSE connection.
[0065] 3: Manage established SSE connections. The MCP container service provides a Session manager that stores information about each SSE connection and periodically sends heartbeat detection PING commands to each connected client. If the client responds normally, the heartbeat time is updated. If the client does not respond normally and the interval from the last heartbeat time to the present exceeds the threshold for determining whether the SSE connection is alive, the current SSE connection is actively closed. The Session manager also provides Session connection quantity management. To avoid excessive long SSE connections causing high load on server resources, a connection quantity threshold must be set. When the threshold is exceeded, the SSE connection request initiated by the client is rejected. At the same time, the legitimacy and permission verification of each request is implemented based on the Session.
[0066] In this embodiment, the mapping relationship data between serverName and apiKey, and the mapping relationship data between apiKey and Tools list are stored in a shared storage medium. Each MCP Server container process deployed in the cluster shares the mapping relationship data and is refreshed synchronously when the configuration changes. Figure 5 As shown, verify the following for apiKey:
[0067] 1. Each time the client initiates a / sse or / message request, it checks whether the apiKey exists and is valid, and whether the calling permission of the serverName specified in the current request path has been opened, ensuring that the apiKey can only call the MCP Server with opened permission.
[0068] 2. When the client sends a Tool call request through the / message endpoint, it verifies whether the apiKey has the call permission for the target Tool. First, it finds the MCP Server based on the serverName in the request path, and then determines whether the MCP Server's Tools list contains the target Tool. If it does, it allows the request; otherwise, it intercepts the request. This ensures that the apiKey can only call the Tools provided by the MCP Server that has enabled the request.
[0069] Furthermore, the core capability of the Session Manager is the management of SEE connections, including global connection quantity control, SSE connection creation, SSE expired connection cleanup, and message request verification. Figure 6 shown.
[0070] Specifically, the global connection quantity control includes: To prevent an MCP server process from creating too many client SSE persistent connections, which would put load pressure on server resources, a global SSE connection quantity threshold is set. When a client initiates an SSE connection creation request, it first determines whether the current number of connections exceeds the threshold. If it exceeds the threshold, the client is intercepted and an abnormal status code is returned. After being intercepted, the client can try to retry connecting to other available nodes in the cluster.
[0071] The creation of sse connection specifically includes: after the full number of connections is verified, the identity and permission legitimacy of the apiKey carried in the request are checked. If it fails, the exception status code is intercepted and returned. If the apiKey verification passes, a session is generated for the current connection, a survival time is set for the session, and the three elements of sessionId, serverName, and host are stored in a shared storage medium.
[0072] The specific cleaning of expired sse connections includes: all created sse connections are included in the scheduled task scanning range, and the scheduled task periodically checks whether the completion time of the last client request of the session has reached the expiration threshold. If it has expired, the connection is actively closed to clean up the storage medium data.
[0073] The sse heartbeat detection specifically includes: all created sse connections are included in the scheduled task scanning range for periodic inspection, the connection is actively closed for expired sessions, and a ping command is initiated for non-expired sessions to perform heartbeat detection to test whether the connection is normal and available. If it is unavailable, the connection is actively closed.
[0074] Message request verification specifically includes: Each message request requires an availability check on the SessionId. The core verification points are: whether the SessionId is legal and within the survival period, whether the SessionId matches the serverName of the target MCP Server being called, and whether the caller to which the SessionId belongs can call the target Tool. If the verification fails, the request is intercepted and an exception status code is returned. The specific verification process is to first read the shared storage medium based on the SessionId to see if there is corresponding Session data. If not, the session is determined to be dead and the request is intercepted. After the session survival is verified, it is determined whether the MCP Server corresponding to the session is consistent with the serverName specified in the request path. If not, it is determined that there is no call permission and the request is intercepted. After the verification passes, it is determined whether the target Tool exists in the Tools list provided by the MCP Server corresponding to the session. If not, it is determined that there is no Tool call permission and the request is intercepted. Otherwise, the verification process passes. After the session is verified to be alive, it is determined whether the request needs to be forwarded to other nodes in the cluster. The basis for this determination is to read the shared storage media data of the SessionId and determine whether the host is the current node. If so, the request does not need to be forwarded. Otherwise, the request is forwarded to the / forward / mcp / {serverName} / message interface of the corresponding host node. When the forward target node receives the request, all verification steps are performed.
[0075] This application embodiment designs and implements a method and apparatus for dynamically building and deploying multiple MCP Server instances within a single MCP server process. This method and apparatus features providing common / sse and / message request entry points at the HTTP interface layer, and internally isolating and managing the resources of each MCP Server instance during runtime to enable simultaneous operation of multiple MCP Server instances without interfering with each other.
[0076] The present application also designs and implements a method for dynamically configuring an MCP Server. This method features dynamic configuration of the MCP Server and its Tools data, rather than hard-coded, non-expandable configuration. The configuration interface is used to register and maintain the MCP Server instance, associate and bind the available Tools to the MCP Server instance, and authorize and bind the MCP Server instance's call permissions to the API Key. Interface data changes instantly trigger the runtime MCP server process to dynamically update and manage the MCP Server instance and API Key permissions.
[0077] The present application also designs and implements a session manager for running multiple MCPServer instances within an MCP server process. Sessions are managed in isolation according to different MCP Server instances. A session verification mechanism is used to prevent unauthorized MCP Server service calls and unauthorized MCP Server tool calls. Global session connection number management is used to prevent a large number of client calls from causing load pressure on the server, and expired sessions are periodically detected and cleared.
[0078] Compared with the prior art, the embodiments of the present application have the following advantages:
[0079] (1) Deploy a set of MCP Server container services, and build and publish multiple sets of MCP Server instances within the container, so that enterprises can publish multiple MCP Server instances according to business scenarios, and can publish them quickly without the pain point of repeated development costs.
[0080] (2) Different MCP Servers are released according to business areas, so that the capabilities provided by each MCP Server are more focused, and the isolation of tools from different MCP Servers facilitates the server-side control of tool calls.
[0081] like Figure 7 FIG. 1 is a schematic diagram of a management system for an MCP server instance provided in an embodiment of the present application, including:
[0082] The receiving module 710 is configured to receive configuration changes of multiple MCP server instances or multiple MCP tools through the MCP server registration management page.
[0083] The MCP server registration management page includes the MCP server maintenance page and the MCP tool maintenance page.
[0084] Specifically, the receiving module 710 is specifically configured to receive configuration changes to multiple MCP server instances through the MCP server maintenance page. The configuration changes include creating, publishing, and deleting MCP server instances, and binding a list of callable tools to an MCP server instance; and receive configuration changes to multiple MCP tools through the MCP tool maintenance page. The configuration changes include adding and deleting tools, and maintaining a tool list grouped by MCP server instance.
[0085] The publishing module 720 is configured to save the configuration data corresponding to the configuration change to a storage medium through the MCP server registration management terminal and publish a configuration change event message, wherein the configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool.
[0086] The MCP server process is an MCP server container used to provide external service capabilities. The MCP server container includes a Web service layer and an MCP server container layer. The Web service layer is used to provide HTTP interface service capabilities and provide service interfaces to the calling client. The MCP server container layer provides MCP service core capabilities, reads the configuration data, and starts multiple MCP server instances based on the configuration data.
[0087] In this embodiment, the MCP server container layer includes a session manager and a tool manager. The session manager is used to manage the SSE persistent connection initiated by the client and associate the SSE persistent connection with the corresponding MCP server instance. The tool manager is used to manage the tools under each MCP server instance.
[0088] The operation module 730 is used to operate multiple MCP server instances in isolation according to the configuration data through the MCP server process. Each MCP server instance is securely isolated and operated under the collaborative support of the HTTP interface service layer, session manager, tool manager and API key permission verifier provided by the MCP server process.
[0089] The configuration data includes the configuration data of the MCP server instance, the mapping data between the MCP server instance and the apiKey, and the mapping data between the apiKey and the tool list;
[0090] Furthermore, the above system also includes:
[0091] The checking module is configured to, upon receiving a / sse or / message request initiated by a client, check, through the MCP server process, whether an apiKey exists in the request, whether the apiKey is valid, and whether the call permission for the server name specified in the current request path has been enabled; and upon receiving a tool call request sent by the client through the / message endpoint, verify, through the MCP server process, whether the apiKey has the call permission for the target tool, locate the MCP server instance based on the server name in the request path, and determine whether the tool list of the MCP server instance contains the target tool. If so, the tool call request is allowed; otherwise, the tool call request is intercepted.
[0092] The embodiment of the present application dynamically configures multiple MCP server instances and multiple MCP tools through the MCP server registration management page, which can quickly release multiple MCP server instances according to business scenarios and reduce development and maintenance costs.
[0093] The present application also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the various processes of the aforementioned MCP server instance management method embodiment and achieves the same technical effects. To avoid repetition, the details are omitted here. The computer-readable storage medium may be, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0094] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0096] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for managing a Model Context Protocol (MCP) server instance, characterized in that: The following steps are involved: Receive configuration changes for multiple MCP server instances or multiple MCP tools through the MCP Server Registration Management page; The MCP server registration management terminal saves the configuration data corresponding to the configuration change to a storage medium and publishes a configuration change event message, wherein the configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool; Multiple MCP server instances are run in isolation according to the configuration data through the MCP server process. Each MCP server instance is run in secure isolation under the collaborative support of the HTTP interface service layer, session manager, tool manager and Apikey permission verifier provided by the MCP server process.
2. The method according to claim 1, characterized in that The MCP server registration management page includes an MCP server maintenance page and an MCP tool maintenance page; Receiving configuration changes to multiple MCP server instances or multiple MCP tools through the MCP server registration management page specifically includes: Receive configuration changes to multiple MCP server instances through the MCP server maintenance page, including creating, publishing, and deleting MCP server instances, and binding a list of callable tools to an MCP server instance; Configuration changes to multiple MCP tools are received through the MCP tool maintenance page, including adding and deleting tools, and maintaining a list of tools grouped by MCP server instance.
3. The method according to claim 1, characterized in that The MCP server process is an MCP server container for providing external service capabilities. The MCP server container includes a Web service layer and an MCP server container layer. The Web service layer is used to provide HTTP interface service capabilities and provide service interfaces to the calling client. The MCP server container layer provides MCP service core capabilities, reads the configuration data, and starts multiple MCP server instances based on the configuration data.
4. The method according to claim 3, characterized in that The MCP server container layer includes a session manager and a tool manager. The session manager is used to manage the SSE persistent connection initiated by the client and associate the SSE persistent connection with the corresponding MCP server instance. The tool manager is used to manage the tools under each MCP server instance.
5. The method according to claim 1, wherein The configuration data includes configuration data of the MCP server instance, mapping data between the MCP server instance and the apiKey, and mapping data between the apiKey and the tool list; The method further comprises: Upon receiving / sse and / message requests from the client, the MCP server process checks whether the request contains an apiKey, whether the apiKey is valid, and whether the calling permission for the server name specified in the current request path has been opened; When receiving a tool call request sent by the client through the / message endpoint, the MCP server process verifies whether the apiKey has the call permission for the target tool, finds the MCP server instance based on the server name in the request path, and determines whether the tool list of the MCP server instance contains the target tool. If so, the tool call request is released; otherwise, the tool call request is intercepted.
6. A management system for an MCP server instance, characterized in that: include: A receiving module, configured to receive configuration changes for multiple MCP server instances or multiple MCP tools via the MCP server registration management page; A publishing module, configured to save the configuration data corresponding to the configuration change to a storage medium through the MCP server registration management terminal, and publish a configuration change event message, wherein the configuration change event message is used to notify the running MCP server process to change the MCP server instance or MCP tool; The operation module is used to isolate and run multiple MCP server instances according to the configuration data through the MCP server process. Each MCP server instance is securely isolated and run under the collaborative support of the HTTP interface service layer, session manager, tool manager and Apikey permission verifier provided by the MCP server process.
7. The system according to claim 6, characterized in that The MCP server registration management page includes an MCP server maintenance page and an MCP tool maintenance page; The receiving module is specifically configured to receive configuration changes to multiple MCP server instances through an MCP server maintenance page, wherein the configuration changes include creating, publishing, and deleting MCP server instances, and binding a list of callable tools to an MCP server instance; and receive configuration changes to multiple MCP tools through an MCP tool maintenance page, wherein the configuration changes include adding and deleting tools, and maintaining a list of tools grouped by MCP server instance.
8. The system according to claim 6, wherein: The MCP server process is an MCP server container for providing external service capabilities. The MCP server container includes a Web service layer and an MCP server container layer. The Web service layer is used to provide HTTP interface service capabilities and provide service interfaces to the calling client. The MCP server container layer provides MCP service core capabilities, reads the configuration data, and starts multiple MCP server instances based on the configuration data.
9. The system according to claim 8, characterized in that The MCP server container layer includes a session manager and a tool manager. The session manager is used to manage the SSE persistent connection initiated by the client and associate the SSE persistent connection with the corresponding MCP server instance. The tool manager is used to manage the tools under each MCP server instance.
10. The system according to claim 6, wherein: The configuration data includes configuration data of the MCP server instance, mapping data between the MCP server instance and the apiKey, and mapping data between the apiKey and the tool list; The system further comprises: The checking module is configured to, upon receiving a / sse or / message request initiated by a client, check, through the MCP server process, whether an apiKey exists in the request, whether the apiKey is valid, and whether the call permission for the server name specified in the current request path has been enabled; and upon receiving a tool call request sent by the client through the / message endpoint, verify, through the MCP server process, whether the apiKey has the call permission for the target tool, locate the MCP server instance based on the server name in the request path, and determine whether the tool list of the MCP server instance contains the target tool. If so, the tool call request is allowed; otherwise, the tool call request is intercepted.
Citation Information
Cited By
Multi-agent resource collaborative scheduling management system and method based on MCP protocol
CN121277716A
Communication system, communication method, routing device, electronic equipment and storage medium
CN121334225A
Service discovery method, service system and storage medium
CN121585723A
MCP service tool control method and device and storage medium
CN121644626A