Multi-source model context protocol server integration method and related device

CN122986157APending Publication Date: 2026-10-27SANGFOR TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611134350.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

用户在实际使用中,往往需要用到多个服务器提供的工具,每接入一个新的 Server,都要人工配置一次;而且,随着接入的 Server增多,需要调用的工具数量会迅速上升,导致 Server及其工具的配置成本和运维成本都比较高

Benefits of technology

[0057]本申请实施例可以将多源模型上下文协议服务器集成在多源模型上下文协议服务器集成服务端中,从而可以通过该集成服务端实现对多源模型上下文协议服务器的统一管理,并实现以工具为粒度对多源模型上下文协议服务器的调用,从而使得用户仅需提供工具需求,即可由多源模型上下文协议服务器集成服务端快速、准确地完成工具匹配和调用,降低了用户的配置成本和运维成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122986157A_ABST
    Figure CN122986157A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a multi-source model context protocol server integration method and related device, which are used to improve the convenience of multi-source model context protocol server configuration. The method comprises: obtaining target tool information corresponding to a target model context protocol server, the target model context protocol server being any one of multi-source model context protocol servers; creating or updating a tool mapping table according to a correspondence between the target model context protocol server and the target tool information, the tool mapping table being used to query the target model context protocol server according to calling information of a target tool and the correspondence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data communication technology, and in particular to a multi-source model context protocol server integration method and related apparatus. Background Technology

[0002] Model Context Protocol (MTP) is an open standard introduced by Anthropic, designed to unify the communication protocol between large language models (LLMs) and external data sources and tools. Its main purpose is to address the current challenge of AI models being unable to fully realize their potential due to data silos, enabling AI applications to securely access and manipulate local and remote data, and providing an interface for AI applications to connect to everything.

[0003] Currently, each server typically focuses on providing a specific function or a set of related tools. For example, the Perplexity server provides web search functionality. If you need to read web page content, you can add FirecrawlServer, which can crawl web page content into an LLM-friendly format for easy use by LLM systems. In actual use, users often need to use tools provided by multiple servers. Each time a new server is connected, manual configuration is required. Moreover, as the number of connected servers increases, the number of tools that need to be called rises rapidly, resulting in high configuration and maintenance costs for both servers and their tools. Summary of the Invention

[0004] This invention provides a method and apparatus for integrating a multi-source model context protocol server, which is used to configure a multi-source model context protocol server within a multi-source model context protocol server integration server, thereby improving the convenience of multi-source server configuration.

[0005] The first aspect of this application provides a method for integrating multi-source model context protocol servers, including:

[0006] Obtain the target tool information corresponding to the target model context protocol server, wherein the target model context protocol server is any one of the multi-source model context protocol servers;

[0007] Based on the correspondence between the target model context protocol server and the target tool information, a tool mapping table is created or updated. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

[0008] As an optional embodiment, the creation tool mapping table includes:

[0009] Parse the target model context protocol server and extract the target tool metadata built into the target model context protocol server;

[0010] If the target model context protocol server can provide target tool information, obtain the identifier code of the target model context protocol server;

[0011] Establish a tool mapping table between the identifier of the target model context protocol server and the target tool metadata.

[0012] As an optional embodiment, the update tool mapping table includes:

[0013] When the target tool information changes, the changed target tool metadata is obtained;

[0014] Update the tool mapping table based on the changed target tool metadata.

[0015] As an optional embodiment, before obtaining the target tool information corresponding to the target model context protocol server, the method further includes:

[0016] In response to the add command for the target model context protocol server, obtain detailed information about the target model context protocol server;

[0017] Based on the detailed information, add the target model context protocol server;

[0018] After creating the tool mapping table, the method further includes:

[0019] The detailed information of the target model context protocol server and the target tool information are stored in the storage unit;

[0020] The system will display a message indicating that the target model context protocol server has been successfully added.

[0021] As an optional embodiment, the method further includes:

[0022] Responding to the permission management generation command, the first display interface is shown;

[0023] The system receives a tool permission management instruction identifier input in the first display interface, generates a tool permission management instruction in response to a trigger operation to generate a tool permission management instruction, and performs an association operation on the tool permission management instruction identifier and the tool permission management instruction; or, it generates the tool permission management instruction in response to a trigger operation to generate a tool permission management instruction.

[0024] Receive the target tool selected from multiple toolsets in the first display interface;

[0025] The associated tool permission management instruction identifier and tool permission management instruction are associated with the target tool, or the tool permission management instruction is associated with the target tool, and a prompt message indicating that the tool permission management instruction has been successfully added is displayed.

[0026] As an optional embodiment, the method further includes:

[0027] In response to the loading instruction of the target tool, perform the tool permission management instruction verification operation on the loading instruction;

[0028] If the verification passes, the target tool is obtained;

[0029] Convert the target tool into a standard target tool information list that conforms to the Model Context Protocol format;

[0030] The list of information about the standard target tools is displayed in the second display interface.

[0031] As an optional embodiment, if the tool compression function is enabled, and the tool compression function is at least associated with a search tool, the method further includes:

[0032] Receive the first session sent by the Multi-Source Model Context Protocol server client, and the tool query request generated using the search tool and the first session;

[0033] The tool query request is used to query the toolset registry to obtain the first tool associated with the tool query request. The toolset registry records tool information and tool index information corresponding to the tool information.

[0034] The first tool index information is sent to the multi-source model context protocol server client.

[0035] As an optional embodiment, the tool compression function is also associated with an execution tool, and the method further includes:

[0036] If the multi-source model context protocol server client executes the first tool using the execution tool, then the first model context protocol server corresponding to the first tool is obtained from the tool mapping table using the first tool index information;

[0037] Based on the details of the first model context protocol server, communicate with the first model context protocol server to invoke the first tool to execute the first session and obtain the first execution result of the first session;

[0038] The first session and the first execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the first session and the first execution result to the agent agent, and the agent agent is used to send the first session and the first execution result to the agent to perform inference.

[0039] As an optional embodiment, the method further includes:

[0040] Receive the second session and target tool invocation request sent by the multi-source model context protocol server client;

[0041] Based on the target tool invocation request, obtain the target model context protocol server corresponding to the target tool from the tool mapping table;

[0042] Based on the detailed information of the target model context protocol server, communicate with the target model context protocol server to invoke the target tool to execute the second session and obtain the second execution result of the second session;

[0043] The second session and the second execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the second session and the second execution result to the agent agent installed in the multi-source model context protocol server client, and the agent agent is used to send the second session and the second execution result to the agent to perform inference.

[0044] As an optional embodiment, if the multi-source model context protocol server client invokes multiple tools simultaneously, the method further includes:

[0045] Establish a third session with the multi-source model context protocol server client, the third session being used to manage the first communication connection status and the context information of the first communication with the multi-source model context protocol server client;

[0046] Establish multiple fourth sessions between multiple model context protocol servers corresponding to the multiple tools, each fourth session being used to manage the second communication connection status and the context information of the second communication with each model context protocol server;

