A cross-environment AI task collaborative execution method, device and storage medium based on the MCP protocol

Through the cross-environment AI task collaborative execution method based on the MCP protocol, local applications are encapsulated as a unified interface API, and two-way operations between cloud and local software are realized, solving the problem that cloud AI cannot operate local professional software, improving task success rate and operation efficiency, ensuring data security and dynamic coordination of resources.

CN120186142BActive Publication Date: 2025-08-15董喆
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510655952.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2025-08-15
Estimated Expiration
2045-05-21

AI Technical Summary

Technical Problem

In the existing technology, cloud AI cannot effectively operate local professional software, cross-environment collaboration is inefficient and security and privacy risks are present. Traditional local automation solutions lack intelligent collaboration capabilities, network fluctuations lead to high restart costs when tasks are interrupted, and data interaction requires manual transfer.

Method used

Based on the MCP protocol, multiple local applications are encapsulated into unified interface APIs, context management is built in the cloud through the MCP protocol, data consistency is achieved, and operation requests are received in the cloud are converted into local operation commands, supporting context-aware operations, real-time synchronization and conflict management, security policy encryption, dynamic scheduling toolchain, ensuring discontinued network transmission and operation verification.

Benefits of technology

It realizes a two-way operation path between cloud AI and local non-API software, improves the success rate of cross-environment tasks, ensures the security of sensitive data, dynamically coordinates hardware resources, builds an elastic hybrid computing architecture, and improves operational efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120186142B_ABST
    Figure CN120186142B_ABST
Patent Text Reader

Abstract

The present invention proposes a method, device and storage medium for collaborative execution of cross-environment AI tasks based on the MCP protocol, which encapsulates multiple different applications deployed on the local system into unified interface APIs, each application corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations; constructs the MCP protocol in the cloud, and obtains the current status of each application's execution task through the unified interface API based on the MCP protocol, so that the data between different applications remains consistent; receives operation requests input by users in the cloud, converts the user's operation requests into operation commands of at least one application based on the MCP protocol, and transmits the operation commands to the corresponding applications deployed on the local system through the unified interface API, and the applications perform corresponding operations based on the operation commands. The present invention establishes a two-way operation channel between cloud-based AI and local non-API software, thereby improving the success rate of cross-environment tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence and distributed processing fusion technology, and specifically to a method, device and storage medium for collaborative execution of cross-environment AI tasks based on the MCP protocol. Background Art

[0002] Currently, enterprises' intelligent transformation faces the following technical obstacles due to the fragmentation of the tool chain:

