A method for visualizing orchestration of model tool invocation based on MCPs
By using the visual orchestration method of MCP and utilizing a unified proxy tool and visual interface configuration, the problem of low efficiency in calling model tools is solved, and efficient and flexible tool calling and configuration are achieved.
Patent Information
- Application Number
- CN202511196514.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-26
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-08-26
AI Technical Summary
In existing technologies, the inefficiency of calling model tools is mainly due to the need for customized development for the integration of external tools, which leads to scattered interfaces and increased code complexity, resulting in redundant call chains.
By adopting a visual orchestration method based on MCP, standardized call requests are generated through a unified proxy tool and tool configuration information parsing tool. Operations are configured through a visual orchestration interface, reducing manual coding and database maintenance, and achieving efficient conversion between different systems.
It improves the efficiency and flexibility of tool invocation, reduces configuration complexity and error rate, and ensures the smoothness and efficiency of the tool invocation process.
Smart Images

Figure CN120743252B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to a visualization arrangement method for model tool calling based on MCP. BACKGROUND
[0002] With the deepening of application scenarios, AI (Artificial Intelligence) models gradually extend from single natural language processing to multi-modal interaction, complex task decision, etc. By calling external tools such as databases, API (Application Programming Interface) services, and sensors, AI models can break through the limitations of their own static knowledge base and realize real-time data acquisition, physical device control, and cross-system collaboration, etc.
[0003] Currently, the integration of external tools is usually realized through "point-to-point" customized development, which requires developers to independently design calling logic for each external tool, and to realize the interaction between the model and the target tool by writing special interfaces or adaptation code. However, with the increase in the number and diversity of integrated tools, the dispersion of interfaces and the complexity of code lead to redundant calling links of model tools, and thus reduce the efficiency of tool calling.
[0004] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY
[0005] The main purpose of the present application is to provide a visualization arrangement method for model tool calling based on MCP, aiming to solve the technical problem of how to improve the calling efficiency of model tools.
[0006] To achieve the above purpose, the present application provides a visualization arrangement method for model tool calling based on MCP, which is applied to an MCP server, and the method comprises:
[0007] receiving a first tool calling request sent by a client, wherein the first tool calling request is generated by a large language model deployed on the client according to MCP;
[0008] parsing the first tool calling request through a preset unified proxy tool and a preset tool configuration information to construct a second tool calling request, wherein the tool configuration information is generated according to a configuration operation on a preset visualization arrangement interface of the MCP server;
[0009] sending the second tool calling request to an external interface service and receiving response information generated by the external interface service according to the second tool calling request;
[0010] According to the MCP and the response information, a request result is constructed, and the request result is sent to the large language model.
[0011] In an embodiment, the step of parsing the first tool invocation request by the preset unified proxy tool and the preset tool configuration information to construct a second tool invocation request comprises:
[0012] The operation tool identifier and the tool parameter in the first tool invocation request are extracted by the unified proxy tool;
[0013] The target configuration information of the target tool indicated by the operation tool identifier is determined from the tool configuration information by the unified proxy tool;
[0014] The request parameter matched with the tool parameter is determined according to a first mapping relationship between the tool parameter and the request parameter preset in the target configuration information by the unified proxy tool;
[0015] The second tool invocation request is generated according to the request parameter and the target configuration information by the unified proxy tool.
[0016] In an embodiment, before the step of receiving the first tool invocation request sent by the client, the method further comprises:
[0017] A connection establishment request sent by the client is received, and the connection establishment request is parsed by a preset request interceptor to determine an authentication parameter of the connection establishment request, wherein the authentication parameter comprises a tenant token and tenant information;
[0018] The tenant token is verified for validity;
[0019] In the case where the validity of the tenant token is verified, the tenant information is verified for a time window;
[0020] In the case where the time window of the tenant information is verified, whether a target tenant indicated by the tenant information has a permission to access the MCP server is determined according to preset MCP authorization information;
[0021] In the case where the target tenant has the permission to access the MCP server, a connection channel is established with the client.
[0022] In an embodiment, before the step of determining the request parameter matched with the tool parameter according to a first mapping relationship between the tool parameter and the request parameter preset in the target configuration information by the unified proxy tool, the method further comprises:
[0023] The request interceptor is used to determine whether the target tenant has the permission to call the target tool according to the target configuration information.
[0024] When the target tenant has the permission to call the target tool, the step of determining the request parameter matched with the tool parameter according to the first mapping relationship between the tool parameter and the request parameter in the target configuration information through the unified proxy tool is performed.
[0025] In an embodiment, after the step of establishing the connection channel with the client, the method further comprises:
[0026] generating a session identifier of the connection channel with the target tenant, and updating a second mapping relationship between the target tenant and the session identifier;
[0027] Before the step of determining whether the target tenant has the permission to call the target tool according to the tool identifier and the target configuration information through the request interceptor, the method further comprises:
[0028] extracting the target session identifier in the first tool calling request, and determining whether the target tenant and the target session identifier meet the second mapping relationship;
[0029] When the target combination and the target session identifier meet the second mapping relationship, the step of determining whether the target tenant has the permission to call the target tool according to the tool identifier and the target configuration information through the request interceptor is performed.
[0030] In an embodiment, the method for visualizing the calling of the model tool based on MCP further comprises:
[0031] detecting whether the tool configuration information of each tool is updated through a preset timing scheduler;
[0032] When the tool configuration information of at least one tool is updated, updating the tool list of the MCP server according to the updated tool configuration information, wherein the tool list is used to provide available tool information to the client.
[0033] In an embodiment, the method for visualizing the calling of the model tool based on MCP further comprises:
[0034] When the tool configuration information of at least one tool is updated, saving the updated tool configuration information into a cache.
[0035] In an embodiment, the visual arrangement interface comprises a tool library panel, an attribute panel and a status bar, and the visual arrangement method of the MCP-based model tool invocation further comprises:
[0036] In response to a configuration operation on the tool library panel, determining a tool to be operated;
[0037] In response to a configuration operation on the attribute panel, determining tool configuration information of the tool to be operated;
[0038] In response to a triggering operation on a save control of the status bar, storing the tool configuration information of the tool to be operated into a preset database, so that the MCP server invokes the tool configuration information from the database.
[0039] In addition, to achieve the above object, the present application further provides an MCP server, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the visual arrangement method of the MCP-based model tool invocation as described above.
[0040] In addition, to achieve the above object, the present application further provides a storage medium, which is a computer readable storage medium, and the storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the visual arrangement method of the MCP-based model tool invocation as described above.
[0041] In addition, to achieve the above object, the present application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of the visual arrangement method of the MCP-based model tool invocation as described above.
[0042] One or more technical solutions proposed in the present application have at least the following technical effects: First, a large language model deployed on the client generates a first tool invocation request according to the MCP (Model Context Protocol) and sends it to the MCP server. The MCP ensures the standardization of the tool invocation request to ensure that subsequent unified processing can be performed through a unified proxy tool. Then, according to the first tool invocation request, a second tool invocation request is constructed through a preset unified proxy tool and a preset tool configuration information on the MCP server, and the second tool invocation request is sent to a preset external interface service to implement external tool invocation. The tool configuration information is generated in response to the configuration operation of the visual arrangement interface, without the need for the user to manually construct the underlying code or edit the database, thereby avoiding the complexity of code writing and database maintenance, reducing logical errors introduced by manual coding, and facilitating the normal execution of subsequent tool invocation requests to improve the efficiency of tool invocation. Then, the response information sent by the external interface service is received, a request result is constructed according to the MCP and the response information, and the request result is sent to the large language model for application. The present application parses the first tool invocation request through the preset unified proxy tool and generates the second tool invocation request, realizes efficient conversion of tool invocation between different systems, enables the MCP server to flexibly interact with the client and various external tools, eliminates the need for customizing a special invocation interface for each tool, improves the efficiency and flexibility of tool invocation; at the same time, the tool configuration information is generated through the configuration operation of the visual arrangement interface, without the need for the user to manually write complex configuration code or modify the database, thereby reducing the complexity and error rate of tool configuration, enabling the user to intuitively select, connect and set parameters of the tool in the visual interface, improving the efficiency of the tool configuration process, and the reduction of the error rate ensures the smoothness of the subsequent tool invocation process, thereby improving the efficiency of tool invocation. BRIEF DESCRIPTION OF DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0045] Figure 1 A flowchart provided by the MCP-based model tool invocation visual arrangement method embodiment one of the present application;
[0046] Figure 2 The flowchart for realizing tool calling through the unified agent tool provided in Embodiment One of the present application;
[0047] Figure 3 The flowchart for realizing dynamic updating through the timing scheduler provided in Embodiment One of the present application;
[0048] Figure 4 The architecture diagram of multi-layer permission control provided in Embodiment Two of the present application;
[0049] Figure 5 The end-to-end flowchart of model tool calling provided in Embodiment Two of the present application;
[0050] Figure 6 The design architecture diagram of the visual arrangement interface provided in Embodiment Three of the present application;
[0051] Figure 7 The device structure diagram of the hardware running environment involved in the visual arrangement method of model tool calling based on MCP in Embodiment of the present application.
[0052] The object implementation, functional features and advantages of the present application will be further explained in combination with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application, and are not used to limit the present application.
[0054] In order to better understand the technical solutions of the present application, the following will be described in detail in combination with the drawings in the specification and specific embodiments.
[0055] The current tool configuration and arrangement method mainly adopts the management mode based on configuration file or database, lacks visual graphical interface, and the whole tool configuration and arrangement process is not intuitive, which leads to errors or omissions in the configuration process, and the efficiency of tool access is low; at the same time, each integrated external tool needs to realize independent and usually customized calling logic, which increases the system complexity and development cost, and with the increase of the number and diversity of integrated tools, the dispersion between interfaces and the complexity of code lead to the redundancy of model tool calling link, which reduces the efficiency of external tool calling.
[0056] The application provides a solution, which parses a first tool calling request through a preset unified agent tool and generates a second tool calling request, realizes efficient conversion of tool calling between different systems, enables the MCP server to flexibly interact with the client and various external tools, does not need to customize a special calling interface for each tool, improves the efficiency and flexibility of tool calling, generates tool configuration information through configuration operation of a visual arrangement interface, does not need the user to manually write complex configuration code or modify a database, reduces the complexity and error rate of tool configuration, enables the user to intuitively select, connect and set parameters of the tool in the visual interface, improves the efficiency of the tool configuration process, and the reduction of the error rate guarantees the smoothness of the subsequent tool calling process, and further improves the efficiency of tool calling.
[0057] It should be noted that the execution subject of the embodiment can be an MCP server with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone and the like.
[0058] Based on this, the embodiment of the application provides a visual arrangement method for MCP-based model tool calling. Figure 1 , Figure 1 FIG. 1 is a flowchart of a first embodiment of the visual arrangement method for MCP-based model tool calling of the application.
[0059] In the embodiment, the visual arrangement method for MCP-based model tool calling includes steps S10-S40:
[0060] Step S10, receiving a first tool calling request sent by a client, wherein the first tool calling request is generated by a large language model deployed on the client according to an MCP;
[0061] The MCP refers to a protocol standard for standardizing the interaction between an AI (Artificial Intelligence) model and external tools and environment, which specifies the structure, fields, encoding method and transmission protocol of request / response.
[0062] The corresponding client refers to a software component or application program supporting MCP, and multiple large language models can be deployed on one client, or one large language model can be regarded as one client.
[0063] The large language model refers to a model constructed based on deep learning technology, which can autonomously decide whether to call an external tool and generate a tool calling request according to a task target and target external tool. The tool calling request refers to instruction information for requesting to call a specific tool to complete a specific task. In the following, the tool calling request generated by the large language model is referred to as the first tool calling request.
[0064] Exemplarily, during the running of the large language model, the large language model can analyze the current input data (such as a natural language instruction of a user, a processing result of the model, etc.) and its own algorithm logic to achieve a task target; when it is judged that an external tool needs to be called to assist in completing the task, the target tool expected to be called is determined, and the parameters (tool parameters) required for calling the tool are extracted or inferred from the input data and / or the context, such as when the external tool of "weather" is called, at least the city name needs to be provided as the tool parameter; then a first tool calling request meeting the requirements of the MCP protocol is generated according to the target tool and the tool parameters; then the first tool calling request is sent to the MCP server through the client, and subsequent processing is performed through the MCP server.
[0065] It can be understood that the MCP is used to construct the tool calling request, which standardizes the interaction between the large language model and the external model tool, so that different large language models can conveniently call various tools without the need for separate development and adaptation for each model and tool.
[0066] In step S20, the first tool calling request is parsed through the preset unified proxy tool and the preset tool configuration information to construct a second tool calling request, wherein the tool configuration information is generated according to the configuration operation on the preset visual arrangement interface of the MCP server;
[0067] The unified proxy tool refers to a software module in the MCP server responsible for uniformly processing tool calling requests of different types. The unified proxy tool can realize the interaction and collaborative work between different models and tools by performing operations such as parsing and converting the tool calling request. After receiving the first tool calling request, the MCP server routes the first tool calling request to the unified proxy tool for parsing and subsequent request conversion.
[0068] The tool configuration information refers to a service description file about tool calling, including metadata such as a tool access address URL (Uniform Resource Locator, uniform resource locator) template, header parameters, request body parameters, parameter mapping relationships, HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol) methods (such as GET / POST), permission settings, etc. The tool configuration information is generated based on the configuration operation of a user on the visual arrangement interface.
[0069] The visual orchestration interface refers to a graphical user interface deployed on the MCP server, which provides a more intuitive and convenient tool configuration and orchestration operation environment for users, and can provide operations such as tool dragging, connection, parameter configuration, etc. Through the visual orchestration interface, users can intuitively and conveniently modify and manage these configurations. The operations of the user on the visual orchestration interface can be converted into corresponding tool configuration information and saved on the MCP server.
[0070] Optionally, the tool configuration information can be saved in the database in the form of schema. For example, in response to a configuration operation on the visual orchestration interface, after determining the input information of the user, the input information is converted into a standard JSON schema (JavaScript Object Notation), and on this basis, the JSON schema is adapted to the MCP to be converted into an MCP schema.Tool object (MCP tool object), that is, the tool configuration information saved in the database.
[0071] The second tool calling request is used to represent the tool calling request generated by the unified agent tool, which refers to a standardized request data packet generated on the MCP server side, which meets the requirements of the external model tool calling, and contains all the detailed information required by the external model tool to execute the task.
[0072] In a possible implementation, the step S20 includes:
[0073] In step S21, the operation tool identifier and the tool parameter in the first tool calling request are extracted by the unified agent tool.
[0074] The operation tool identifier refers to an identifier for uniquely identifying a certain tool, which can be represented by a tool name, a tool code, etc., and is used to quickly locate the required tool. The tool parameter refers to a key-value pair set including a parameter name and a parameter value extracted by the large language model, which is used as the parameter required to be transmitted to the tool indicated by the tool identifier, such as {“city”: “Beijing”} when calling the weather tool.
[0075] Optionally, after the first tool calling request is parsed, the parsed parameters can be checked for integrity before determining whether to perform subsequent steps. For example, the operation tool identifier and the tool parameter obtained by parsing can be hashed, and the obtained hash value is compared with the hash value in the first tool calling request. In the case where they are completely consistent, it can be determined that the current parsed parameters are complete.
[0076] Step S22, determining, by the unified agent tool, target configuration information of the target tool indicated by the operation tool identifier from the tool configuration information;
[0077] The target tool refers to a specific tool instance determined according to the operation tool identifier.
[0078] Step S23, determining, by the unified agent tool, request parameters matched with tool parameters according to a first mapping relationship between the tool parameters and the request parameters preset in the target configuration information;
[0079] The request parameter refers to a key-value pair set including parameter names and parameter values in conformity with the interface call specification of the external model tool, carrying data used to specify request content, conditions or requirements, which determines how the external model tool processes the request and what kind of response is returned. In the target configuration information, the initial parameter values of each request parameter are empty by default.
[0080] The first mapping relationship refers to the mapping relationship between the tool parameters and the request parameters, which is used to guide the unified agent tool to determine the parameter name of the request parameter corresponding to any tool parameter according to the parameter name of the tool parameter, and to map the parameter value of the tool parameter as the parameter value of the request parameter.
[0081] Optionally, when performing parameter value mapping, it can be judged according to the definition of the parameter in the tool configuration information whether the request parameter is an HTTP header transmission parameter or a request body transmission parameter; for the header transmission parameter, the mapped value is combined and encapsulated according to the format requirement of the HTTP header; for the request body parameter, the mapped value is organized and encapsulated according to the data format (such as JSON, XML, etc.) of the request body, so as to ensure the correctness of the data format of the request parameter.
[0082] Step S24, generating, by the unified agent tool, a second tool call request according to the request parameters and the target configuration information.
[0083] Exemplarily, the target URL can be obtained by reading the URL of the target tool in the tool configuration information and replacing the request parameter field therein with the updated parameter value of the request parameter; then, the request header parameters and the corresponding parameter values are determined according to the tool configuration information, and the request header is organized in combination with the content type, authentication information, etc. preset in the tool configuration information; at the same time, the request body parameters and the corresponding parameter values are determined according to the tool configuration information; then, the complete second tool call request can be obtained in combination with the target URL, the request header and the above request body parameters, etc.
[0084] Optionally, before constructing the target URL, it can be judged according to the tool configuration information whether the second tool calling request of the current construction is a GET request or a POST request; if it is a GET request, the target URL and the request header are constructed, that is, the second tool calling request is obtained; if it is a POST request, the request body parameter needs to be further obtained.
[0085] In the embodiment, the large language model is effectively decoupled from the complexity of integrating various external APIs through the parameter conversion mechanism; at the same time, by providing a standardized and single entry point for all tool calls, the development and maintenance of the tool are simplified, code reuse is promoted, and the learning curve of integrating new external tools is reduced. The unified proxy tool processes and forwards the calling requests for different model tools without setting up independent forwarding interfaces for different model tools, which improves the tool configuration efficiency, avoids interface redundancy on the server, and reduces the management and maintenance workload of the model tools.
[0086] Step S30, sending the second tool calling request to the external interface service and receiving the response information generated by the external interface service according to the second tool calling request;
[0087] The external interface service is a service module developed and configured in advance independently of the current client and the MCP server, including a series of access interfaces of model tools, for receiving tool calling requests from the MCP server, executing corresponding business logic according to the content of the request, and returning the processing result (response information) to the MCP server.
[0088] The response information refers to the data generated and returned to the request sender by the external interface service after receiving the second tool calling request, including the result, status code, possible error information and related business data of the request processing, for informing the request sender of the processing situation of the request.
[0089] For example, assuming that the second tool calling request calls the weather query service to query the weather in Beijing today, after receiving the second tool calling request, the external interface service accesses the weather query service according to the target URL therein and inputs the request parameter, until the weather query service returns the processing result, which is packaged into the response information and sent to the MCP server.
[0090] Step S40, constructing the request result according to the MCP and the response information, and sending the request result to the large language model.
[0091] The request result refers to reply information for the first tool calling request constructed according to the MCP and the response information, sent to the large language model. By integrating the key data in the response information and adding necessary context information according to the requirements of the MCP, the large language model can make accurate judgments or generate corresponding outputs based on these information.
[0092] Exemplarily, after receiving the response information sent by the external interface service, the MCP server parses and converts the response information according to the pre-defined MCP rules, constructs a standardized request result such as a JSON Object, and sends it to the large language model for further analysis and processing.
[0093] Exemplarily, please refer to Figure 2 , Figure 2 A flowchart for realizing tool calling through a unified proxy tool is provided. After receiving the first tool calling request, the MCP server routes it to the unified proxy tool, and determines the operation tool identifier and tool parameters and other authentication parameters through the unified proxy tool for the first tool calling request. Then, the operation tool identifier and tool parameters and other authentication parameters can be verified for parameter integrity through hash value comparison. In the case where the parameter integrity verification fails, the unified proxy tool returns parameter misplacement information to the MCP server, which then performs standardized packaging to generate a request result and returns the request result to the client or the AI model. In the case where the parameter integrity verification passes, the tool configuration information of the target tool indicated by the operation tool identifier is further obtained, and the tool configuration information is used to determine the tool parameter matching request parameters (including request header parameters and request body parameters), including the request parameters in the URL in the tool configuration information, to obtain a target URL. The tool configuration information is further read to determine whether the request method of the current tool is a GET request or a POST request. If it is a GET request, the request header can be directly constructed according to the target URL to obtain a second tool calling request, and the HttpClientUtil.get method is used to send the GET request to the external interface service. If it is a POST request, the request body of the second tool calling request needs to be further constructed according to the request body parameters, and the above request header and request body are combined to obtain the second tool calling request, and the HttpClientUtil.post method is used to send the POST request to the external interface service. Then, after receiving the response information sent by the external interface service, it is processed, standardized packaging is performed according to the MCP protocol to obtain a request result, and the request result is returned to the large language model or the client.
[0094] The embodiment provides a method for visual arrangement of model tool invocation based on MCP, a preset unified agent tool is used for analyzing a first tool invocation request and generating a second tool invocation request, efficient conversion of tool invocation between different systems is realized, the MCP server can flexibly interact with the client and various external tools, a special calling interface does not need to be customized for each tool, and therefore the efficiency and flexibility of tool invocation are improved; meanwhile, tool configuration information is generated through configuration operation of a visual arrangement interface, a user does not need to manually write complex configuration code or modify a database, the complexity and error rate of tool configuration are reduced, the user can intuitively select, connect and set parameters of tools in the visual interface, the efficiency of the tool configuration process is improved, the reduction of the error rate guarantees the smoothness of a subsequent tool invocation process, and therefore the efficiency of tool invocation is improved.
[0095] In a feasible implementation, the method further includes:
[0096] In step A10, whether the tool configuration information of each tool is updated is detected by a preset timing scheduler.
[0097] The timing scheduler refers to a software component or a program module that triggers a task according to a preset time interval or a specific time point, and whether the tool configuration information of each tool is updated can be determined by checking whether the update time stamp of the tool configuration information of each tool is changed compared with the update time stamp in the last detection.
[0098] Optionally, whether the tool configuration information of each tool is updated can also be determined by hash comparison, for example, the MD5 hash value of the tool configuration information of each tool is calculated, the MD5 hash value calculated in the last detection is compared, and when the two hash values are different, it can be determined that the tool configuration information is updated.
[0099] It can be understood that, compared with the method of hash comparison, the method of timing task combined with the update time stamp monitoring and triggering mechanism is more efficient, only the modified configuration information is identified, and resource-intensive full scanning is avoided.
[0100] In step A20, when the tool configuration information of at least one tool is updated, the tool list of the MCP server is updated according to the updated tool configuration information, and the tool list is used to provide available tool information to the client.
[0101] The tool list refers to a data structure maintained on the MCP server, recording the basic information of available tools, such as tool identification, name, function description, memory address corresponding to tool configuration information, etc., which is equivalent to a directory index of tool resources on the server. In the case of adding or deleting tool configuration information, the corresponding tool record is added or deleted in the tool list.
[0102] Exemplarily, refer to Figure 3 , Figure 3 A flowchart for implementing dynamic updating by a timing scheduler is provided. First, the timing scheduler is initialized to query the database changes every minute, which can be determined by checking whether the update timestamp has changed to determine whether the tool configuration information of each tool in the database has changed. In the case where the update timestamp has not changed, this synchronization is skipped. In the case where the update timestamp has changed, the updated tool configuration information is parsed and converted into a standardized JSON Schema form for easy saving in the database. Further, the JSON Schema can be converted into an MCPschema.Tool object (MCP tool object) according to the format requirements in MCP, and the tool list on the MCP server is updated according to the MCP tool object, such as adding a tool object or modifying the tool configuration information of the original tool on the tool list, to complete the synchronization between the tool list and the actual tool configuration information.
[0103] In this embodiment, the update of the tool configuration information is automatically detected by timing to ensure that new tools become callable, while old tools are gracefully removed without interrupting ongoing operations, and the server can take effect without restarting, realizing "zero downtime" registration. Thus, the addition or modification of tools, which may be disruptive and time-consuming changes, is converted into a seamless background operation, improving the efficiency of deploying and managing external model tools. At the same time, dynamic publishing of external model tools is realized, ensuring the real-time nature of the tool list and thus the smoothness of the overall model tool calling process.
[0104] In a possible implementation, the method further comprises:
[0105] Step A21, in the case where the tool configuration information of at least one tool has an update, saving the updated tool configuration information to the cache.
[0106] The cache is a high-speed data storage technology used for temporarily storing data for quick access. By saving the updated tool configuration information to the cache, the latest tool configuration information can be quickly read, thereby improving the calling efficiency of the model tool.
[0107] In this embodiment, by saving the updated tool configuration information into the cache, fast read-write access is provided, and in combination with the tool configuration information saved in the memory, persistent storage of rule data can be ensured when the system is restarted or the memory is insufficient, thereby realizing a multi-level cache strategy and realizing high-concurrency and safe memory management.
[0108] Based on the first embodiment of the present application, the same or similar contents as the above embodiment one can be referred to the above introduction, and will not be described in detail hereinafter. On this basis, before step S10, it further includes:
[0109] In step S01, a connection establishment request sent by a client is received, and the connection establishment request is parsed through a preset request interceptor to determine the authentication parameters of the connection establishment request, wherein the authentication parameters include a tenant token and tenant information.
[0110] The request interceptor is a middleware component deployed on the MCP server, which is used to intercept and process incoming requests. By parsing and verifying the request before it reaches the target processing module, security authentication is achieved to reduce the risk of illegal attacks on the MCP server.
[0111] The tenant token is a token in the form of a string or a number code, which is used to identify and verify the identity of the tenant. Different large language models may be deployed in the client. In order to distinguish the requests and data of different large language models, one or more tenant tokens can be assigned to each large language model.
[0112] The tenant information is detailed data about the tenant, which may include tenant name, contact information, permission information, etc., and is used to further verify the tenant identity and authorized access.
[0113] Optionally, in order to ensure the security of data transmission, the client and the MCP server can agree on a custom encryption and decryption method to encrypt and decrypt the authentication parameters in advance. Therefore, the request interceptor of the MCP server can call the corresponding decryption method to decrypt the authentication parameters after parsing the connection establishment request, so as to obtain the tenant token and tenant information and other data.
[0114] In step S02, the validity of the tenant token is verified.
[0115] For example, after obtaining the tenant token, its digital signature is verified to ensure authenticity, and the hash value of the token is checked to ensure integrity, and then the expiration time field of the token is determined, the current time of the MCP server is obtained, and the current time and the expiration time are compared. If the current time is earlier than the expiration time, the token is not expired, which means that the token is valid.
[0116] Step S03, in the case where the validity verification of the tenant token passes, time window verification is performed on the tenant information.
[0117] The time window verification refers to a verification mechanism based on a time range, which predefines a valid time window for the tenant information, and defines that the tenant information is valid and available within a specific time period.
[0118] For example, after the validity verification of the tenant token passes, the time window parameters of the tenant, including the start time and end time of the time window, can be obtained from the database according to the tenant token. Then, the current system time is obtained, and the current time is compared with the start time and end time of the preset time window. If the current time is greater than or equal to the start time and less than or equal to the end time, it is determined that the time window verification of the tenant information passes.
[0119] It can be understood that by performing time window verification, it is ensured that access rights are granted only during the predefined authorization start and authorization end period, preventing attackers from using expired tenant information to connect, and adding a time dimension for security.
[0120] Step S04, in the case where the time window verification of the tenant information passes, according to the MCP authorization information, it is determined whether the target tenant indicated by the tenant information has the permission to access the MCP server.
[0121] The MCP authorization information refers to a set of data used to manage the access permission of the tenant to the MCP server, including tenant identification, authorized validity period, authorized operation permission, and other information.
[0122] Step S05, in the case where the target tenant has the permission to access the MCP server, a connection channel is established with the client.
[0123] For example, after the time window verification passes, the authorization record corresponding to the target tenant (indicated by the tenant information) is queried from the MCP authorization information database, and the permission related information is extracted from the authorization record to determine whether the target tenant has the permission to access the MCP server. Then, after it is determined that the target tenant has the permission to access the MCP server, the MCP server and the client establish a stable connection channel through a negotiated communication protocol (such as TCP / IP protocol).
[0124] Optionally, a persistent connection channel can be established between the MCP server and the client through the SSE (Server-Sent Events) endpoint of the MCP server, and then real-time data push from the MCP server to the client can be realized through the connection channel, for example, a tool list can be pushed in real time, so that the client can obtain the latest available tool information on the MCP server.
[0125] In a possible implementation, before step S23, further comprising:
[0126] In step S06, the request interceptor is invoked to determine whether the target tenant has the permission to invoke the target tool according to the target configuration information.
[0127] For example, before generating the second tool invocation request for the target tool, the request interceptor can be invoked to find the tool authorization policy of the target tool in the tool configuration information, and determine whether the target tenant has the permission to invoke the target tool. If the target tenant does not have the corresponding permission, the interception request of the client is rejected, and a response information indicating that the target tenant does not have the permission is returned. If the target tenant has the corresponding permission, the second tool invocation request for the target tool can be further generated.
[0128] In step S07, when the target tenant has the permission to invoke the target tool, the request interceptor is invoked to determine the request parameter matched with the tool parameter according to the first mapping relationship between the tool parameter and the request parameter in the target configuration information.
[0129] For example, please refer to Figure 4 , Figure 4 An architecture diagram of multi-layer permission control is provided. After receiving a connection establishment request, the MCP server is intercepted by the request interceptor for analysis and verification before actual processing. The request interceptor analyzes the connection establishment request to obtain authentication parameters such as a tenant token and tenant information, and performs verification, mainly including tenant token verification, time window verification, and MCP authorization verification. The first layer is to verify the validity of the tenant token. When the verification is passed, the second layer is entered to perform time window verification on the tenant information to ensure that the tenant information is valid at the current time. When the time window verification is passed, the third layer MCP authorization verification is entered. According to the MCP authorization information, it is determined whether the target tenant indicated by the tenant information has the permission to access the MCP server. When the third layer verification is passed, the MCP server establishes a connection channel with the client to receive the first tool invocation request to ensure that the identity of the client is legal. When the first tool invocation request is received, the request interceptor can be invoked to perform fourth-layer tool-level permission verification to determine whether the target tenant has the permission to invoke the target tool indicated by the tool identifier in the first tool invocation request.
[0130] In this embodiment, by strictly verifying whether the target tenant has the permission to invoke a specific tool, highly fine-grained tool-level permission checking is achieved, and unauthorized access is further reduced.
[0131] In a possible implementation, after step S05, further comprising:
[0132] Step B06, generate a session identifier of the connection channel with the target tenant, and update the preset second mapping relationship between the target tenant and the session identifier;
[0133] The session identifier is a string or number used to uniquely identify a connection channel. The second mapping relationship refers to the mapping relationship between the target tenant and the session identifier, which is usually stored in the MCP in the form of a database table, a key-value pair, etc.; the MCP server can quickly find the corresponding target tenant according to the session identifier through this mapping relationship, and then can judge whether the tenant currently sending the first tool invocation request is the target tenant corresponding to the connection channel, in order to prevent security threats such as session hijacking and replay attacks.
[0134] Before step S06, it also includes:
[0135] Step B07, extracting the target session identifier in the first tool invocation request, and judging whether the target tenant and the target session identifier conform to the second mapping relationship;
[0136] Step B08, in the case where the target combination and the target session identifier conform to the second mapping relationship, executing the step of judging whether the target tenant has the permission to invoke the target tool according to the tool identifier and the target configuration information through the request interceptor.
[0137] Exemplarily, after obtaining the tool identifier and the tool parameter by parsing the first tool invocation request, the target session identifier can be further extracted therefrom, and according to the pre-stored second mapping relationship rule, it is checked whether the target tenant and the target session identifier exist and match in the mapping relationship; if they exist and match, it means that the target tenant can interact with the MCP server through the connection channel.
[0138] It can be understood that by first judging whether the target tenant and the session identifier conform to the second mapping relationship, it is ensured that only legitimate tenants in a legitimate session state can perform subsequent operations, preventing illegal users from impersonating legitimate tenants or using expired sessions for malicious access, effectively protecting the security of the MCP server and tenant data.
[0139] In this embodiment, by means of the request interceptor, the tool invocation request is intercepted before the tool invocation request, connection establishment reaches the main application logic, so that the unauthorized request is rejected at the earliest stage of the processing pipeline, thereby saving system resources and enhancing security. In addition, by setting a four-layer permission verification mechanism including token authentication, time window verification, MCP authorization verification and fine-grained tool-level authorization verification, even if one layer of check is bypassed or fails, the subsequent layer still provides protection, embodying the "defense in depth" strategy; at the same time, this strict isolation, fine-grained access control and comprehensive audit enable different business units or external clients to safely share the same MCP server infrastructure, thereby reducing the overall deployment and operation cost.
[0140] Exemplarily, refer to Figure 5 , Figure 5 An end-to-end flowchart of model tool invocation is provided, and the implementation of external tool invocation of large language model mainly includes four stages.
[0141] Stage 1 is system initialization, including S101, MCP server queries tool configuration information in the database when starting, after the database returns tool configuration information of each tool (S102), S103 is executed, and the tool is registered in the tool list, so as to know the information of the current available tools.
[0142] Stage 2 is client connection and permission verification, the client performs S201, and requests to establish SSE connection to the MCP server; and the MCP server, after receiving the request, intercepts it through the request interceptor (S202), analyzes and determines the tenant token, tenant information and other authentication parameters, and performs S203 tenant token verification, after the tenant token verification is passed, S204 time window verification is performed, and after the verification is passed, MCP authorization verification (S205) is performed, and any one of them will directly reject the request; and in the case that all of them are passed, the request interceptor performs S206, and the permission of the tenant indicated by the request of the MCP server is verified; and then the MCP service performs S207, and establishes the SSE connection channel with the client, so as to persistently transmit data and interact information; and then the client performs S208, and notifies the large language model deployed thereon that the connection is ready, and the tool invocation request can be initiated.
[0143] Stage 3 is tool discovery and invocation. During the process of answering the user input question, the large language model may need to call external tools for assistance. Before requesting to call a specific tool, the tool list can be requested from the client (S301) to determine the currently available tools, and the client performs S302 to request the tool list from the MCP server. Since the identity has been verified before establishing the connection channel, the MCP server can directly perform S303 to return the tool list to the client, and the client returns the tool list to the large language model (S304). Then, the large language model can perform S305 to generate a first tool invocation request for a specific tool, and the client sends the first tool invocation request to the MCP server (S306). The MCP service performs S307 to route the received first tool invocation request to the unified proxy tool, and parses it through the proxy tool to determine the tool identifier and tool parameters (S308). Before further processing, the tool permission of the tenant establishing the connection channel can be verified through the request interceptor (S309) to determine whether the current tenant has the permission to call the specific tool. Then, in the case where the tool permission verification is passed (S310), the unified proxy tool performs S311 to query the first mapping relationship between the tool parameters and the request parameters in the database. After the database returns the first mapping relationship (S312), S313 is performed to convert the parameter values of the tool parameters to the parameter values of the request parameters, and a second tool invocation request is constructed accordingly. Then, S314 is performed to send the second tool invocation request to the external result service, and the response information is generated by the external interface service processing and returned to the unified proxy tool (S315). Then, the unified proxy tool standardizes and encapsulates the response information according to the format requirements of the MCP (S316) to generate a request result, and returns the request result to the MCP server (S317). Then, the MCP server performs S308 to return the request result to the client, and the client returns the request result to the large language model (S319).
[0144] The fourth stage is configuration hot update. This stage can be executed in parallel with the second and third stages. The MCP server detects changes in tool configuration information in the database (S401) and returns the updated tool configuration information (S402). The MCP server can automatically update the tool list based on the updated tool configuration information without restarting the service, achieving zero downtime update (S403), thereby ensuring that the available tool information in the tool list is accurate.
[0145] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as the above-mentioned embodiment one and embodiment two can be referred to the above introduction, and the subsequent will not be described. On this basis, the visual arrangement interface includes a tool library panel, an attribute panel and a status bar, and the visual arrangement method based on the MCP model tool calling further includes:
[0146] Step E10, in response to a configuration operation for the tool library panel, determining a tool to be operated;
[0147] The tool library panel is a graphical area that presents a set of tools available in the system in a visual way, which can be composed of a series of icons, buttons or list items, each element corresponding to a specific tool.
[0148] The configuration operation refers to a behavior of user interaction with the software system, which activates a certain function or event in the system through a specific signal generated by an input device (such as mouse, keyboard, touch screen, etc.); The configuration operation can be single-click, double-click, slide, drag, etc., which is not specifically limited in this embodiment.
[0149] The tool to be operated is determined according to the user's configuration operation, which is the tool that the user currently wants to configure, and each tool to be operated has its own unique operation tool identifier, so as to distinguish different tools and their tool configuration information.
[0150] Step E20, in response to a configuration operation for the attribute panel, determining tool configuration information of the tool to be operated;
[0151] The attribute panel is a user interface component in the visual arrangement interface for displaying and editing the attributes of a specific object (such as tools, services, etc.), which can exist in the form of a window or a panel; Through data interaction with the MCP server, it can obtain and display the attribute information of the current tool to be operated in real time, and also can modify these attributes by receiving user input; The attribute panel can contain various controls inside, such as text box, drop-down menu, check box, etc., for displaying and editing different types of attributes.
[0152] Step E30, in response to a trigger operation of a save control in the status bar, storing the tool configuration information of the tool to be operated into a preset database, so that the MCP server can call the tool configuration information from the database.
[0153] The status bar is used to display various information related to the current state of the system, the running situation of the application program or the user operation, which can convey information to the user through graphics, text or icons, and can integrate some interactive controls. The save control is an interactive element in the status bar with a specific function, which can be presented in the form of a button, an icon or a link.
[0154] Optionally, the status bar can further include a version option box for displaying historical editing versions of the tool to be operated, and the user can select different historical editing versions of the tool to be operated for viewing or further editing by performing a configuration operation on different historical editing versions in the version option box; and then after detecting the configuration operation on different historical editing versions in the version option box, determining a target historical version and displaying tool configuration information of the target historical version through the attribute panel for the user to view or edit. That is, version control can be realized through the version option box.
[0155] Optionally, the visual arrangement interface can further display an arrangement canvas for configuring a dependency relationship between the tool to be operated and other tools.
[0156] For example, please refer to Figure 6 , Figure 6A design architecture diagram of a visual arrangement interface is provided, which includes a tool library panel, an arrangement canvas, an attribute panel and a status bar, and the arrangement manner can be a left tool library panel, a central arrangement canvas, a right attribute panel and a bottom status bar, and the embodiment is differentially limited. The tool library panel displays a tool classification tree, a search filter, a tool card list and a batch operation control, a user can expand or merge each tool node on the tool classification tree through a configuration operation on the tool node, and the MCP server synchronously displays the related introduction information (such as tool identification, tool parameters, etc.) of the node and the tool nodes under the node in the tool card list; the user can also directly determine one or more target tools through a configuration operation on the search filter, and the MCP server synchronously displays the related introduction information of the target tools contained in the search result of the configuration operation in the tool card list; then the user can determine the tool to be operated through a configuration operation on any tool in the tool card list, or can realize the synchronous selection of multiple tools in the tool card list through a configuration operation on the batch operation control, and determine multiple tools to be operated. The arrangement canvas includes a drag arrangement area and a connection selection area, and after the user determines the tool to be operated through the tool classification tree or the tool card list, the determined tool to be operated is randomly arranged and displayed in the drag arrangement area; the user can drag and move the icons corresponding to different tools in the drag arrangement area, and at the same time, the tool connection line is selected through a configuration operation on the connection selection area to connect the dragged tool icons, so as to clearly define the dependency relationship between the tools. The attribute panel includes a tool configuration area, a parameter configuration area, a permission control area and a verification control, the user can input the basic information related to the tool to be operated in the tool configuration area, such as tool name, tool identification, tool parameters, etc., define the mapping relationship between the tool parameters and the request parameters in the parameter configuration area, and determine which tenants have the right to call the tool to be operated in the permission control area; and the MCP server determines the basic information of the tool to be operated in response to the configuration operation on the tool configuration area, determines the parameter mapping information of the tool to be operated in response to the configuration operation on the parameter configuration area, determines the permission control information of the tool to be operated in response to the configuration operation on the permission control area, and converts the above basic information, parameter mapping information and permission control information into the form of JSONSchema in response to the trigger operation on the verification control, so as to be checked by the user, and at the same time, the calling request is constructed to determine whether the tool to be operated can be correctly accessed. The status bar includes a save control and a version option box, the user can convert the above configuration on the arrangement canvas and the attribute panel into tool configuration information through a trigger operation on the save control, save it in the database, and at the same time, update the memory mapping relationship of the tool to be operated for subsequent calling; a version serial number is synchronously generated and saved in the version option box, and the operation on the version option box is not described again.
[0157] Optionally, the above-mentioned visual editing interface and overall external tool calling logic can be implemented by setting a front-end display layer, an interactive control layer, a data management layer and a back-end API layer. The front-end display layer utilizes JavaScript frameworks such as Vue.js or React, UI (User Interface) component libraries such as Element UI or Ant Design to build a dynamic visual editing interface, and the data visualization in the interface is handled by chart libraries such as ECharts, while the interactive flowchart rendering and drag-and-drop functions are supported by Canvas technology. The interactive control layer is responsible for managing all configuration operations of the user for the visual editing interface, including drag-and-drop operations, permission management, tool configuration information change tracking, etc. The data management layer can use a JSON Schema validator to verify the integrity and correctness of the tool configuration information, and a state management library such as Vuex or Redux to perform predictable state management in response to trigger operations for the verification control; an API data adapter is used to convert user input into a storage format for the back-end to achieve seamless front-end and back-end communication; WebSocket is used to realize real-time communication between different management tools (such as unified proxy tools, timing schedulers, request interceptors, etc.) on the MCP server. The back-end API provides dedicated application programming interfaces through controllers to implement key functions such as permission verification, configuration information monitoring and tool orchestration. For example, a pre-set MCP tenant management controller can be used to manage different tenants that can access the MCP server and the tool permission information, time limit information, etc. that can be called by each tenant.
[0158] In this embodiment, by providing a visual editing interface, the user can quickly determine and configure the tools to be operated through simple configuration operations, reducing the time for the user to find tools and edit hard codes, thereby improving the overall operation efficiency.
[0159] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the visual orchestration method of the MCP-based model tool calling of the present application. Further simple transformations based on this technical concept are within the scope of protection of the present application.
[0160] The MCP server provided in the embodiments of the present application includes at least one processor and a memory communicatively connected to the at least one processor. The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the visual orchestration method of the MCP-based model tool calling in Embodiment I.
[0161] The following refers to Figure 7The diagram illustrates a structural schematic of an MCP server suitable for implementing embodiments of this application. The MCP server in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 7 The MCP server shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0162] like Figure 7 As shown, the MCP server may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in the read-only memory 1002 or a program loaded from the storage device 1003 into the random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the MCP server. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the MCP server to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows MCP servers with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0163] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the method shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network through a communication device, or installed from the storage device 1003, or installed from the read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiments disclosed in the present application are executed.
[0164] The MCP server provided by the embodiments of the present application adopts the visual arrangement method for calling the model tool based on MCP in the above-mentioned embodiments, and can solve the technical problem of how to improve the calling efficiency of the model tool. Compared with the prior art, the MCP server provided by the present application has the same beneficial effects as the visual arrangement method for calling the model tool based on MCP provided by the above-mentioned embodiments, and other technical features in the MCP server are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0165] It should be understood that parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the description of the above-mentioned embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0166] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0167] The embodiments of the present application provide a computer readable storage medium having computer readable program instructions (i.e. computer program) stored thereon, the computer readable program instructions being used to execute the visual arrangement method for calling the model tool based on MCP in the above-mentioned embodiments.
[0168] The computer readable storage medium provided by the embodiments of the present application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system or device, or any combination thereof. More specific examples of the computer readable storage medium may include, but are not limited to, an electric connection with one or more conductive wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the embodiments, the computer readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, an RF (Radio Frequency), and the like, or any suitable combination thereof.
[0169] The computer readable storage medium described above may be contained in the MCP server, or may exist separately without being assembled into the MCP server.
[0170] The computer readable storage medium described above carries one or more programs, which, when executed by the MCP server, cause the MCP server to: receive a first tool invocation request sent by a client, wherein the first tool invocation request is generated by a large language model deployed on the client according to an MCP; parse the first tool invocation request through a preset unified agent tool and preset tool configuration information to construct a second tool invocation request, wherein the tool configuration information is generated according to a configuration operation on a preset visual arrangement interface of the MCP server; send the second tool invocation request to an external interface service, receive response information generated by the external interface service according to the second tool invocation request; construct a request result according to the MCP and the response information, and send the request result to the large language model.
[0171] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0172] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0173] The modules involved in the embodiments of the present application can be implemented in the form of software or in the form of hardware. In some cases, the name of the module does not constitute a limitation on the module itself.
[0174] The readable storage medium provided by the embodiments of the present application is a computer readable storage medium, which stores computer readable program instructions (i.e. computer programs) for executing the above-mentioned visualization and arrangement method for calling a model tool based on MCP, and can solve the technical problem of how to improve the calling efficiency of the model tool. Compared with the prior art, the computer readable storage medium provided by the embodiments of the present application has the same beneficial effects as the visualization and arrangement method for calling a model tool based on MCP, which will not be described here.
[0175] The embodiment of the present application further provides a computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method for visualizing orchestration of MCP-based model tool invocation as described above.
[0176] The computer program product provided by the embodiment of the present application can solve the technical problem of how to improve the calling efficiency of the model tool. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the method for visualizing orchestration of MCP-based model tool invocation provided by the above-mentioned embodiment, and are not described here.
[0177] The above only describes some embodiments of the present application, and does not limit the patent scope of the present application. Any equivalent structural transformation made by using the content of the present application specification and drawings, or direct / indirect application in other related technical fields is included in the patent protection scope of the present application.
Claims
1. A visual orchestration method for model tool invocation based on MCP, characterized in that, The visual orchestration method for model tool calls based on MCP is applied to the Model Context Protocol (MCP) server, and the method includes: Receive a first tool invocation request sent by the client, wherein the first tool invocation request is generated by the large language model deployed on the client according to MCP; Using a pre-defined unified proxy tool, extract the operation tool identifier and tool parameters from the first tool call request; The unified proxy tool determines the target configuration information of the target tool indicated by the operation tool identifier from the preset tool configuration information, wherein the tool configuration information is generated based on the configuration operation of the preset visual orchestration interface on the MCP server; The unified proxy tool determines the request parameters that match the tool parameters based on the first mapping relationship between the preset tool parameters and request parameters in the target configuration information. The unified proxy tool generates a second tool invocation request based on the request parameters and the target configuration information. The second tool invocation request is sent to an external interface service, and the response information generated by the external interface service based on the second tool invocation request is received. Based on the MCP and the response information, a request result is constructed and sent to the large language model; The visual orchestration interface includes a tool library panel, an attribute panel, and a status bar. The visual orchestration method for calling model tools based on MCP also includes: In response to a configuration operation on the tool library panel, determine the tool to be operated; In response to a configuration operation on the property panel, determine the tool configuration information of the tool to be operated; In response to a trigger operation on the save control of the status bar, the tool configuration information of the tool to be operated is stored in a preset database so that the MCP server can retrieve the tool configuration information from the database.
2. The visual orchestration method for calling model tools based on MCP as described in claim 1, characterized in that, Prior to the step of receiving the first tool invocation request sent by the client, the method further includes: The system receives a connection establishment request sent by the client and parses the connection establishment request through a preset request interceptor to determine the authentication parameters of the connection establishment request, wherein the authentication parameters include a tenant token and tenant information. The tenant token is validated. If the tenant token passes the validity verification, the tenant information is verified within a time window. If the time window verification of the tenant information passes, the system determines whether the target tenant indicated by the tenant information has permission to access the MCP server based on the preset MCP authorization information. If the target tenant has permission to access the MCP server, a connection channel is established with the client.
3. The visual orchestration method for calling model tools based on MCP as described in claim 2, characterized in that, Before the step of determining the request parameters matching the tool parameters using the unified proxy tool based on the first mapping relationship between preset tool parameters and request parameters in the target configuration information, the method further includes: The request interceptor determines, based on the target configuration information, whether the target tenant has permission to invoke the target tool. If the target tenant has permission to invoke the target tool, the step of determining the request parameters that match the tool parameters is performed through the unified proxy tool, based on the first mapping relationship between the preset tool parameters and request parameters in the target configuration information.
4. The visual orchestration method for calling model tools based on MCP as described in claim 3, characterized in that, Following the step of establishing a connection channel with the client, the method further includes: Generate a session identifier for the connection channel between the target tenant and the session identifier, and update the preset second mapping relationship between the target tenant and the session identifier; Before the step of determining whether the target tenant has permission to invoke the target tool based on the target configuration information through the request interceptor, the method further includes: Extract the target session identifier from the first tool call request, and determine whether the target tenant and the target session identifier conform to the second mapping relationship; If the target tenant and the target session identifier match the second mapping relationship, the step of determining whether the target tenant has permission to invoke the target tool based on the target configuration information through the request interceptor is executed.
5. The visual orchestration method for calling model tools based on MCP as described in claim 1, characterized in that, The visualization orchestration method for calling model tools based on MCP also includes: The system uses a pre-defined timer to check if the tool configuration information of each tool has been updated. If the tool configuration information of at least one tool is updated, the tool list of the MCP server is updated according to the updated tool configuration information, wherein the tool list is used to provide the client with available tool information.
6. The visual orchestration method for calling model tools based on MCP as described in claim 5, characterized in that, The visualization orchestration method for calling model tools based on MCP also includes: If the tool configuration information of at least one tool is updated, the updated tool configuration information is saved to the cache.
7. An MCP server, characterized in that, The MCP server includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the visualization orchestration method for calling MCP-based model tools as described in any one of claims 1 to 6.
8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the visualization orchestration method for calling the MCP-based model tool as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Interface calling method and device based on visual arrangement, equipment and medium
CN117573110A
Biological information MCP service calling method, system, equipment and medium
CN120336048A