[0047] A mapping relationship is established between the third session and the plurality of fourth sessions so that the context information of the first communication is shared by the plurality of fourth sessions.

[0048] The second aspect of this application provides a multi-source model context protocol server integration server, including:

[0049] The acquisition unit is used to acquire target tool information corresponding to the target model context protocol server, wherein the target model context protocol server is any one of the multi-source model context protocol servers;

[0050] An update creation unit is used to create or update a tool mapping table based on the correspondence between the target model context protocol server and the target tool information. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

[0051] The third aspect of this application provides a multi-source model context protocol server integration server, including a processor. When the processor executes a computer program stored in a memory, it is used to implement the multi-source model context protocol server integration method provided in the first aspect of this application.

[0052] A fourth aspect of this application provides a multi-source model context protocol server integration system, including:

[0053] The second or third aspect of the embodiments of this application provides a multi-source model context protocol server integration server, a multi-source model context protocol server client, and at least two model context protocol servers.

[0054] The fifth aspect of this application provides a readable computer storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it is used to implement the multi-source model context protocol server integration method provided in the first aspect of this application.

[0055] A sixth aspect of this application provides a computer program product having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it is used to implement the multi-source model context protocol server integration method provided in the first aspect of this application.

[0056] As can be seen from the above technical solutions, the embodiments of the present invention have the following advantages:

[0057] This application embodiment can integrate the multi-source model context protocol server into a multi-source model context protocol server integration server, thereby enabling unified management of the multi-source model context protocol server through the integration server and enabling tool-level invocation of the multi-source model context protocol server. This allows users to only provide tool requirements, and the multi-source model context protocol server integration server can quickly and accurately complete tool matching and invocation, reducing users' configuration and maintenance costs. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of the overall architecture of the multi-source model context protocol server integration server in the embodiments of this application;

[0059] Figure 2 This is a schematic diagram of one embodiment of the multi-source model context protocol server integration method in this application;

[0060] Figure 3 This is a detailed step of step 202 in the embodiments of this application;

[0061] Figure 4 This is another detailed step of step 202 in the embodiments of this application;

[0062] Figure 5 This is another detailed step of step 202 in the embodiments of this application;

[0063] Figure 6 This is a schematic diagram of another embodiment of the multi-source model context protocol server integration method in this application;

[0064] Figure 7 This is a schematic diagram of the interface for adding model context protocol servers of different communication types in the embodiments of this application;

[0065] Figure 8 This is a schematic diagram of another embodiment of the multi-source model context protocol server integration method in this application;

[0066] Figure 9 This is a schematic diagram of the first display interface in an embodiment of this application;

[0067] Figure 10 This is a schematic diagram illustrating an embodiment of the present application that displays a list of target tools;

[0068] Figure 11 This is a schematic diagram of the second display interface in an embodiment of this application;

[0069] Figure 12 This is a schematic diagram illustrating an embodiment of calling a target tool associated with a target model context protocol server in this application.

[0070] Figure 13 This is another embodiment of the multi-source model context protocol server integration method in this application;

[0071] Figure 14 Another embodiment of the multi-source model context protocol server integration method in this application;

[0072] Figure 15This is a schematic diagram of an embodiment of the multi-source model context protocol server integration server in this application. Detailed Implementation

[0073] This invention provides a method and apparatus for integrating a multi-source model context protocol server, which is used to configure a multi-source model context protocol server within a model context protocol server integration server, thereby improving the convenience of configuring the multi-source model context protocol server.

[0074] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0075] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0076] This application provides a method for integrating multiple model context protocol servers. The general principle of this method is as follows: First, obtain the target tool information corresponding to the target model context protocol server. Second, create or update a tool mapping table based on the correspondence between the target model context protocol server and the target tool information. This tool mapping table is used to query the target model context protocol server based on the target tool's invocation information and the corresponding relationship. This application integrates the target model context protocol server and its corresponding target tools into a multi-source model context protocol server integration server, thereby achieving unified management of multiple model context protocol (MGP) servers and their target tools integrated within the server. This allows users to simply provide their tool requirements, and the multi-source model context protocol server integration server can quickly and accurately complete tool matching and invocation, reducing user configuration and maintenance costs.

[0077] To better implement the above-mentioned multi-source model context protocol server integration method, the embodiments of this application... Figure 1 A schematic diagram of the overall architecture is also provided. Figure 1 The system includes a multi-source model context protocol server integration server 101 and a host 102. The host 102 is equipped with an agent agent 1021 and a client 1022. The host 102 can receive user input sessions through the agent agent 1021 and invoke an agent 103 to execute the session. When the agent 103 cannot execute the session, it can interact with the agent agent 1021, enabling the agent agent 1021 to interact with the client 1022. The client 1022 then interacts with the multi-source model context protocol server integration server 101 to invoke various tools provided by the server to execute the session, thereby improving the accuracy of the session execution results obtained by the agent. These tools can be web search tools, web content crawling tools, etc., and the specific content of the tools is not limited here.

[0078] Specifically, the multi-source model context protocol server integration server 101 is equipped with preset API interfaces (such as Web API interface and SSE API interface) that support the protocol. The multi-source model context protocol server integration server 101 can be regarded as a server for a client or a client for a server. The multi-source model context protocol server integration server 101 can be a smartphone, tablet, laptop, desktop computer, smart vehicle, etc., or it can be a program deployed in the cloud. There are no specific restrictions on the external form of the multi-source model context protocol server integration server 101.

[0079] The multi-source model context protocol server integration method in the embodiments of this application is described in detail below. Please refer to [link / reference]. Figure 2 One embodiment of the multi-source model context protocol server integration method in this application includes:

[0080] 201. Obtain the target tool information corresponding to the target model context protocol server. The target model context protocol server can be any one of the multi-source model context protocol servers.

[0081] Specifically, the method in this application embodiment is applied to a multi-source model context protocol server integration server. This integration server can be a terminal of various forms, such as a computer or server, or a program deployed in the cloud. There are no specific restrictions on the external form of the multi-source model context protocol server integration server. Furthermore, the target model context protocol server in this application embodiment is any one of the multi-source model context protocol servers. In this application, the multi-source model context protocol server refers to a model context protocol server that supports different communication types. The specific communication type can be local communication based on standard input / output (Stdio) or remote communication based on server push events (SSE).

[0082] In this embodiment of the application, when integrating a target model context protocol server into a multi-source model context protocol server integration server, different methods can be used to obtain target tool information corresponding to the target model context protocol server based on different communication types.

[0083] 1. Communication types include local communication based on standard input / output (Stdio).

[0084] If the target server's communication type is local communication based on standard input / output (stdio), then after obtaining the target server's installer, it needs to be installed on the local system's server first. After installation, the target server is run by executing the run command with parameters. This will create a target server process, and then the local system can call the Web API interface to communicate with the target server process through standard input / output (stdio) and send tool call requests to the target model context protocol server through toolsAPI or listAPI.