[0003] Tool operation barriers: Cloud AI can only operate web applications with open APIs (such as Salesforce and Google Workspace) and cannot control local professional software (such as Adobe's suite of software and EDA tools), leading to automation process breakpoints. Industry research shows that 38% of key enterprise operations rely on non-API-based local software (Forrester 2023 report). Traditional local automation solutions (such as AutoHotkey and SikuliX) rely on script recording and playback, lacking intelligent collaboration with cloud AI and unable to dynamically respond to changing needs.

[0004] Inefficient cross-environment collaboration: Data exchange between web and local tools requires manual transfer (e.g., downloading cloud data, processing locally, and then re-uploading), increasing average processing time by 57% (Gartner data). When network fluctuations interrupt tasks, the lack of an offline transfer resumption mechanism makes restarting tasks costly.

[0005] Security and privacy risks: The risk of sensitive data being easily leaked. Summary of the Invention

[0006] The present invention aims to solve one or more technical deficiencies in the above-mentioned prior art and proposes the following technical solutions.

[0007] A method for collaborative execution of cross-environment AI tasks based on the MCP protocol (i.e., Model Context Protocol), the method comprising:

[0008] The encapsulation step encapsulates multiple different applications deployed on the local system into unified interface APIs. Each application corresponds to a unified interface API. The encapsulated unified interface API supports context-aware operations.

[0009] In the context management step, the MCP protocol is built in the cloud. Based on the MCP protocol, the current status of each application's execution task is obtained through a unified interface API. The context of the current status is used to ensure consistency of data between different applications.

[0010] The execution step includes receiving an operation request input by a user in the cloud, converting the user's operation request into an MCP operation intent based on the MCP protocol, converting the MCP operation intent into an operation command of at least one application, and transmitting the operation command to a corresponding application deployed on the local system through a unified interface API. The application performs a corresponding operation based on the operation command and uses the operation result to update the current state of the application.

[0011] Furthermore, the operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, the service is connected through the REST / GraphQL API to obtain data in real time and map it to the context field; for tool applications, the operating system hook function is used to monitor the system-level events of the local software, capture the operation status and maintain it, or recognize the interface elements through OCR, and dynamically update the tool_state field in the context; for local private system applications, the SDK and middleware are used to achieve context synchronization between the private system applications and the MCP protocol.

[0012] Furthermore, the operations of constructing the MCP protocol in the cloud are:

[0013] Define the context data structure: the intent layer is used to define task goals and constraints; the data flow layer is used to record data sources and output paths; the tool status layer is used to save real-time snapshots of each application; the security policy layer is used to configure access control rules, encryption algorithms, and desensitization policies; set up a version control mechanism, generate a unique version identifier for each context change, and store incremental differences (Delta) instead of full data to reduce storage overhead;

[0014] Context synchronization and conflict management: Real-time synchronization uses a publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues. Conflict resolution strategy prioritizes time, prioritizing the change to the latest timestamp, applicable to non-critical parameters. Manual arbitration freezes the context for critical data conflicts and notifies the user to intervene. Offline synchronization guarantees persistence of context checkpoints at regular intervals, automatically loading the most recent valid state when tasks resume, ensuring continuity in network outage scenarios.

[0015] Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native application operation instructions; reverse conversion: parsing application output and extracting key information to update context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met;

[0016] Security and permission control: Data security is enhanced with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring that only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

[0017] Furthermore, in the execution step, the MCP operation intent is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of the corresponding applications. According to the operation commands of the applications, a tool chain composed of applications is dynamically scheduled based on the context state to ensure continuous execution of tasks. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool and the completed operations are skipped. Before executing key operations, a secondary confirmation process is triggered to perform operation verification to prevent misoperation.

[0018] Furthermore, the operation of the tool chain composed of applications dynamically scheduled based on the context state according to the operation commands of the application is: all operation commands obtained by converting all task subgraphs based on task dependencies are sorted to obtain an operation command execution dependency graph, an application call sequence is generated based on the operation command execution dependency graph to obtain the tool chain of the application, the context state of the currently executed operation command is monitored, and if the context state satisfies the execution of the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.

[0019] Furthermore, after obtaining the operation command execution dependency graph, the cloud uses a first thread to send a first memory usage request to the local system, and the first memory size requested by the first memory usage request is determined based on the first operation command in the operation command execution dependency graph. The cloud uses a second thread to send a second memory usage request to the local system, and the second memory size requested by the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After monitoring that the first operation command is executed, the context state data executed in the first memory is sent to the cloud for storage, and at the same time, a third memory size is determined based on the third operation command in the operation command execution dependency graph. If the third memory size is less than the first memory size, The third memory size is less than or equal to the first memory size, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the third memory size is larger than the first memory size, the cloud uses a third thread to send a third memory usage request to the local system and reclaims the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, the third memory is applied for in the cloud, and an application image corresponding to the third operation command is constructed in the third memory of the cloud. The image is used to execute the third operation command until all operation commands in the operation command execution dependency graph are executed, wherein the operation command execution dependency graph has at least three operation commands.

[0020] Furthermore, a monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time and provide abnormal alarms and audit tracing.

[0021] The present invention also proposes a cross-environment AI task collaborative execution device based on the MCP protocol, which includes:

[0022] The encapsulation unit encapsulates multiple different applications deployed on the local system into unified interface APIs. Each application corresponds to a unified interface API. The encapsulated unified interface API supports context-aware operations.

[0023] The context management unit builds the MCP protocol in the cloud and obtains the current status of each application's execution task through a unified interface API based on the MCP protocol. The context of the current status ensures that the data between different applications remains consistent.

[0024] An execution unit receives an operation request input by a user in the cloud, converts the user's operation request into an MCP operation intent based on the MCP protocol, converts the MCP operation intent into an operation command of at least one application, and transmits the operation command to a corresponding application deployed on the local system through a unified interface API. The application executes a corresponding operation based on the operation command and uses the operation result to update the current state of the application.

[0025] Furthermore, the operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, the service is connected through the REST / GraphQL API to obtain data in real time and map it to the context field; for tool applications, the operating system hook function is used to monitor the system-level events of the local software, capture the operation status and maintain it, or recognize the interface elements through OCR, and dynamically update the tool_state field in the context; for local private system applications, the SDK and middleware are used to achieve context synchronization between the private system applications and the MCP protocol.

[0026] Furthermore, the operations of constructing the MCP protocol in the cloud are:

[0027] Define the context data structure: the intent layer is used to define task goals and constraints; the data flow layer is used to record data sources and output paths; the tool status layer is used to save real-time snapshots of each application; the security policy layer is used to configure access control rules, encryption algorithms, and desensitization policies; set up a version control mechanism, generate a unique version identifier for each context change, and store incremental differences (Delta) instead of full data to reduce storage overhead;

[0028] Context synchronization and conflict management: Real-time synchronization uses a publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues. Conflict resolution strategy prioritizes time, prioritizing the change to the latest timestamp, applicable to non-critical parameters. Manual arbitration freezes the context for critical data conflicts and notifies the user to intervene. Offline synchronization guarantees persistence of context checkpoints at regular intervals, automatically loading the most recent valid state when tasks resume, ensuring continuity in network outage scenarios.

[0029] Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native application operation instructions; reverse conversion: parsing application output and extracting key information to update context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met;

[0030] Security and permission control: Data security is enhanced with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring that only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

[0031] Furthermore, in the execution unit, the MCP operation intention is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of the corresponding applications. According to the operation commands of the applications, a tool chain composed of applications is dynamically scheduled based on the context state to ensure continuous execution of tasks. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool and the completed operations are skipped. Before executing key operations, a secondary confirmation process is triggered to verify the operation to prevent misoperation.

[0032] Furthermore, the operation of the tool chain composed of applications dynamically scheduled based on the context state according to the operation commands of the application is: all operation commands obtained by converting all task subgraphs based on task dependencies are sorted to obtain an operation command execution dependency graph, an application call sequence is generated based on the operation command execution dependency graph to obtain the tool chain of the application, the context state of the currently executed operation command is monitored, and if the context state satisfies the execution of the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.

[0033] Furthermore, after obtaining the operation command execution dependency graph, the cloud uses a first thread to send a first memory usage request to the local system, and the first memory size requested by the first memory usage request is determined based on the first operation command in the operation command execution dependency graph. The cloud uses a second thread to send a second memory usage request to the local system, and the second memory size requested by the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After monitoring that the first operation command is executed, the context state data executed in the first memory is sent to the cloud for storage, and at the same time, a third memory size is determined based on the third operation command in the operation command execution dependency graph. If the third memory size is less than the first memory size, The third memory size is less than or equal to the first memory size, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the third memory size is larger than the first memory size, the cloud uses a third thread to send a third memory usage request to the local system and reclaims the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, the third memory is applied for in the cloud, and an application image corresponding to the third operation command is constructed in the third memory of the cloud. The image is used to execute the third operation command until all operation commands in the operation command execution dependency graph are executed, wherein the operation command execution dependency graph has at least three operation commands.

[0034] Furthermore, a monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time and provide abnormal alarms and audit tracing.

[0035] The present invention further provides a computer-readable storage medium, wherein the storage medium stores computer program code, and when the computer program code is executed by a computer, any one of the above methods is executed.

[0036] The technical effect of the present invention is: a method, device and storage medium for collaborative execution of cross-environment AI tasks based on the MCP protocol of the present invention, encapsulation step S101, respectively encapsulating multiple different applications deployed on the local system into a unified interface API, each application corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations; context management step S102, constructing the MCP protocol in the cloud, and obtaining the current status of each application executing the task through the unified interface API based on the MCP protocol, and keeping the data between different applications consistent through the context of the current status; execution step S103, receiving an operation request input by a user in the cloud, converting the user's operation request into an MCP operation intent based on the MCP protocol, and converting the MCP operation intent into an operation command of at least one application, and transmitting the operation command to the corresponding application deployed on the local system through the unified interface API, the application performing the corresponding operation based on the operation command, and using the operation result to update the current status of the application. This invention establishes a two-way operation channel between cloud AI and local non-API software, breaks through the tool chain barriers, realizes the "availability but invisibility" of local sensitive data, ensures that only desensitized results are obtained on the cloud, dynamically coordinates local hardware resources with cloud computing power, builds a flexible hybrid computing architecture, and supports mechanisms such as network disconnection and operation verification, thereby improving the success rate of cross-environment tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Other features, objects and advantages of the present application will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings.

[0038] Figure 1 This is a flowchart of a method for collaborative execution of cross-environment AI tasks based on the MCP protocol according to an embodiment of the present invention.

[0039] Figure 2 This is a structural diagram of a cross-environment AI task collaborative execution device based on the MCP protocol according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.

[0041] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0042] Figure 1 The present invention shows a method for collaborative execution of cross-environment AI tasks based on the MCP protocol, which includes:

[0043] Encapsulation step S101: Encapsulate multiple different applications deployed on the local system into unified interface APIs, each application corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations;

[0044] In the context management step S102, the MCP protocol is constructed in the cloud, and the current status of each application's task execution is obtained through a unified interface API based on the MCP protocol. The data between different applications is kept consistent through the context of the current status.

[0045] Execute step S103 to receive an operation request input by the user in the cloud, convert the user's operation request into an MCP operation intent based on the MCP protocol, convert the MCP operation intent into an operation command for at least one application, and transmit the operation command to the corresponding application deployed on the local system through the unified interface API. The application performs a corresponding operation based on the operation command and uses the operation result to update the current state of the application.

[0046] For example, the user inputs an operation request of "Please obtain the employee's attendance record for March". Based on the MCP protocol, it can be converted into an MCP operation intention. For example, the operation intention is to check whether the user has the identity of an attendance administrator. If so, log in to the attendance system, DingTalk clock-in system, and other human resources systems to obtain the employee's attendance data for March. Finally, the local system commands that need to be called are generated, such as: web-based attendance data acquisition command, DingTalk application clock-in data acquisition command, Excel spreadsheet generation command, etc., thereby realizing the interaction between AI applications and local applications.

[0047] In the present invention, a plurality of different applications deployed on the local system are first encapsulated into unified interface APIs, each application corresponds to a unified interface API, the encapsulated unified interface API supports context-aware operations, an MCP protocol is constructed on the cloud, and the current status of each application executing a task is obtained through the unified interface API based on the MCP protocol. The data between different applications are kept consistent through the context of the current status, and finally an operation request input by the user is received on the cloud, the user's operation request is converted into an MCP operation intention based on the MCP protocol, and the MCP operation intention is converted into an operation command of at least one application, and the operation command is passed to the corresponding application deployed on the local system through the unified interface API, the application performs a corresponding operation based on the operation command, and uses the operation result to update the current status of the application, that is, the present invention realizes the interaction between AI applications and applications of traditional local systems based on the MCP protocol, and can be based on MCP,