[0085] After receiving the tool call request, the target server returns the target tool information that it can provide, based on the request. It should be noted that the tool information provided by the target server can be a single tool, a group of tools, or multiple tools. There is no specific limit to the number of tool information provided by the server.

[0086] 2. Communication types include remote communication based on server push events (SSE).

[0087] If the target server's communication type is remote communication based on server push events (SSE),

[0088] You can then establish a communication connection with the target server via the SSE API interface in the form of an HTTP request. After establishing the communication connection with the target server, you can send tool call requests to the target server, such as sending a tools API request or a List API request.

[0089] After receiving the tool invocation request, the target server can return detailed target tool information, such as tool description information, based on the request. Then, the multi-source model context protocol server integration server can receive the target tool information sent by the target server.

[0090] 202. Based on the correspondence between the target model context protocol server and the target tool information, create or update the tool mapping table. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and correspondence.

[0091] After obtaining the target tool information corresponding to the target model context protocol server, a tool mapping table can be created or updated based on the correspondence between the target model context protocol server and the target tool information. The tool mapping table is used to query the target model context protocol server to invoke the target tool based on the target tool's invocation information and correspondence.

[0092] Specifically, if it is the first time integrating the target model context protocol server into the multi-source model context protocol server integration server, a tool mapping table is created on the multi-source model context protocol server integration server. This allows the target model context protocol server to be queried based on the corresponding tool in the tool mapping table when the target tool call information is received, so as to call the target tool. If it is not the first time integrating the target model context protocol server into the multi-source model context protocol server integration server, the tool mapping table can be updated when the target tool information changes, so that the target model context protocol server can be queried based on the updated tool mapping table to call the updated target tool.

[0093] Specifically, the process of creating and updating the tool mapping table will be described in the following embodiments, and will not be repeated here.

[0094] This application embodiment can integrate the multi-source model context protocol server into a multi-source model context protocol server integration server, thereby enabling unified management of the multi-source model context protocol server through the integration server and enabling tool-level invocation of the multi-source model context protocol server. This allows users to only provide tool requirements, and the multi-source model context protocol server integration server can quickly and accurately complete tool matching and invocation, reducing users' configuration and maintenance costs.

[0095] based on Figure 2 Step 202 in the embodiment, the process of creating the tool mapping table is described in detail below, please refer to Figure 3 , Figure 3 Detailed steps for step 202:

[0096] 301. Parse the target model context protocol server and extract the target tool metadata built into the target model context protocol server;

[0097] When adding a new target model context protocol server, this application embodiment can parse the target model context protocol server to extract the target tool metadata built into the target model context protocol server, and then integrate these target tool metadata into standard structured metadata so that subsequent programs can use the structured metadata to create a tool mapping table. The target tool metadata includes: tool name, function description, input and output parameter schema, tool category, interface parameters, etc.

[0098] 302. If the target model context protocol server can provide target tool information, obtain the identifier code of the target model context protocol server;

[0099] To prevent the target Model Context Protocol (MGP) server from failing to provide the correct tool information, this embodiment of the application can also verify the target MGP server. If the verification shows that the MGP server can provide the target tool information, then the identification code of the MGP server is further obtained. Specifically, the identification code of the MGP server in this embodiment of the application can be the name of the MGP server, the code of the MGP server, or the graphical identifier of the MGP server, etc. There are no specific restrictions on the identification code of the MGP server here.

[0100] Specifically, depending on the communication type of the Model Context Protocol server, different verification methods can be used. If the Model Context Protocol server is based on local communication, a process can be created locally and test commands can be sent to verify whether the returned tool format is compliant. If the Model Context Protocol server is based on remote communication, the SSE path and the returned event fields can be verified to be compliant. If both are compliant, it means that the target Model Context Protocol server can provide the correct target tool information.

[0101] If the target model context protocol server can provide target tool information, a service instance can be deployed for the target model context protocol server, and a unique identifier can be assigned to the target model context protocol server during the deployment process.

[0102] 303. Establish a tool mapping table between the identifier of the target model context protocol server and the target tool metadata.

[0103] Once the unique identifier of the target model context protocol server is obtained, a tool mapping table can be established between the identifier of the target model context protocol server and the target tool metadata.

[0104] Specifically, when creating the tool mapping table, the structured metadata from step 301 can be written to the target model context protocol server information table to obtain a reverse mapping table from the target model context protocol server to the target tool information. This reverse mapping table can then be stored in the database, allowing for quick querying of which tools the target model context protocol server can provide.

[0105] Furthermore, a forward mapping table from the target tool to the target model context protocol server can be established and stored in the cache, so that when the multi-source model context protocol server integration server receives a target tool call request, it can route the request to the target model context protocol server through the target tool.

[0106] In this embodiment, the process of creating the tool mapping table is described in detail. The tool mapping table is established through the unique identifier of the Model Context Protocol server, which realizes fast routing of tool calls and improves calling efficiency and stability.

[0107] based on Figure 2 Step 202 in the embodiment is described in detail below as part of the process of updating the tool mapping table. Please refer to [link / reference]. Figure 4 and Figure 5 , Figure 4 and Figure 5 This is another detailed step of step 202:

[0108] When updating the tool mapping table, one approach is to retrieve the changed target tool metadata when the target tool information changes, and then update the tool mapping table based on the changed tool metadata. The methods for retrieving the changed target tool metadata when the target tool changes can be categorized as follows, depending on the specific circumstances:

[0109] I. The target model context protocol server supports tool change notification functionality;

[0110] 401. Receive a target tool change notification sent by the target model context protocol server;

[0111] Specifically, the multi-source model context protocol server integration server can maintain a communication connection with the target model context protocol server through a long connection. When the target model context protocol server adds, deletes, or modifies tool metadata, it automatically pushes a tools / list_changed change notification message according to the protocol specification.

[0112] 402. Obtain the changed target tool metadata;

[0113] After the multi-source model context protocol server integration server obtains the tools / list_changed change notification message, it initiates a tools / list query request to the target model context protocol server based on the target model context protocol server identifier carried in the tools / list_changed change notification message in order to obtain the changed tool metadata.

[0114] 403. Update the tool mapping table according to the changed target tool metadata;

[0115] After obtaining the changed target tool metadata, the tool mapping table is updated using the changed target tool metadata. For example, invalid or deleted tool identifiers are removed. When adding a new tool, a new mapping relationship is created between the tool identifier and the target model context protocol server.

[0116] II. The target model context protocol server does not support the tool change notification function;

[0117] 501. Periodically acquire target tool information, and when a change in target tool information is detected, acquire the changed target tool metadata;

[0118] If the target model context protocol server does not support the tool change notification function, a timed polling task can be configured in the multi-source model context protocol server integration server. For the target model context protocol server, the tools / list interface is actively called to periodically query the target tool metadata of the target model context protocol server. If a change in the target tool information is detected based on the tool metadata, the changed target tool metadata is obtained.

[0119] 502. Update the tool mapping table based on the changed target tool metadata.

[0120] The tool mapping table is updated using the changed target tool metadata. For example, invalid or deleted tool identifiers are removed, and when a new tool is added, a new mapping relationship is created between the tool identifier and the target model context protocol server.