[0048] The context of the protocol synchronizes data between multiple applications, that is, a hybrid control channel is constructed through the MCP protocol, a two-way operation path is established between cloud AI and local non-API software, breaking through the tool chain barriers and improving the efficiency of software operations. This is an important invention point of the present invention.

[0049] In one embodiment, the operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, data is obtained in real time and mapped to context fields through REST / GraphQL API docking services; for tool applications, the operating system hook function is used to monitor system-level events of local software, capture the operation status and maintain it, or identify interface elements through OCR, and dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between private system applications and the MCP protocol.

[0050] The present invention encapsulates heterogeneous tools (Web applications, local software, and proprietary systems) into a unified interface, supports context-aware operations, and thus can utilize the MCP protocol context for operations, thereby improving the intelligence level of local non-AI applications and thus improving application efficiency. This is another important inventive concept of the present invention.

[0051] In one embodiment, the operations for building the MCP protocol in the cloud include: defining a context data structure: an intent layer for defining task objectives and constraints; a data flow layer for recording data sources and output paths; a tool status layer for saving real-time snapshots of each application; a security policy layer for configuring access control rules, encryption algorithms, and desensitization policies; setting up a version control mechanism to generate a unique version identifier for each context change, storing incremental differences (Delta) rather than full data, to reduce storage overhead;

[0052] Context synchronization and conflict management: Real-time synchronization uses a publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues. Conflict resolution strategy prioritizes time, prioritizing the change to the latest timestamp, applicable to non-critical parameters. Manual arbitration freezes the context for critical data conflicts and notifies the user to intervene. Offline synchronization guarantees persistence of context checkpoints at regular intervals, automatically loading the most recent valid state when tasks resume, ensuring continuity in network outage scenarios.

[0053] Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native application operation instructions; reverse conversion: parsing application output and extracting key information to update context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met;

[0054] Security and permission control: Data security is enhanced with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring that only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

[0055] In the present invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly called by encapsulating a unified interface, and converted through MCP intents and native instructions of the application, so that the AI application converts the operation request input by the user into operation commands of one or more local non-AI applications, and calls the corresponding application based on certain rules, and finally obtains the operation result required by the user. In addition, the local software operation sequence is recorded through the CV+OS hook function to generate reusable script instructions, and the context binding triggers the execution of the script when the context conditions are met, thereby improving the efficiency and accuracy of the execution of the operation command, and can provide high-reliability execution guarantees, support disconnection and transmission, operation verification and other mechanisms, and improve the cross-environment task success rate to 99.9%. This is another important inventive concept of the present invention.

[0056] Furthermore, this invention utilizes a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, recording the timestamp, operator, and change details. This invention also supports version rollback, allowing for quick location of historical states using timelines or event tags (such as "task start" and "parameter update"). It also supports security audits, using persistence technology to record key operations (such as context deletion and permission changes), ensuring that logs cannot be tampered with and facilitating compliance reviews. These are key inventive concepts of this invention.

[0057] In one embodiment, in the execution step S103, the MCP operation intent is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of corresponding applications. According to the operation commands of the applications, a tool chain composed of applications is dynamically scheduled based on the context state to ensure continuous execution of tasks. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool and the completed operations are skipped. Before executing key operations, a secondary confirmation process is triggered to perform operation verification to prevent misoperation.