[0121] In this embodiment of the application, the process of updating the tool mapping table is described in detail. When a change is detected in the target tool, the tool mapping table is updated using the changed target tool metadata, thereby ensuring the real-time effectiveness and accuracy of the tool mapping table.

[0122] based on Figure 2 The following describes the complete process of adding a target model context protocol server for the first time in the multi-source model context protocol server integration server. Please refer to [link to relevant documentation]. Figure 6 Another embodiment of the multi-source model context protocol server integration method in this application includes:

[0123] 601. In response to the add command for the target model context protocol server, obtain detailed information about the target model context protocol server;

[0124] Unlike existing technologies, when a client on a host connects to a server through a reverse proxy, the existing reverse proxy does not support the protocol, which leads to the problem that users need to maintain a large number of server URL addresses. This application provides a multi-source model context protocol server integration method, which is used to add multi-source servers in the multi-source model context protocol server integration server, thereby reducing the workload of the client in maintaining a large number of server URL addresses, that is, simplifying the configuration of multi-source servers and improving the convenience of multi-source server configuration.

[0125] To improve user convenience, embodiments of this application can add a target model context protocol server to the visual interface. For ease of understanding, Figure 7 The following diagrams illustrate the interface for adding servers of different communication types. Figure 7In the visual interface, users can add the URL address and headers of the remote communication server to establish a communication connection with the server via the URL address. The headers are used to pass the context information of the communication request to the server. The server name can be filled in or left blank to facilitate user identification of the server. The SSE read timeout can also be filled in or left blank. The SSE read timeout parameter is used to ensure the reliability of the connection. If the SSE read timeout is set to 5s, no feedback response will be given if the communication connection request exceeds 5s.

[0126] In addition, users can also Figure 7 When adding a local server with standard input / output (stdio) as the communication type in the visual interface, you need to add commands, parameters, and installation packages.

[0127] When the user is Figure 7 After adding a target model context protocol server in the visualization interface, the system responds to the addition command by obtaining detailed information about the target model context protocol server. The detailed information includes at least the communication type of the target model context protocol server. In this embodiment, the communication type includes local communication based on standard input / output (stdio) and remote communication based on server push time (SSE). When the target model context protocol server belongs to different communication types, the system communicates with the corresponding server according to the corresponding communication method.

[0128] 602. Based on the detailed information, add the target model context protocol server;

[0129] After obtaining the communication type of the target model context protocol server, add the target model context protocol server according to the different communication types.

[0130] Specifically, when the communication type is local communication based on standard input / output (stdio), after unzipping the installation package, the runtime dependencies are configured in the isolated sandbox environment, the local process is started via commands and parameters, and the standard input / output communication is verified to be normal. Then, a globally unique identifier is assigned to the target model context protocol server. When the communication type is SSE remote communication, after verifying the validity of the URL path and headers, the access to the SSE interface is tested to verify whether the returned data stream is compliant. After the verification is passed, a globally unique identifier is assigned to the target model context protocol server.

[0131] After assigning a globally unique identifier to the target model context protocol server, the runtime information of the target model context protocol server is saved to establish a communication link between the multi-source model context protocol server integration server and the target model context protocol server.

[0132] 603. Obtain the target tool information corresponding to the target model context protocol server;

[0133] 604. Based on the correspondence between the target model context protocol server and the target tool information, create a tool mapping table. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

[0134] The descriptions of steps 603 and 604 are consistent with... Figure 2 Steps 201 and 202 in the embodiments are described similarly and will not be repeated here.

[0135] 605. Store the detailed information of the target model context protocol server and the target tool information in the storage unit;

[0136] Specifically, after creating the tool mapping table, the detailed information of the target model context protocol server and the target tool information in the tool mapping table are stored in the storage unit. The storage unit here can be a database and / or cache, etc., and there are no specific restrictions on the storage unit.

[0137] 606. Feedback message indicating successful addition of the target model context protocol server.

[0138] After storing the details of the target model context protocol server and the target tool information into the storage unit, a message indicating that the target model context protocol server has been successfully added is displayed to inform the user that the target model context protocol server has been successfully added.

[0139] In this embodiment, instructions can be added based on the target model context protocol server. After adding the target model context protocol server, a tool mapping table is created according to the correspondence between the target model context protocol server and the corresponding target tool. The target model context protocol server and the corresponding tool information are stored in the storage unit. Compared with the prior art, this reduces the workload of maintaining a large number of server URLs, simplifies the configuration of the server, and improves the convenience of server configuration.

[0140] based on Figure 2 The multi-source server integration method described in this embodiment also supports permission management for multiple tools. Please refer to [link / reference] for details. Figure 8 :

[0141] 801. Respond to the permission management generation command and display the first display interface;

[0142] Specifically, this application embodiment also supports permission management instructions for tools. For example, when a user calls tool A, the user needs to verify the call request for tool A first, and tool A can only be called after the verification is passed.

[0143] If authorization is required for tool A, an authorization management command must be generated for tool A before it is invoked. Specifically, this could be done by the user triggering a control (e.g., clicking a authorization generation button), which would then display a command like... Figure 9 The first display interface shown, and in Figure 9 The first display interface shown displays a tool permission management instruction identifier input control and a target tool selection control.

[0144] 802. Receive the tool permission management instruction identifier input in the first display interface, generate the tool permission management instruction in response to the trigger operation of generating the tool permission management instruction, and perform an association operation on the tool permission management instruction identifier and the tool permission management instruction; or, generate the tool permission management instruction in response to the trigger operation of generating the tool permission management instruction.

[0145] exist Figure 9 The first display interface includes a tool permission management instruction identifier input control. This control is used to input tool permission management instruction identifiers, such as identifier 1, identifier 2, etc. After inputting the tool permission management instruction identifier, it can respond to a trigger operation that generates a tool permission management instruction (such as clicking). Figure 9 The "Generate API key" button generates a tool permission management command and associates the tool permission management command identifier with the tool permission management command. That is, it associates identifier 1 or identifier 2 with the tool permission management command. This process of inputting the tool permission management command identifier can authorize the user with the tool permission management command identifier during the authorization process. Generally, the tool permission management command identifier is simpler than the tool permission management command, thereby improving the convenience of users using the tool permission management command.

[0146] As another optional embodiment, it is also possible to... Figure 9 Enter the key seed in the box to the left of the "Generate API key" button. This will enable the key to be triggered by the permission management commands of the generation tool (such as clicking...). Figure 9 When using the "Generate API key" button, the key seed can be used to generate corresponding tool permission management instructions, thereby improving the security of tool permission management instructions.

[0147] As another alternative embodiment, it can also be in Figure 9 In the first display interface, the tool permission management instruction identifier input control is not shown; only the generation trigger control for permission management instructions is displayed (e.g., ...). Figure 9 The "Generate API key" button (in the middle) is clicked when... Figure 9 When the "Generate API key" button is pressed, tool permission management commands are generated directly, thereby improving the convenience for users to generate tool permission management commands.