[0058] In one embodiment, the operation of the tool chain composed of applications dynamically scheduled based on the context state according to the operation commands of the application is: all operation commands obtained by converting all task subgraphs based on task dependencies are sorted to obtain an operation command execution dependency graph, an application call sequence is generated based on the operation command execution dependency graph to obtain the tool chain of the application, the context state of the currently executed operation command is monitored, and if the context state satisfies the execution of the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.

[0059] Another important inventive concept of the present invention is that, since the MCP operation intent may involve multiple applications, such as the example of "obtaining employee attendance records for March" mentioned above, in order to improve the execution efficiency of non-AI local applications, it is necessary to perform task dependency parsing and decompose the MCP operation intent into a task subgraph based on the MCP protocol in the cloud. Each node in the task subgraph corresponds to the operation of an application, and a tool chain of the application is generated based on the task subgraph, so that the application can be called in a chain to perform sequential processing of the operation commands, thereby improving processing efficiency. Moreover, through enhanced privacy protection, local sensitive data can be made "available but invisible", ensuring that only desensitized results are obtained in the cloud, such as only obtaining the user's attendance records from the human resources system, without obtaining other private data of the user in the human resources system. This is another important inventive point of the present invention.

[0060] In one embodiment, after obtaining the operation command execution dependency graph, the cloud uses a first thread to send a first memory usage request to the local system, and the first memory size requested by the first memory usage request is determined based on the first operation command in the operation command execution dependency graph. The cloud uses a second thread to send a second memory usage request to the local system, and the second memory size requested by the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After monitoring that the first operation command is executed, the context state data executed in the first memory is sent to the cloud for storage, and at the same time, a third memory size is determined based on the third operation command in the operation command execution dependency graph. If the The third memory size is less than or equal to the first memory size, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the third memory size is larger than the first memory size, the cloud uses a third thread to send a third memory usage request to the local system and reclaims the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, the third memory is applied for in the cloud, and an application image corresponding to the third operation command is constructed in the third memory of the cloud. The image is used to execute the third operation command until all operation commands in the operation command execution dependency graph are executed, wherein the operation command execution dependency graph has at least three operation commands.

[0061] In the present invention, since the user's operation request generally involves the operation of multiple non-AI local applications, the default number is generally more than three to meet a complex user's needs. Therefore, if a large number of non-local applications are called at the same time and all are processed locally, the performance of the local system will be greatly affected. The present invention creatively proposes that generally the first and second applications are executed locally, and if the memory of the third application does not meet the requirements, it is transferred to the cloud for execution. This requires loading the corresponding image in the cloud to perform the corresponding operation. Of course, it can also be executed in the cloud starting from the second operation command, but this will waste a lot of bandwidth (because the application image needs to be built). Based on the current situation, the performance of the local system is generally relatively high. Therefore, it is determined from the third operation command whether to transfer to the cloud for execution. This can avoid occupying a large amount of bandwidth and also avoid excessive impact on the performance of the local system, thereby realizing dynamic coordination of local hardware resources and cloud resources and building a flexible hybrid computing architecture. This is an important inventive concept of the present invention.

[0062] In one embodiment, a monitoring and auditing layer is set up in the cloud to monitor the status of local systems in real time, providing exception alerts and audit tracing. For example, resource utilization (such as GPU load and memory usage) is monitored through Prometheus, and visualization dashboards are generated in conjunction with Grafana. For example, exception handling includes automatic alerts: When an anomaly is detected (such as a tool response timeout), SMS / email notifications are triggered. Context snapshots are retained: A version of the context at the time of the anomaly is saved, supporting retrospective analysis after manual intervention.

[0063] Figure 2 The present invention shows a cross-environment AI task collaborative execution device based on the MCP protocol, which includes:

[0064] The encapsulation unit 201 encapsulates multiple different applications deployed on the local system into unified interface APIs, each application corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations;

[0065] The context management unit 202 constructs the MCP protocol in the cloud and obtains the current status of each application's task execution through a unified interface API based on the MCP protocol. The context of the current status is used to keep data consistent between different applications.

[0066] The execution unit 203 receives an operation request input by a user in the cloud, converts the user's operation request into an MCP operation intent based on the MCP protocol, converts the MCP operation intent into an operation command of at least one application, and transmits the operation command to the corresponding application deployed on the local system through a unified interface API. The application performs a corresponding operation based on the operation command and uses the operation result to update the current state of the application.

[0067] For example, the user inputs an operation request of "Please obtain the employee's attendance record for March". Based on the MCP protocol, it can be converted into an MCP operation intention. For example, the operation intention is to check whether the user has the identity of an attendance administrator. If so, log in to the attendance system, DingTalk clock-in system, and other human resources systems to obtain the employee's attendance data for March. Finally, the local system commands that need to be called are generated, such as: web-based attendance data acquisition command, DingTalk application clock-in data acquisition command, Excel spreadsheet generation command, etc., thereby realizing the interaction between AI applications and local applications.