[0148] 803. Receive the target tool selected from the plurality of tools in the first display interface;

[0149] Users can also Figure 9 In the first display interface, select the target tool from the multiple tools displayed. The target tool here is the tool for executing permission management, and the target tool can be any one or several of the multiple tools. There are no specific restrictions on the content of the target tool or the number of target tools.

[0150] 804. Associate the tool permission management instruction identifier and the tool permission management instruction with the target tool, or associate the tool permission management instruction with the target tool, and display a prompt message indicating that the tool permission management instruction has been successfully added.

[0151] Specifically, when the user enters a tool permission management command identifier and a target tool in the first display interface, the tool permission management command identifier, the tool permission management command, and the target tool will be associated. If the user does not enter a tool permission management command identifier in the first display interface, but instead directly clicks the generation trigger control for the permission management command (such as...), the user will be automatically disabled. Figure 9 (Click the "Generate API key" button in the menu) and select the target tool to associate the corresponding tool permission management command with the target tool.

[0152] After the association operation, a message indicating that the tool permission management command has been successfully added will be displayed.

[0153] This application embodiment not only allows for the addition of various tools through multiple source servers, but also enables permission management of these tools, thereby ensuring the security of tool usage. In addition, this application embodiment can also count the number of times each tool is called by the number of authorization verifications, as well as count the number of tools that are frequently called (i.e., the number of calls exceeds the preset number of calls), in order to achieve the operation and management of the tools.

[0154] based on Figure 8In the described embodiment, after adding permission management instructions to the target tool, a list of added tools can be displayed in the second display interface after the user adds the target tool. The display process of the target tool list is described below; please refer to [link to relevant documentation]. Figure 10 :

[0155] 1001. In response to the loading instruction of the target tool, perform the tool permission management instruction verification operation on the loading instruction;

[0156] The process of displaying the tool list is described below. Specifically, after the user adds permission management instructions to the target tool in the first display interface, the tool management page can be displayed when the user clicks the tool management control. The tool management page displays all available tools. The process of displaying the target tool information list in the second display interface is described below, taking the target tool as an example.

[0157] For example, if a user clicks the tool management control, and after the user clicks the tool management control, in response to the tool information loading instruction, the tool permission management instruction verification operation is performed on the loading instruction.

[0158] 1002. If the tool access control command verification passes, then obtain the target tool;

[0159] If the tool permission management instruction carried in the tool acquisition request is verified, the target tool associated with the tool permission management instruction is acquired to execute step 1003.

[0160] 1003. Convert the target tools into a standard target tool information list that conforms to the Model Context Protocol format;

[0161] After obtaining the information list of the target tool, before displaying the information list of the target tool, it is necessary to convert the information list of the tool into a standard target tool information list that conforms to the model context protocol format, so that step 1004 can be performed according to the standard target tool information list.

[0162] 1004. Display the standard target tool information list in the second display interface.

[0163] After obtaining the standard target tool information list, this embodiment of the application further displays the standard target tool information list on the fourth display interface so that the user can view the tools that can be called. For ease of understanding, Figure 11 A schematic diagram of the second display interface is given, and in Figure 11 The second display interface provides a list of all available tools.

[0164] In this embodiment of the application, the tool information that the user can access can be displayed intuitively through the second display interface, thereby improving the intuitiveness and convenience of the user in viewing the tool information list.

[0165] based on Figure 2 The following describes in detail the process of invoking the target tool associated with the target model context protocol server, as described in the embodiment. Please refer to [link to relevant documentation]. Figure 12 :

[0166] 1201. Receive the second session and target tool invocation request sent by the Multi-Source Model Context Protocol server client;

[0167] Specifically, when the agent agent in the terminal that integrates the target model context protocol server client sends a second session and a target tool invocation request through the target model context protocol server client, the target tool invocation request carries a target tool identifier, which is used to identify the tool that the target model context protocol server client needs to invoke.

[0168] 1202. Based on the target tool invocation request, retrieve the target model context protocol server corresponding to the target tool from the tool mapping table;

[0169] Once the target tool call request is obtained, the target model context protocol server corresponding to the target tool identifier can be retrieved from the tool mapping table using the target tool identifier in the call request.

[0170] 1203. Based on the detailed information of the target model context protocol server, communicate with the target model context protocol server to invoke the target tool to execute the second session and obtain the second execution result of the second session;

[0171] Specifically, after obtaining the target model context protocol server, step 1202 calls a preset API interface to communicate with the target model context protocol server using a preset communication method, based on the communication type of the target model context protocol server, so as to call the target tool corresponding to the target model context protocol server to execute the second session and obtain the second execution result of the second session.

[0172] If the second session is: Please query the weather for the next 15 days, then after the multi-source model context protocol server client calls the target model context protocol server through the multi-source model context protocol server integration server of this application, it can access the weather query tool and use the weather query tool to query the weather for the next 15 days to obtain the query results for the weather for the next 15 days.

[0173] 1204. Send the second session and the second execution result of the second session to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the second session and the second execution result to the agent agent, and the agent agent is used to send the second session and the second execution result to the agent to perform inference.

[0174] After obtaining the execution results of the second session, the second session and the execution results can be sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client can send the second session and the second execution results to the agent agent, whereby the agent agent is used to send the second session and the second execution results to the agent to perform further inference.

[0175] In this embodiment of the application, the process of calling the target tool in the target model context protocol server after configuring the target model context protocol server in the multi-source model context protocol server integration server is described in detail, thereby realizing the convenience for users to call the target tool through the multi-source model context protocol server integration server.

[0176] based on Figure 12 In the described embodiment, if the tool compression command is enabled in the multi-source model context protocol server integration server, where the tool compression command in this application is pre-bound with a search tool and an execution tool, the process of executing the first session after enabling the tool compression command is described in detail below. Please refer to [link to relevant documentation]. Figure 13 Another embodiment of the multi-source model context protocol server integration method in this application includes:

[0177] 1301. Receive the first session sent by the Multi-Source Model Context Protocol server client, and the tool query request generated using the lookup tool and the first session;

[0178] When the Multi-Source Model Context Protocol (MLM) server client receives the first session sent by the user through the agent agent (i.e., the LLM agent), because the MLM server integration server has enabled the tool compression instruction, which is bound to the lookup tool and the execution tool, it uses the first session and the lookup tool to generate a tool query request.

[0179] For ease of understanding, the following describes the process of a user sending a session on the host (used to install the agent agent and the multi-source model context protocol server client), and the host calling the agent agent to execute the first session:

[0180] In this embodiment, the host computer is equipped with a multi-source model context protocol server client and an agent agent. Users can interact with agents (such as chatgpt, deepseek, or doubao) through the agent agent (i.e., LLM agent) in the host computer. After receiving the first session input by the user, the agent agent in the host computer sends the first session to the agent. If the agent cannot generate the execution result of the first session, it calls the multi-source model context protocol server installed in the multi-source model context protocol server integration server through the multi-source model context protocol server client. If the multi-source model context protocol server integration server has enabled the tool compression instruction, it executes the search tool and generates a query request based on the first session and the search tool. The first session and the query request are then sent to the multi-source model context protocol server integration server through the multi-source model context protocol server client. When the multi-source model context protocol server integration server receives the first session and the tool query request generated by the search tool, it executes step 1302 using the search request.