[0068] In the present invention, a plurality of different applications deployed on the local system are first encapsulated into unified interface APIs, each application corresponds to a unified interface API, the encapsulated unified interface API supports context-aware operations, an MCP protocol is constructed on the cloud, and the current status of each application executing a task is obtained through the unified interface API based on the MCP protocol. The data between different applications are kept consistent through the context of the current status, and finally an operation request input by the user is received on the cloud, the user's operation request is converted into an MCP operation intention based on the MCP protocol, and the MCP operation intention is converted into an operation command of at least one application, and the operation command is passed to the corresponding application deployed on the local system through the unified interface API, the application performs a corresponding operation based on the operation command, and uses the operation result to update the current status of the application, that is, the present invention realizes the interaction between AI applications and applications of traditional local systems based on the MCP protocol, and can be based on MCP,

[0069] The context of the protocol synchronizes data between multiple applications, that is, a hybrid control channel is constructed through the MCP protocol, a two-way operation path is established between cloud AI and local non-API software, breaking through the tool chain barriers and improving the efficiency of software operations. This is an important invention point of the present invention.

[0070] In one embodiment, the operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, data is obtained in real time and mapped to context fields through REST / GraphQL API docking services; for tool applications, the operating system hook function is used to monitor system-level events of local software, capture the operation status and maintain it, or identify interface elements through OCR, and dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between private system applications and the MCP protocol.

[0071] The present invention encapsulates heterogeneous tools (Web applications, local software, and proprietary systems) into a unified interface, supports context-aware operations, and thus can utilize the MCP protocol context for operations, thereby improving the intelligence level of local non-AI applications and thus improving application efficiency. This is another important inventive concept of the present invention.

[0072] In one embodiment, the operations for building the MCP protocol in the cloud include: defining a context data structure: an intent layer for defining task objectives and constraints; a data flow layer for recording data sources and output paths; a tool status layer for saving real-time snapshots of each application; a security policy layer for configuring access control rules, encryption algorithms, and desensitization policies; setting up a version control mechanism to generate a unique version identifier for each context change, storing incremental differences (Delta) rather than full data, to reduce storage overhead;

[0073] Context synchronization and conflict management: Real-time synchronization uses a publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues. Conflict resolution strategy prioritizes time, prioritizing the change to the latest timestamp, applicable to non-critical parameters. Manual arbitration freezes the context for critical data conflicts and notifies the user to intervene. Offline synchronization guarantees persistence of context checkpoints at regular intervals, automatically loading the most recent valid state when tasks resume, ensuring continuity in network outage scenarios.

[0074] Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native application operation instructions; reverse conversion: parsing application output and extracting key information to update context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met;

[0075] Security and permission control: Data security is enhanced with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring that only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

[0076] In the present invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly called by encapsulating a unified interface, and converted with the native instructions of the application through MCP intent, so that the AI application can convert the operation request input by the user into operation commands of one or more local non-AI applications, and call the corresponding application based on certain rules, and finally obtain the operation result required by the user. In addition, the local software operation sequence is recorded through the CV+OS hook function to generate reusable script instructions, and the context binding triggers the execution of the script when the context conditions are met, thereby improving the efficiency and accuracy of the execution of the operation command. This is another important inventive concept of the present invention.

[0077] Furthermore, this invention utilizes a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, recording the timestamp, operator, and change details. This invention also supports version rollback, allowing for quick location of historical states using timelines or event tags (such as "task start" and "parameter update"). It also supports security audits, using persistence technology to record key operations (such as context deletion and permission changes), ensuring that logs cannot be tampered with and facilitating compliance reviews. These are key inventive concepts of this invention.

[0078] In one embodiment, the execution unit 203 performs task dependency parsing on the MCP operation intent and decomposes it into task subgraphs. The task subgraphs are then converted into operation commands for corresponding applications. A tool chain consisting of applications is dynamically scheduled based on the context state according to the application operation commands to ensure continuous task execution. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool and completed operations are skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation to prevent misoperation.

[0079] In one embodiment, the operation of the tool chain composed of applications dynamically scheduled based on the context state according to the operation commands of the application is: all operation commands obtained by converting all task subgraphs based on task dependencies are sorted to obtain an operation command execution dependency graph, an application call sequence is generated based on the operation command execution dependency graph to obtain the tool chain of the application, the context state of the currently executed operation command is monitored, and if the context state satisfies the execution of the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.

[0080] Another important inventive concept of the present invention is that, since the MCP operation intent may involve multiple applications, such as the example of "obtaining employee attendance records for March" mentioned above, in order to improve the execution efficiency of non-AI local applications, it is necessary to perform task dependency parsing and decompose the MCP operation intent into a task subgraph based on the MCP protocol in the cloud. Each node in the task subgraph corresponds to the operation of an application, and a tool chain of the application is generated based on the task subgraph, so that the application can be called in a chain to perform sequential processing of the operation commands, thereby improving processing efficiency. Moreover, through enhanced privacy protection, local sensitive data can be made "available but invisible", ensuring that only desensitized results are obtained in the cloud, such as only obtaining the user's attendance records from the human resources system, without obtaining other private data of the user in the human resources system. This is another important inventive point of the present invention.

[0081] In one embodiment, after obtaining the operation command execution dependency graph, the cloud uses a first thread to send a first memory usage request to the local system, and the first memory size requested by the first memory usage request is determined based on the first operation command in the operation command execution dependency graph. The cloud uses a second thread to send a second memory usage request to the local system, and the second memory size requested by the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After monitoring that the first operation command is executed, the context state data executed in the first memory is sent to the cloud for storage, and at the same time, a third memory size is determined based on the third operation command in the operation command execution dependency graph. If the The third memory size is less than or equal to the first memory size, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the third memory size is larger than the first memory size, the cloud uses a third thread to send a third memory usage request to the local system and reclaims the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, the third memory is applied for in the cloud, and an application image corresponding to the third operation command is constructed in the third memory of the cloud. The image is used to execute the third operation command until all operation commands in the operation command execution dependency graph are executed, wherein the operation command execution dependency graph has at least three operation commands.

[0082] In the present invention, since the user's operation request generally involves the operation of multiple non-AI local applications, the default number is generally more than three to meet a complex user's needs. Therefore, if a large number of non-local applications are called at the same time and all are processed locally, the performance of the local system will be greatly affected. The present invention creatively proposes that generally the first and second applications are executed locally, and if the memory of the third application does not meet the requirements, it is transferred to the cloud for execution. This requires loading the corresponding image in the cloud to perform the corresponding operation. Of course, it can also be executed in the cloud starting from the second operation command, but this will waste a lot of bandwidth (because the application image needs to be built). Based on the current situation, the performance of the local system is generally relatively high. Therefore, it is determined from the third operation command whether to transfer to the cloud for execution. This can avoid occupying a large amount of bandwidth and also avoid excessive impact on the performance of the local system, thereby realizing dynamic coordination of local hardware resources and cloud resources and building a flexible hybrid computing architecture. This is an important inventive concept of the present invention.

[0083] In one embodiment of the present invention, a computer storage medium is provided, on which a computer program is stored. When the computer program on the computer storage medium is executed by a processor, the above-mentioned method is implemented. The computer storage medium can be a hard disk, DVD, CD, flash memory or other memory.

[0084] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0085] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the devices described in various embodiments of the present application or certain parts of the embodiments.

[0086] Finally, it should be noted that the above embodiments are only intended to illustrate rather than limit the technical solutions of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the present invention can still be modified or replaced by equivalents. Any modification or partial replacement that does not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A cross-environment AI task collaborative execution method based on the MCP protocol, characterized in that: The method includes: The encapsulation step encapsulates multiple different applications deployed on the local system into unified interface APIs. Each application corresponds to a unified interface API. The encapsulated unified interface API supports context-aware operations. In the context management step, the MCP protocol is built in the cloud. Based on the MCP protocol, the current status of each application's execution task is obtained through a unified interface API. The context of the current status is used to ensure consistency of data between different applications. An execution step includes receiving an operation request input by a user in the cloud, converting the user's operation request into an MCP operation intent based on the MCP protocol, converting the MCP operation intent into an operation command of at least one application, and transmitting the operation command to a corresponding application deployed on the local system through a unified interface API. The application performs a corresponding operation based on the operation command and uses the operation result to update the current state of the application; In the execution step, the MCP operation intent is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of the corresponding applications. The tool chain composed of applications is dynamically scheduled based on the context state according to the operation commands of the applications to ensure continuous execution of tasks. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool, and the completed operations are skipped. Before executing key operations, a secondary confirmation process is triggered to perform operation verification to prevent misoperation. Among them, the operation of the tool chain composed of dynamically scheduling applications based on the context state according to the application's operation command is: sorting all operation commands obtained by converting all task subgraphs based on task dependencies to obtain an operation command execution dependency graph, generating an application call sequence based on the operation command execution dependency graph to obtain the application's tool chain, monitoring the context state of the currently executed operation command, and if the context state satisfies the execution of the next operation command, calling the application corresponding to the next operation command in the tool chain until all operation commands are executed.

2. The method according to claim 1, wherein The operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, connecting to services through REST / GraphQL APIs, obtaining data in real time and mapping it to context fields; for tool applications, using operating system hook functions to monitor system-level events of local software, capturing operation status and maintaining it, or identifying interface elements through OCR, and dynamically updating the tool_state field in the context; for local private system applications, using SDK and middleware to achieve context synchronization between private system applications and the MCP protocol.