[0181] 1302. Use a tool query request to query the toolset registry to obtain the first tool associated with the tool query request. The toolset registry records tool information and tool index information corresponding to the tool information.

[0182] The tool registry in this embodiment can be understood as a vector database, which stores all tool information and index information of all tools. This allows the multi-source model context protocol server integration server in this application to, after receiving a tool query request generated by the multi-source model context protocol server client using a query tool, query the tool registry for a tool that matches the query request and return the first tool that matches the query request. This shortens the call time of the first tool and avoids the problem of query errors.

[0183] When the multi-source model context protocol server integration server receives the first session and the tool query request generated by the query tool, since the tool registry itself is a vector database, this application can convert the query tool into a tool vector when generating the tool query request using the query tool, and use the tool vector to query the toolset registry to obtain the first tool associated with the query request from the toolset registry.

[0184] Practice has shown that when an agent faces a large number of callable tools, the execution result of the session becomes less accurate. Therefore, when the multi-source model context protocol server integration server in this application is configured with a large number of model context protocol servers and a large number of toolsets, in order to avoid the time delay caused by the agent selecting a suitable tool from a large number of toolsets, and the problem of the first session execution result being incorrect due to the agent facing a large number of toolsets, this embodiment of the application, after enabling the tool compression instruction, sends the first session and tool query request to the multi-source model context protocol server integration server when generating a tool query request using the search tool. When the multi-source model context protocol server integration server receives the tool query request generated by the agent using the first session and the search tool, it uses the query request to query the toolset registry to obtain the first tool associated with the query request.

[0185] Therefore, the tool compression instructions in this application reduce the response time for selecting matching tools from a large set of tools, and also improve the accuracy of the execution results obtained by the agent in the first session.

[0186] 1303. Send the first tool index information to the multi-source model context protocol server client;

[0187] After the Multi-Source Model Context Protocol (MLPP) server integration server finds the first tool index in the toolset registry, it sends the first tool index information to the MLPP client so that the agent agent in the MLPP client can send the first tool index information to the agent. If the agent executes the first tool using the execution tool, then step 1304 is executed.

[0188] 1304. If the multi-source model context protocol server client executes the first tool using the execution tool, then the first model context protocol server corresponding to the first tool is obtained from the tool mapping table using the first tool index information;

[0189] After the Multi-Source Model Context Protocol (MPP) server integration server sends the first tool to the MPP server client, the MPP server client sends the first tool index information to the agent agent. The agent agent then sends the first tool index information to the agent. If the agent wants to execute the first tool, the MPP server client receives the execution request through the agent agent and uses the first tool index information in the execution request to query the tool mapping table to obtain the first MPP server corresponding to the first tool.

[0190] 1305. Based on the details of the first model context protocol server, communicate with the first model context protocol server to invoke the first tool to execute the first session and obtain the first execution result of the first session;

[0191] Once the first model context protocol server corresponding to the first tool is obtained, the first tool can communicate with the first model context protocol server using a preset communication method (such as local communication or remote communication) according to the communication type of the first model context protocol server, so as to call the first tool in the first model context protocol server to execute the first session and obtain the first execution result of the first tool on the first session.

[0192] 1306. Send the first session and the first execution result of the first session to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the first session and the first execution result to the agent agent, and the agent agent is used to send the first session and the first execution result to the agent to perform inference.

[0193] After obtaining the execution result of the first session, the system sends the first session and its first execution result to the multi-source model context protocol server client, so that the client can send the first session and the first execution result to the agent through the agent agent, so that the agent can use the first session and the first execution result to perform inference.

[0194] In this embodiment, after enabling the tool compression instruction, after generating a tool query request using the search tool, the first session and the tool query request are sent to the multi-source model context protocol server integration server. This allows the multi-source model context protocol server integration server to use the tool query request to search for the first tool associated with the tool query request from the toolset registry, thereby reducing the number of first tools and the feedback time to the LLM. If the multi-source model context protocol server client executes the first tool using the execution tool, the first model context protocol server corresponding to the first tool is searched from the tool mapping table, and a communication connection is established with the first model context protocol server to call the first tool provided by the first model context protocol server to execute the first session, obtain the first execution result of the first session, and send the first session and the first execution result to the agent agent. The agent agent is used to send the first session and the first execution result to the agent for inference.

[0195] Because the embodiments of this application reduce the number of tools fed back to the agent, on the one hand, the latency for the agent to obtain matching tools is reduced, and on the other hand, because the number of matching tools is smaller than the number of tools in the tool set, the accuracy of the agent's reasoning is also improved accordingly.

[0196] Furthermore, to enable the reuse of client sessions across multiple servers, this embodiment of the application may also perform the following steps when the client establishes communication connections with multiple servers, thereby enabling the reuse of client session context information across multiple servers. Please refer to [link to relevant documentation]. Figure 14 :

[0197] 1401. Establish a third session with the Multi-Source Model Context Protocol (MMT) server client. The third session is used to manage the first communication connection status and the context information of the first communication with the MMT server client.

[0198] When a multi-source model context protocol server client establishes a communication connection with multiple model context protocol servers through a multi-source model context protocol server integration server, the embodiments of this application can establish a first session between the multi-source model context protocol server integration server and the multi-source model context protocol server client. The first session is used to manage the first communication connection status and the context information of the first communication between the multi-source model context protocol server integration server and the multi-source model context protocol server client.

[0199] 1402. Establish multiple fourth sessions between multiple model context protocol servers corresponding to multiple tools, each fourth session being used to manage the second communication connection status and the context information of the second communication with each model context protocol server;

[0200] Furthermore, the multi-source model context protocol server integration server can also establish multiple fourth sessions with multiple model context protocol servers, wherein each fourth session is used to manage the second communication connection status and the context information of the second communication with each model context protocol server.

[0201] When the multi-source model context protocol server integration server establishes communication connections with three model context protocol servers (assuming they are the first MCP server, the second MCP server, and the third MCP server, respectively), the multi-source model context protocol server integration server establishes three fourth sessions with the three servers respectively. Each fourth session is used to manage the second communication connection status and the context information of the second communication with each model context protocol server.

[0202] For example, the first fourth session is used to manage the communication connection status and communication context information between the Multi-Source Model Context Protocol Server Integration Server and the first MCP server; the second fourth session is used to manage the communication connection status and communication context information between the Multi-Source Model Context Protocol Server Integration Server and the second MCP server; and the third fourth session is used to manage the communication connection status and communication context information between the Multi-Source Model Context Protocol Server Integration Server and the third MCP server.

[0203] 1403. Establish a mapping relationship between the third session and multiple fourth sessions so that the context information of the first communication can be shared by multiple fourth sessions.