3. The method according to claim 2, characterized in that The operations for constructing the MCP protocol in the cloud are: Define the context data structure: the intent layer, which is used to define task goals and constraints; the data flow layer, which is used to record data sources and output paths; The tool state layer is used to save real-time snapshots of each application; Security policy layer, used to configure access control rules, encryption algorithms, and desensitization policies; Set up a version control mechanism to generate a unique version identifier for each context change, storing incremental differences (Delta) rather than full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using the publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues; Conflict resolution strategy: Time priority, based on the change of the latest timestamp, applicable to non-critical parameters; Manual arbitration freezes the context and notifies the user to intervene in case of key data conflicts. Offline synchronization guarantees persistence of context checkpoints at regular intervals. When tasks are resumed, the most recent valid state is automatically loaded to ensure continuity in network outage scenarios. Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native instructions for application operation commands; reverse conversion: parsing application output and extracting key information to update the context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met; Security and permission control: Data security is enhanced, with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

4. The method according to claim 3, characterized in that A monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time and provide abnormal alarms and audit tracing.

5. A cross-environment AI task collaborative execution device based on the MCP protocol, characterized in that: The device includes: The encapsulation unit encapsulates multiple different applications deployed on the local system into unified interface APIs. Each application corresponds to a unified interface API. The encapsulated unified interface API supports context-aware operations. The context management unit builds the MCP protocol in the cloud and obtains the current status of each application's execution task through a unified interface API based on the MCP protocol. The context of the current status ensures that the data between different applications remains consistent. An execution unit receives an operation request input by a user in the cloud, converts the user's operation request into an MCP operation intent based on the MCP protocol, converts the MCP operation intent into an operation command of at least one application, and transmits the operation command to a corresponding application deployed on the local system through a unified interface API. The application executes a corresponding operation based on the operation command and uses the operation result to update the current state of the application; In the execution unit, the MCP operation intention is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of the corresponding applications. The tool chain composed of applications is dynamically scheduled based on the context state according to the operation commands of the applications to ensure continuous execution of tasks. If the network is interrupted during execution, the most recent context checkpoint is loaded from the session pool, and the completed operations are skipped. Before executing key operations, a secondary confirmation process is triggered to perform operation verification to prevent misoperation. Among them, the operation of the tool chain composed of dynamically scheduling applications based on the context state according to the application's operation command is: sorting all operation commands obtained by converting all task subgraphs based on task dependencies to obtain an operation command execution dependency graph, generating an application call sequence based on the operation command execution dependency graph to obtain the application's tool chain, monitoring the context state of the currently executed operation command, and if the context state satisfies the execution of the next operation command, calling the application corresponding to the next operation command in the tool chain until all operation commands are executed.

6. The device according to claim 5, characterized in that The operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, connecting to services through REST / GraphQL APIs, obtaining data in real time and mapping it to context fields; for tool applications, using operating system hook functions to monitor system-level events of local software, capturing operation status and maintaining it, or identifying interface elements through OCR, and dynamically updating the tool_state field in the context; for local private system applications, using SDK and middleware to achieve context synchronization between private system applications and the MCP protocol.

7. The device according to claim 6, characterized in that The operations for constructing the MCP protocol in the cloud are: Define the context data structure: the intent layer, which is used to define task goals and constraints; the data flow layer, which is used to record data sources and output paths; The tool state layer is used to save real-time snapshots of each application; Security policy layer, used to configure access control rules, encryption algorithms, and desensitization policies; Set up a version control mechanism to generate a unique version identifier for each context change, storing incremental differences (Delta) rather than full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using the publish-subscribe model to broadcast context change events, and associated applications receive updates through message queues; Conflict resolution strategy: Time priority, based on the change of the latest timestamp, applicable to non-critical parameters; Manual arbitration freezes the context and notifies the user to intervene in case of key data conflicts. Offline synchronization guarantees persistence of context checkpoints at regular intervals. When tasks are resumed, the most recent valid state is automatically loaded to ensure continuity in network outage scenarios. Toolchain adaptation and execution optimization: Forward conversion: converting structured intent in MCP into native instructions for application operation commands; reverse conversion: parsing application output and extracting key information to update the context; atomic operation encapsulation: recording local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding: triggering script execution when context conditions are met; Security and permission control: Data security is enhanced, with support for separate encryption of sensitive fields. Keys are managed by a hardware security module (HSM), ensuring only ciphertext is processed in the cloud. Dynamic desensitization is implemented, and differentiated data is returned based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions each time an application accesses a context.

8. A computer storage medium, characterized in that The computer storage medium stores a computer program, and when the computer program on the computer storage medium is executed by a processor, the method according to any one of claims 1 to 4 is implemented.