[0204] In order to enable the third session to be shared by multiple model context protocol servers, this application embodiment can also establish a mapping relationship between the third session and multiple fourth sessions, so that the third session can be shared by multiple fourth sessions.

[0205] This application embodiment establishes a third session, multiple fourth sessions, and a mapping relationship between the third session and multiple fourth sessions, so that the third session between the multi-source model context protocol server integration server and the multi-source model context protocol server client can be shared by multiple fourth sessions, thereby avoiding the time and computational overhead caused by repeatedly establishing communication connections and repeatedly creating context information.

[0206] It is understood that, in various embodiments of the present invention, the order of the steps does not imply the order of execution. The execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0207] This application also provides a computer program product on which a computer program is stored. When the computer program is executed by a processor, it is used to perform the various steps in the above method embodiments.

[0208] The multi-source model context protocol server integration method in the embodiments of this application has been described in detail above. The following section describes the multi-source model context protocol server integration server in the embodiments of this application. Please refer to [link to relevant documentation]. Figure 15 One embodiment of the multi-source model context protocol server integration server in this application includes:

[0209] The acquisition unit 1501 is used to acquire target tool information corresponding to the target model context protocol server, wherein the target model context protocol server is any one of the multi-source model context protocol servers;

[0210] The creation and update unit 1502 is used to create or update a tool mapping table based on the correspondence between the target model context protocol server and the target tool information. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

[0211] As an optional embodiment, the creation update unit 1502 is specifically used for:

[0212] Parse the target model context protocol server and extract the target tool metadata built into the target model context protocol server;

[0213] If the target model context protocol server can provide target tool information, obtain the identifier code of the target model context protocol server;

[0214] Establish a tool mapping table between the identifier of the target model context protocol server and the target tool metadata.

[0215] As an optional embodiment, the creation update unit 1502 is specifically used for:

[0216] If the target model context protocol server supports the tool change notification function, then when the target tool information changes, the target tool change notification sent by the target model context protocol server will be received.

[0217] Obtain the changed target tool metadata;

[0218] Update the tool mapping table based on the modified target tool metadata;

[0219] or,

[0220] If the target model context protocol server does not support the tool change notification function, it will periodically obtain the target tool information, and when it detects that the target tool information has changed, it will obtain the changed target tool metadata.

[0221] Update the tool mapping table based on the changed target tool metadata.

[0222] As an optional embodiment, the acquisition unit 1501 is further configured to:

[0223] In response to the add command for the target model context protocol server, obtain detailed information about the target model context protocol server;

[0224] The multi-source model context protocol server integration server also includes:

[0225] Adding unit 1503 is used to add the target model context protocol server according to the details information;

[0226] Storage unit 1504 stores the detailed information of the target model context protocol server and the target tool information into the storage unit;

[0227] Feedback unit 1505 is used to provide feedback on the successful addition of the target model context protocol server.

[0228] As an optional embodiment, the multi-source model context protocol server integration server also includes:

[0229] Display unit 1506 is used to respond to permission management generation instructions and display the first display interface;

[0230] The receiving unit 1507 is configured to receive a tool permission management instruction identifier and a key seed input in the first display interface, generate a tool permission management instruction using the key seed, and perform an association operation on the tool permission management instruction identifier and the tool permission management instruction; or, receive a key seed input in the first display interface and generate a tool permission management instruction using the key seed.

[0231] Receive the target tool selected from multiple toolsets in the first display interface;

[0232] Associated unit 1508 is used for:

[0233] The associated tool permission management instruction identifier and tool permission management instruction are associated with the target tool, or the tool permission management instruction is associated with the target tool, and a prompt message indicating that the tool permission management instruction has been successfully added is displayed.

[0234] As an optional embodiment, the multi-source model context protocol server integration server also includes:

[0235] Verification unit 1509 is used to perform a tool permission management instruction verification operation on the loading instruction in response to the loading instruction of the target tool;

[0236] If the verification passes, the target tool is obtained;

[0237] The conversion unit 1510 is used to convert the target tool into a standard target tool information list that conforms to the model context protocol format.

[0238] The display unit 1506 is also used to display the standard target tool information list in the second display interface.

[0239] As an optional embodiment, if the tool compression function is enabled, and the tool compression function is at least associated with a search tool, the receiving unit 1507 is further configured to:

[0240] Receive the first session sent by the Multi-Source Model Context Protocol server client, and the tool query request generated using the search tool and the first session;

[0241] The acquisition unit 1501 is also used for:

[0242] The tool query request is used to query the toolset registry to obtain the first tool associated with the tool query request. The toolset registry records tool information and tool index information corresponding to the tool information.

[0243] The sending unit 1511 is used to send the first tool index information to the multi-source model context protocol server client.

[0244] As an optional embodiment, the tool compression function is also associated with an execution tool, and the acquisition unit 1501 is further used for:

[0245] If the multi-source model context protocol server client executes the first tool using the execution tool, then the first model context protocol server corresponding to the first tool is obtained from the tool mapping table using the first tool index information;

[0246] Based on the details of the first model context protocol server, communicate with the first model context protocol server to invoke the first tool to execute the first session and obtain the first execution result of the first session;

[0247] The transmitting unit 1511 is also used for:

[0248] The first session and the first execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the first session and the first execution result to the agent agent, and the agent agent is used to send the first session and the first execution result to the agent to perform inference.

[0249] As an optional embodiment, the receiving unit 1507 is further configured to:

[0250] Receive the second session and target tool invocation request sent by the multi-source model context protocol server client;

[0251] Based on the target tool invocation request, obtain the target model context protocol server corresponding to the target tool from the tool mapping table;

[0252] Based on the detailed information of the target model context protocol server, communicate with the target model context protocol server to invoke the target tool to execute the second session and obtain the second execution result of the second session;

[0253] The transmitting unit 1511 is also used for:

[0254] The second session and the second execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the second session and the second execution result to the agent agent installed in the multi-source model context protocol server client, and the agent agent is used to send the second session and the second execution result to the agent to perform inference.

[0255] As an optional embodiment, if the Multi-Source Model Context Protocol (MLPP) server client calls multiple tools simultaneously, the MLPP server integration server also includes:

[0256] Building unit 1512 is used for;

[0257] Establish a third session with the multi-source model context protocol server client, the third session being used to manage the first communication connection status and the context information of the first communication with the multi-source model context protocol server client;

[0258] Establish multiple fourth sessions between multiple model context protocol servers corresponding to the multiple tools, each fourth session being used to manage the second communication connection status and the context information of the second communication with each model context protocol server;

[0259] A mapping relationship is established between the third session and the plurality of fourth sessions so that the context information of the first communication is shared by the plurality of fourth sessions.

[0260] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0261] This application embodiment can integrate the multi-source model context protocol server into a multi-source model context protocol server integration server, thereby enabling unified management of the multi-source model context protocol server through the integration server and enabling tool-level invocation of the multi-source model context protocol server. This allows users to only provide tool requirements, and the multi-source model context protocol server integration server can quickly and accurately complete tool matching and invocation, reducing users' configuration and maintenance costs.

[0262] This application also provides a multi-source model context protocol server integration system, including:

[0263] Figure 15 The multi-source model context protocol server integrates a server-side component, a client-side component, and at least two model context protocol servers.

[0264] The roles of the multi-source model context protocol server integration server, the multi-source model context protocol server client, and the model context protocol server can be referred to the relevant descriptions in the above method embodiments, and will not be repeated here.

[0265] The multi-source model context protocol server integration server in this embodiment of the invention has been described above from the perspective of modular functional entities. The multi-source model context protocol server integration server in this embodiment of the invention is now described below from the perspective of hardware processing:

[0266] One embodiment of the multi-source model context protocol server integration server in this invention includes:

[0267] Processor and memory;

[0268] The memory is used to store computer programs, and when the processor executes the computer programs stored in the memory, it can implement the various steps in the above method embodiments.

[0269] It is understood that when the processor in the computer device described above executes the computer program, it can also implement the functions of each unit in the corresponding device embodiments described above, which will not be repeated here. For example, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the multi-source model context protocol server integration server. For example, the computer program can be divided into units in the multi-source model context protocol server integration server described above, and each unit can implement the specific functions described in the corresponding multi-source model context protocol server integration server.

[0270] The multi-source model context protocol server integration server can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the processor and memory are merely examples of a computer device and do not constitute a limitation on the computer device. It may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.

[0271] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.

[0272] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD card), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0273] The present invention also provides a computer-readable storage medium for implementing the functions of a multi-source model context protocol server integration server, wherein a computer program is stored thereon, and when the computer program is executed by a processor, the processor can be used to perform the various steps in the above method embodiments.

[0274] It is understood that if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0275] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0276] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0277] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0278] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for integrating multi-source model context protocol servers, characterized in that, include: Obtain the target tool information corresponding to the target model context protocol server, wherein the target model context protocol server is any one of the multi-source model context protocol servers; Based on the correspondence between the target model context protocol server and the target tool information, a tool mapping table is created or updated. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

2. The method according to claim 1, characterized in that, The creation tool mapping table includes: Parse the target model context protocol server and extract the target tool metadata built into the target model context protocol server; If the target model context protocol server can provide target tool information, obtain the identifier code of the target model context protocol server; Establish a tool mapping table between the identifier of the target model context protocol server and the target tool metadata.

3. The method according to claim 1, characterized in that, The update tool mapping table includes: When the target tool information changes, the changed target tool metadata is obtained; Update the tool mapping table based on the changed target tool metadata.

4. The method according to claim 1, characterized in that, Before obtaining the target tool information corresponding to the target model context protocol server, the method further includes: In response to the add command for the target model context protocol server, obtain detailed information about the target model context protocol server; Based on the detailed information, add the target model context protocol server; After creating the tool mapping table, the method further includes: The detailed information of the target model context protocol server and the target tool information are stored in the storage unit; The system will display a message indicating that the target model context protocol server has been successfully added.

5. The method according to claim 1, characterized in that, The method further includes: Responding to the permission management generation command, the first display interface is shown; The system receives a tool permission management instruction identifier input in the first display interface, generates a tool permission management instruction in response to a trigger operation to generate a tool permission management instruction, and performs an association operation on the tool permission management instruction identifier and the tool permission management instruction; or, it generates the tool permission management instruction in response to a trigger operation to generate a tool permission management instruction. Receive the target tool selected from multiple toolsets in the first display interface; The associated tool permission management instruction identifier and tool permission management instruction are associated with the target tool, or the tool permission management instruction is associated with the target tool, and a prompt message indicating that the tool permission management instruction has been successfully added is displayed.

6. The method according to claim 5, characterized in that, The method further includes: In response to the loading instruction of the target tool, perform the tool permission management instruction verification operation on the loading instruction; If the verification passes, the target tool is obtained; Convert the target tool into a standard target tool information list that conforms to the Model Context Protocol format; The list of information about the standard target tools is displayed in the third display interface.

7. The method according to claim 1, characterized in that, If the tool compression function is enabled, and the tool compression function is at least associated with a search tool, the method further includes: Receive the first session sent by the Multi-Source Model Context Protocol server client, and the tool query request generated using the search tool and the first session; The tool query request is used to query the toolset registry to obtain the first tool associated with the tool query request. The toolset registry records tool information and tool index information corresponding to the tool information. The first tool index information is sent to the multi-source model context protocol server client.

8. The method according to claim 7, characterized in that, The tool compression function is also associated with an execution tool, and the method further includes: If the multi-source model context protocol server client executes the first tool using the execution tool, then the first model context protocol server corresponding to the first tool is obtained from the tool mapping table using the first tool index information; Based on the details of the first model context protocol server, communicate with the first model context protocol server to invoke the first tool to execute the first session and obtain the first execution result of the first session; The first session and the first execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the first session and the first execution result to the agent agent, and the agent agent is used to send the first session and the first execution result to the agent to perform inference.

9. The method according to claim 1, characterized in that, The method further includes: Receive the second session and target tool invocation request sent by the multi-source model context protocol server client; Based on the target tool invocation request, obtain the target model context protocol server corresponding to the target tool from the tool mapping table; Based on the detailed information of the target model context protocol server, communicate with the target model context protocol server to invoke the target tool to execute the second session and obtain the second execution result of the second session; The second session and the second execution result are sent to the multi-source model context protocol server client, so that the multi-source model context protocol server client sends the second session and the second execution result to the agent agent installed in the multi-source model context protocol server client, and the agent agent is used to send the second session and the second execution result to the agent to perform inference.

10. The method according to claim 1, characterized in that, If the multi-source model context protocol server client calls multiple tools simultaneously, the method further includes: Establish a third session with the multi-source model context protocol server client, the third session being used to manage the first communication connection status and the context information of the first communication with the multi-source model context protocol server client; Establish multiple fourth sessions between multiple model context protocol servers corresponding to the multiple tools, each fourth session being used to manage the second communication connection status and the context information of the second communication with each model context protocol server; A mapping relationship is established between the third session and the plurality of fourth sessions so that the context information of the first communication is shared by the plurality of fourth sessions.

11. A multi-source model context protocol server integration server, characterized in that, include: The acquisition unit is used to acquire target tool information corresponding to the target model context protocol server, wherein the target model context protocol server is any one of the multi-source model context protocol servers; An update creation unit is used to create or update a tool mapping table based on the correspondence between the target model context protocol server and the target tool information. The tool mapping table is used to query the target model context protocol server based on the target tool's call information and the correspondence.

12. A multi-source model context protocol server integration server, comprising at least a processor and a memory, characterized in that, When the processor executes a computer program stored in the memory, it is used to implement the multi-source model context protocol server integration method as described in any one of claims 1 to 10.

13. A multi-source model context protocol server integration system, characterized in that, include: The multi-source model context protocol server as described in claim 11 or 12 integrates a multi-source model context protocol server client and at least two model context protocol servers.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it is used to implement the multi-source model context protocol server integration method as described in any one of claims 1 to 10.