Method and apparatus for collaborative execution of cross-environment ai tasks based on MCP protocol, and storage medium
By encapsulating local applications into a unified API through the MCP protocol, managing the context, and co-executing them in the cloud, the problem of cloud AI being unable to operate local software is solved, enabling efficient and secure cross-environment task co-execution.
Patent Information
- Application Number
- PCT/CN2026/097732
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-21
- Filing Date
- 2026-05-19
- Publication Date
- 2026-11-26
AI Technical Summary
In existing technologies, cloud-based AI cannot effectively operate local professional software, cross-environment collaboration is inefficient, data interaction requires manual transfer, network fluctuations cause task interruptions, there is a lack of offline resume mechanisms, and there are high security and privacy risks.
It uses the MCP protocol to encapsulate local applications into a unified interface API, manages the context in the cloud through the MCP protocol, enables collaborative execution of AI tasks across environments, supports data consistency, security policies and offline synchronization, dynamically schedules toolchains, and ensures data anonymization and access control.
It enables bidirectional operation between cloud-based AI and local non-API software, breaks through toolchain barriers, improves the success rate of cross-environment tasks, ensures data security, dynamically coordinates hardware resources, and supports resume downloading and operation verification after network outages.
Smart Images

Figure CN2026097732_26112026_PF_FP_ABST
Abstract
Description
A method, apparatus, and storage medium for cross-environment AI task collaborative execution based on the MCP protocol. Technical Field
[0001] This invention relates to the field of artificial intelligence and distributed processing fusion technology, specifically to a cross-environment AI task collaborative execution method, apparatus and storage medium based on the MCP protocol. Background Technology
[0002] Enterprises currently face the following technical obstacles in their intelligent transformation due to fragmented toolchains: Tool operation barriers: Cloud-based AI can only operate web applications with open APIs (such as Salesforce and Google Workspace), and cannot control local professional software (such as the Adobe suite and EDA tools), leading to breakpoints in automated processes. Industry research shows that 38% of operations in enterprise-critical business 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 capabilities with cloud-based AI and unable to dynamically respond to changing needs.
[0003] Cross-environment collaboration is inefficient: Data interaction between web and local tools requires manual intervention (e.g., downloading cloud data → local processing → re-uploading), increasing average processing time by 57% (Gartner data). When network fluctuations cause task interruptions, there is a lack of offline resume mechanisms, making task restarts costly.
[0004] Security and privacy risks: The risk of sensitive data being easily leaked. Summary of the Invention
[0005] In view of one or more technical defects in the prior art, the present invention proposes the following technical solution.
[0006] A cross-environment AI task collaborative execution method based on the MCP protocol (Model Context Protocol) includes: an encapsulation step, in which multiple different applications deployed on a local system are encapsulated into a unified interface API, with each application corresponding to a unified interface API, and the encapsulated unified interface API supports context-aware operations; a context management step, in which the MCP protocol is built in the cloud, and the current state of each application's task execution is obtained through the unified interface API based on the MCP protocol, and the data between different applications is kept consistent through the context of the current state; and an execution step, in which the user's operation request is received in the cloud, the user's operation request is converted into an MCP operation intent based on the MCP protocol, the MCP operation intent is converted into an operation command for at least one application, and the operation command is transmitted to the corresponding application deployed on the local system through the unified interface API, the application performs the corresponding operation based on the operation command, and updates the current state of the application with the operation result.
[0007] Furthermore, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of the local software, capture and maintain the operation state, or interface elements are identified through OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
[0008] Furthermore, the operation of building the MCP protocol in the cloud is as follows: Define the context data structure: Intent layer, used to define task goals and constraints; Data flow layer, used to record data sources and output paths; Tool state layer, used to save real-time snapshots of each application; Security policy layer, used to configure access control rules, encryption algorithms, and de-identification strategies; Set up a version control mechanism, generating a unique version identifier for each context change, storing incremental differences (Delta) instead of full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates through a message queue; Conflict resolution strategy: Time priority, using the latest timestamp change as the standard, applicable to non-critical parameters; Manual arbitration, for critical data conflicts, freezing the context and notifying the user to intervene; Offline synchronization guarantee, persisting context checkpoints at certain intervals, automatically loading the most recent valid state when the task resumes, ensuring continuity in offline scenarios; Toolchain Adaptation and Execution Optimization: Forward transformation converts structured intents in MCP into native operation commands for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script commands; context binding triggers script execution when context conditions are met; Security and Access Control: Enhanced data security supports individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud; dynamic desensitization returns differentiated data based on user roles; zero-trust access management supports verification of digital certificates and role permissions each time an application accesses the context.
[0009] 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. Based on the operation commands of the applications, the toolchain composed of applications is dynamically scheduled according to 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 critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
[0010] Furthermore, the operation of dynamically scheduling the toolchain composed of applications based on the context state according to the application's operation commands is as follows: sort all operation commands obtained by transforming all task subgraphs based on task dependencies to obtain an operation command execution dependency graph; generate an application call sequence based on the operation command execution dependency graph to obtain the application's toolchain; monitor the context state of the currently executed operation command; if the context state satisfies the execution of the next operation command, call the application corresponding to the next operation instruction in the toolchain until all operation commands are executed.
[0011] 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. The first memory size requested in 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. The second memory size requested in the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After detecting that the first operation command has been executed, the execution context state data in the first memory is sent to the cloud for storage. 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 first... If the size of the third memory is less than or equal to the size of the first memory, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the size of the third memory is greater than the size of the first memory, the cloud uses a third thread to send a third memory usage request to the local system and reclaim the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, third memory is requested in the cloud, and the application image corresponding to the third operation command is built in the third memory in the cloud. The third operation command is executed using the image until all operation commands in the operation command execution dependency graph are executed. The operation command execution dependency graph contains at least three operation commands.
[0012] Furthermore, a monitoring and auditing layer can be set up in the cloud to monitor the status of the local system in real time, providing anomaly alerts and audit traceability.
[0013] This invention also proposes a cross-environment AI task collaborative execution device based on the MCP protocol. The device includes: an encapsulation unit, which encapsulates multiple different applications deployed on a local system into a unified interface API, with each application corresponding to one unified interface API, and the encapsulated unified interface API supports context-aware operations; a context management unit, which constructs the MCP protocol in the cloud and obtains the current state of each application's task execution through the unified interface API based on the MCP protocol, ensuring data consistency between different applications through the context of the current state; and an execution unit, which receives user input operation requests in the cloud, converts the user's operation requests into MCP operation intentions based on the MCP protocol, converts the MCP operation intentions into operation commands for at least one application, and transmits the operation commands to the corresponding application deployed on the local system through the unified interface API. The application performs the corresponding operation based on the operation command and updates the current state of the application using the operation result.
[0014] Furthermore, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of the local software, capture and maintain the operation state, or interface elements are identified through OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
[0015] Furthermore, the operation of building the MCP protocol in the cloud is as follows: Define the context data structure: Intent layer, used to define task goals and constraints; Data flow layer, used to record data sources and output paths; Tool state layer, used to save real-time snapshots of each application; Security policy layer, used to configure access control rules, encryption algorithms, and de-identification strategies; Set up a version control mechanism, generating a unique version identifier for each context change, storing incremental differences (Delta) instead of full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates through a message queue; Conflict resolution strategy: Time priority, using the latest timestamp change as the standard, applicable to non-critical parameters; Manual arbitration, for critical data conflicts, freezing the context and notifying the user to intervene; Offline synchronization guarantee, persisting context checkpoints at certain intervals, automatically loading the most recent valid state when the task resumes, ensuring continuity in offline scenarios; Toolchain Adaptation and Execution Optimization: Forward transformation converts structured intents in MCP into native operation commands for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script commands; context binding triggers script execution when context conditions are met; Security and Access Control: Enhanced data security supports individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud; dynamic desensitization returns differentiated data based on user roles; zero-trust access management supports verification of digital certificates and role permissions each time an application accesses the context.
[0016] Furthermore, in the execution unit, 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 application. Based on the operation commands of the application, the toolchain composed of the application is dynamically scheduled according to 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 operation is skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
[0017] Furthermore, the operation of dynamically scheduling the toolchain composed of applications based on the context state according to the application's operation commands is as follows: sort all operation commands obtained by transforming all task subgraphs based on task dependencies to obtain an operation command execution dependency graph; generate an application call sequence based on the operation command execution dependency graph to obtain the application's toolchain; monitor the context state of the currently executed operation command; if the context state satisfies the execution of the next operation command, call the application corresponding to the next operation instruction in the toolchain until all operation commands are executed.
[0018] 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. The first memory size requested in 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. The second memory size requested in the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After detecting that the first operation command has been executed, the execution context state data in the first memory is sent to the cloud for storage. 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 first... If the size of the third memory is less than or equal to the size of the first memory, the context state data in the first memory is deleted, and the third operation command is executed in the first memory. If the size of the third memory is greater than the size of the first memory, the cloud uses a third thread to send a third memory usage request to the local system and reclaim the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, third memory is requested in the cloud, and the application image corresponding to the third operation command is built in the third memory in the cloud. The third operation command is executed using the image until all operation commands in the operation command execution dependency graph are executed. The operation command execution dependency graph contains at least three operation commands.
[0019] Furthermore, a monitoring and auditing layer can be set up in the cloud to monitor the status of the local system in real time, providing anomaly alerts and audit traceability.
[0020] The present invention also proposes a computer-readable storage medium storing computer program code, which, when executed by a computer, performs any of the methods described above.
[0021] The technical advantages of this invention are as follows: This invention provides a cross-environment AI task collaborative execution method, apparatus, and storage medium based on the MCP protocol. The encapsulation step S101 encapsulates multiple different applications deployed on the local system into a unified interface API, with each application corresponding to one unified interface API. The encapsulated unified interface API supports context-aware operations. The context management step S102 constructs the MCP protocol in the cloud and obtains the current state of each application's task execution through the unified interface API based on the MCP protocol, ensuring data consistency between different applications through the context of the current state. The execution step S103 receives user input operation requests in the cloud, converts the user's operation requests into MCP operation intentions based on the MCP protocol, converts the MCP operation intentions into operation commands for at least one application, and transmits the operation commands to the corresponding application deployed on the local system through the unified interface API. The application executes the corresponding operation based on the operation command and updates the application's current state using the operation result. This invention establishes a two-way operation path between cloud AI and local non-API software, breaks through toolchain barriers, realizes "usable but invisible" local sensitive data, ensures that the cloud only obtains the de-identified results, dynamically coordinates local hardware resources and cloud computing power, builds an elastic hybrid computing architecture, and supports mechanisms such as network interruption resume and operation verification, thereby improving the success rate of cross-environment tasks. Attached Figure Description
[0022] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0023] Figure 1 is a flowchart of a cross-environment AI task collaborative execution method based on the MCP protocol according to an embodiment of the present invention.
[0024] Figure 2 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 Implementation
[0025] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0026] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0027] Figure 1 illustrates a cross-environment AI task collaborative execution method based on the MCP protocol according to the present invention. The method includes: an encapsulation step S101, encapsulating multiple different applications deployed on the local system into a unified interface API, with each application corresponding to one unified interface API, and the encapsulated unified interface API supporting context-aware operations; a context management step S102, constructing the MCP protocol in the cloud, and obtaining the current state of each application's task execution through the unified interface API based on the MCP protocol, and ensuring data consistency between different applications through the context of the current state; and an execution step S103, receiving user input operation requests in the cloud, converting the user's operation requests into MCP operation intentions based on the MCP protocol, converting the MCP operation intentions into operation commands for at least one application, and transmitting the operation commands 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 updating the current state of the application using the operation result.
[0028] For example, if a user inputs an operation request like "Please retrieve the employee's attendance records for March," it can be converted into an MCP operation intent based on the MCP protocol. For instance, the operation intent might be to check if the user has the identity of an attendance administrator. If so, log in to the attendance system, DingTalk check-in system, or other HR systems to retrieve the employee's attendance data for March. Finally, it generates the necessary local system commands, such as web-based attendance data retrieval commands, DingTalk app check-in data retrieval commands, Excel spreadsheet generation commands, etc., thereby enabling interaction between the AI application and the local application.
[0029] In this invention, multiple different applications deployed on the local system are first encapsulated into a unified interface API, with each application corresponding to a unified interface API. The encapsulated unified interface API supports context-aware operations. An MCP protocol is built in the cloud, and the current state of each application's task execution is obtained through the unified interface API based on the MCP protocol. The context of the current state ensures data consistency between different applications. Finally, user input operation requests are received in the cloud, and the user's operation requests are converted into MCP operation intentions based on the MCP protocol. The MCP operation intentions are then converted into operation commands for at least one application, and the operation commands are transmitted to the corresponding application deployed on the local system through the unified interface API. The application executes the corresponding operation based on the operation command and updates the current state of the application using the operation result. That is, this invention realizes the interaction between AI applications and traditional local system applications based on the MCP protocol, and can synchronize data between multiple applications based on the context of the MCP protocol. In other words, a hybrid control channel is built through the MCP protocol, establishing a bidirectional operation path between cloud AI and local non-API software, breaking through toolchain barriers, and improving the efficiency of software operation. This is an important inventive point of this invention.
[0030] In one embodiment, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of the local software, capture and maintain the operation state, or interface elements are identified via OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
[0031] In this invention, heterogeneous tools (web applications, local software, private systems) are encapsulated into a unified interface, supporting context-aware operations. This allows for operations to be performed using the MCP protocol context, improving the intelligence level of local non-AI applications and thus increasing application efficiency. This is another important inventive concept of this invention.
[0032] In one embodiment, the operation of building the MCP protocol in the cloud includes: defining the 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 state layer for saving real-time snapshots of each application; a security policy layer for configuring access control rules, encryption algorithms, and de-identification strategies; setting up a version control mechanism, generating a unique version identifier for each context change, storing incremental differences (Delta) instead of full data to reduce storage overhead; context synchronization and conflict management: real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates through a message queue; conflict resolution strategies: time-sequence priority, using the latest timestamp change as the standard, applicable to non-critical parameters; manual arbitration, freezing the context and notifying the user to intervene in critical data conflicts; offline synchronization guarantee, persisting context checkpoints at regular intervals, automatically loading the most recent valid state when the task resumes, ensuring continuity in offline scenarios; Toolchain Adaptation and Execution Optimization: Forward transformation converts structured intents in MCP into native operation commands for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script commands; context binding triggers script execution when context conditions are met; Security and Access Control: Enhanced data security supports individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud; dynamic desensitization returns differentiated data based on user roles; zero-trust access management supports verification of digital certificates and role permissions each time an application accesses the context.
[0033] In this invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly invoked through a unified interface. By converting MCP intents into native instructions of the application, AI applications can transform user-input operation requests into operation commands for one or more local non-AI applications. Based on certain rules, the corresponding applications are invoked to obtain the user's desired operation result. Furthermore, by recording local software operation sequences through CV+OS hook functions, reusable script instructions are generated, and context binding ensures that script execution is triggered when context conditions are met. This improves the efficiency and accuracy of operation command execution and provides highly reliable execution guarantees, supporting mechanisms such as network interruption resumption and operation verification. This increases the success rate of cross-environment tasks to 99.9%, which is another important inventive concept of this invention.
[0034] Furthermore, in terms of data storage, this invention employs a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, recording the timestamp, operator, and changed content. This invention also supports version backtracking, allowing for quick location of historical states via a timeline or event tags (such as "task started" or "parameter update"). It also supports security auditing by persistently recording critical operations (such as context deletion and permission changes) to ensure log immutability and facilitate compliance review. These are all key inventive concepts of this invention.
[0035] 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 the corresponding application. The toolchain composed of the application is dynamically scheduled based on the context state according to the operation commands of the application to ensure continuous execution of tasks. If the network is interrupted during the execution process, the most recent context checkpoint is loaded from the session pool and the completed operation is skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
[0036] In one embodiment, the operation of dynamically scheduling the toolchain composed of applications based on the context state according to the application's operation commands is as follows: sorting all operation commands obtained by transforming 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 toolchain; 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 instruction in the toolchain until all operation commands are executed.
[0037] Another important inventive concept of this invention is that, since MCP operation intentions may involve multiple applications, such as the previously mentioned example of 'retrieving employee attendance records for March', in order to improve the execution efficiency of non-AI local applications, it is necessary to decompose the MCP operation intention into task subgraphs in the cloud based on the MCP protocol. Each node in the task subgraph corresponds to an operation of an application, and a toolchain of applications is generated based on the task subgraph. This allows for chained invocation of applications to process operation commands sequentially, improving processing efficiency. Furthermore, through enhanced privacy protection, sensitive local data is made "usable but not visible," ensuring that the cloud only obtains anonymized results, such as only retrieving user attendance records from the human resources system, without retrieving other private data of users in the human resources system. This is another important inventive point of this invention.
[0038] 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. The first memory size requested in 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. The second memory size requested in the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After detecting that the first operation command has been executed, the execution context state data in the first memory is sent to the cloud for storage. 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... If 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 greater 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, third memory is requested in the cloud, and the application image corresponding to the third operation command is built in the third memory in the cloud. The third operation command is executed using this image until all operation commands in the operation command execution dependency graph are executed. The operation command execution dependency graph contains at least three operation commands.
[0039] In this invention, since user operation requests typically involve multiple non-AI local applications (usually three or more by default) to meet a complex user need, simultaneously calling numerous non-local applications would significantly impact local system performance if all processing were done locally. This invention creatively proposes that the first and second applications are generally executed locally, while the third application, if memory is insufficient, is moved to the cloud for execution. This requires loading the appropriate image in the cloud to execute the corresponding operations. Alternatively, execution could begin in the cloud from the second operation command onwards, but this would waste significant bandwidth (due to the need to build application images). Given that local system performance is generally quite high, the decision to move to the cloud is made only from the third operation command. This avoids excessive bandwidth consumption and minimizes the impact on local system performance, thereby achieving dynamic coordination of local hardware resources and cloud resources to build a flexible hybrid computing architecture. This is a key inventive concept of this invention.
[0040] In one embodiment, a monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time, providing anomaly alerts and audit traceability. For example, Prometheus can be used to monitor resource utilization (such as GPU load and memory usage), and Grafana can be used to generate visualization dashboards. Anomaly handling includes: automatic alerts: triggering SMS / email notifications when an anomaly is detected (such as tool response timeouts). Context snapshot retention: saving the context version at the time of the anomaly, supporting retrospective analysis after manual intervention.
[0041] Figure 2 illustrates a cross-environment AI task collaborative execution device based on the MCP protocol according to the present invention. The device includes: an encapsulation unit 201, which encapsulates multiple different applications deployed on the local system into a unified interface API, with each application corresponding to one unified interface API, and the encapsulated unified interface API supports context-aware operations; a context management unit 202, which constructs the MCP protocol in the cloud and obtains the current state of each application's task execution through the unified interface API based on the MCP protocol, and ensures data consistency between different applications through the context of the current state; and an execution unit 203, which receives user input operation requests in the cloud, converts the user's operation requests into MCP operation intentions based on the MCP protocol, converts the MCP operation intentions into operation commands for at least one application, and transmits the operation commands to the corresponding application deployed on the local system through the unified interface API. The application performs the corresponding operation based on the operation command and updates the current state of the application using the operation result.
[0042] For example, if a user inputs an operation request like "Please retrieve the employee's attendance records for March," it can be converted into an MCP operation intent based on the MCP protocol. For instance, the operation intent might be to check if the user has the identity of an attendance administrator. If so, log in to the attendance system, DingTalk check-in system, or other HR systems to retrieve the employee's attendance data for March. Finally, it generates the necessary local system commands, such as web-based attendance data retrieval commands, DingTalk app check-in data retrieval commands, Excel spreadsheet generation commands, etc., thereby enabling interaction between the AI application and the local application.
[0043] In this invention, multiple different applications deployed on the local system are first encapsulated into a unified interface API, with each application corresponding to a unified interface API. The encapsulated unified interface API supports context-aware operations. An MCP protocol is built in the cloud, and the current state of each application's task execution is obtained through the unified interface API based on the MCP protocol. The context of the current state ensures data consistency between different applications. Finally, user input operation requests are received in the cloud, and the user's operation requests are converted into MCP operation intentions based on the MCP protocol. The MCP operation intentions are then converted into operation commands for at least one application, and the operation commands are transmitted to the corresponding application deployed on the local system through the unified interface API. The application executes the corresponding operation based on the operation command and updates the current state of the application using the operation result. That is, this invention realizes the interaction between AI applications and traditional local system applications based on the MCP protocol, and can synchronize data between multiple applications based on the context of the MCP protocol. In other words, a hybrid control channel is built through the MCP protocol, establishing a bidirectional operation path between cloud AI and local non-API software, breaking through toolchain barriers, and improving the efficiency of software operation. This is an important inventive point of this invention.
[0044] In one embodiment, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of the local software, capture and maintain the operation state, or interface elements are identified via OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
[0045] In this invention, heterogeneous tools (web applications, local software, private systems) are encapsulated into a unified interface, supporting context-aware operations. This allows for operations to be performed using the MCP protocol context, improving the intelligence level of local non-AI applications and thus increasing application efficiency. This is another important inventive concept of this invention.
[0046] In one embodiment, the operation of building the MCP protocol in the cloud includes: defining the 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 state layer for saving real-time snapshots of each application; a security policy layer for configuring access control rules, encryption algorithms, and de-identification strategies; setting up a version control mechanism, generating a unique version identifier for each context change, storing incremental differences (Delta) instead of full data to reduce storage overhead; context synchronization and conflict management: real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates through a message queue; conflict resolution strategies: time-sequence priority, using the latest timestamp change as the standard, applicable to non-critical parameters; manual arbitration, freezing the context and notifying the user to intervene in critical data conflicts; offline synchronization guarantee, persisting context checkpoints at regular intervals, automatically loading the most recent valid state when the task resumes, ensuring continuity in offline scenarios; Toolchain Adaptation and Execution Optimization: Forward transformation converts structured intents in MCP into native operation commands for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script commands; context binding triggers script execution when context conditions are met; Security and Access Control: Enhanced data security supports individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud; dynamic desensitization returns differentiated data based on user roles; zero-trust access management supports verification of digital certificates and role permissions each time an application accesses the context.
[0047] In this invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly invoked through a unified interface. By converting MCP intents with the native instructions of the application, the AI application can transform the user's input operation request into operation commands for one or more local non-AI applications, and then invoke the corresponding applications based on certain rules to obtain the user's desired operation result. Furthermore, by recording the local software operation sequence through CV+OS hook functions, reusable script instructions are generated, and context binding triggers the execution of the script when the context conditions are met, which improves the efficiency and accuracy of operation command execution. This is another important inventive concept of this invention.
[0048] Furthermore, in terms of data storage, this invention employs a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, recording the timestamp, operator, and changed content. This invention also supports version backtracking, allowing for quick location of historical states via a timeline or event tags (such as "task started" or "parameter update"). It also supports security auditing by persistently recording critical operations (such as context deletion and permission changes) to ensure log immutability and facilitate compliance review. These are all key inventive concepts of this invention.
[0049] In one embodiment, in the execution unit 203, 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 application. The toolchain composed of the application is dynamically scheduled based on the context state according to the operation commands of the application 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 operation is skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
[0050] In one embodiment, the operation of dynamically scheduling the toolchain composed of applications based on the context state according to the application's operation commands is as follows: sorting all operation commands obtained by transforming 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 toolchain; 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 instruction in the toolchain until all operation commands are executed.
[0051] Another important inventive concept of this invention is that, since MCP operation intentions may involve multiple applications, such as the previously mentioned example of 'retrieving employee attendance records for March', in order to improve the execution efficiency of non-AI local applications, it is necessary to decompose the MCP operation intention into task subgraphs in the cloud based on the MCP protocol. Each node in the task subgraph corresponds to an operation of an application, and a toolchain of applications is generated based on the task subgraph. This allows for chained invocation of applications to process operation commands sequentially, improving processing efficiency. Furthermore, through enhanced privacy protection, sensitive local data is made "usable but not visible," ensuring that the cloud only obtains anonymized results, such as only retrieving user attendance records from the human resources system, without retrieving other private data of users in the human resources system. This is another important inventive point of this invention.
[0052] 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. The first memory size requested in 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. The second memory size requested in the second memory usage request is determined based on the second operation command in the operation command execution dependency graph. After detecting that the first operation command has been executed, the execution context state data in the first memory is sent to the cloud for storage. 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... If 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 greater 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, third memory is requested in the cloud, and the application image corresponding to the third operation command is built in the third memory in the cloud. The third operation command is executed using this image until all operation commands in the operation command execution dependency graph are executed. The operation command execution dependency graph contains at least three operation commands.
[0053] In this invention, since user operation requests typically involve multiple non-AI local applications (usually three or more by default) to meet a complex user need, simultaneously calling numerous non-local applications would significantly impact local system performance if all processing were done locally. This invention creatively proposes that the first and second applications are generally executed locally, while the third application, if memory is insufficient, is moved to the cloud for execution. This requires loading the appropriate image in the cloud to execute the corresponding operations. Alternatively, execution could begin in the cloud from the second operation command onwards, but this would waste significant bandwidth (due to the need to build application images). Given that local system performance is generally quite high, the decision to move to the cloud is made only from the third operation command. This avoids excessive bandwidth consumption and minimizes the impact on local system performance, thereby achieving dynamic coordination of local hardware resources and cloud resources to build a flexible hybrid computing architecture. This is a key inventive concept of this invention.
[0054] One embodiment of the present invention provides a computer storage medium storing a computer program. When the computer program on the computer storage medium is executed by a processor, the above-described method is implemented. The computer storage medium may be a hard disk, DVD, CD, flash memory, or other storage device.
[0055] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware components. As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the apparatus described in various embodiments or certain parts of the embodiments of this application.
[0056] Finally, it should be noted that the above embodiments are for illustration only and not for limiting 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 modifications or equivalent substitutions can still be made to the present invention without departing from the spirit and scope of the present invention. Any modifications or partial substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A cross-environment AI task cooperative execution method based on an MCP protocol, characterized in that, The method includes: The encapsulation step involves 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. The context management step involves building the MCP protocol in the cloud and obtaining the current state of each application's task execution through a unified interface API based on the MCP protocol. The context of the current state is used to ensure that the data between different applications remains consistent. The execution steps involve receiving user input operation requests in the cloud, converting the user operation requests into MCP operation intents based on the MCP protocol, converting the MCP operation intents into operation commands for at least one application, and transmitting the operation commands to the corresponding application deployed on the local system through a unified interface API. The application performs the corresponding operation based on the operation commands and updates the current state of the application using the operation results.
2. The method of claim 1, wherein, The operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of local software, capture and maintain the operation state, or interface elements are identified through OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
3. The method of claim 2, wherein, The operation of building the MCP protocol in the cloud is as follows: Define the context data structure: Intent layer, used to define task objectives and constraints; Data flow layer, used to record data sources and output paths; The tool state 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 de-identification policies. Set up a version control mechanism to generate a unique version identifier for each context change, and store incremental differences (Delta) instead of full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates via message queues; Conflict resolution strategy: Time priority, based on the latest timestamp change, applicable to non-critical parameters; Manual arbitration is used to freeze the context and notify the user to intervene in the handling of critical data conflicts; offline synchronization is guaranteed by persisting the context checkpoints at regular intervals and automatically loading the most recent valid state when the task is resumed to ensure continuity in the event of network outage. Toolchain adaptation and execution optimization: Forward transformation converts structured intents in MCP into native operation instructions for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding triggers script execution when context conditions are met. Security and Access Control: Enhanced data security, supporting individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud, dynamic desensitization, and differentiated data returned based on user roles; Zero-trust permission management supports verifying digital certificates and role permissions each time an application accesses the context.
4. The method of claim 3, wherein, 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 application. Based on the operation commands of the application, the toolchain composed of the application is dynamically scheduled according to the context state to ensure continuous execution of tasks. If the network is interrupted during the execution process, the most recent context checkpoint is loaded from the session pool and the completed operation is skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
5. The method of claim 4, wherein, Set up a monitoring and auditing layer in the cloud to monitor the status of the local system in real time, and provide anomaly alerts and audit traceability.
6. A cross-environment AI task cooperative execution device based on an MCP protocol, characterized in that, The device includes: The encapsulation unit encapsulates 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. The context management unit builds the MCP protocol in the cloud and obtains the current state of each application's task execution through a unified interface API based on the MCP protocol. The context of the current state ensures that the data between different applications remains consistent. The execution unit receives user input operation requests in the cloud, converts the user operation requests into MCP operation intentions based on the MCP protocol, converts the MCP operation intentions into operation commands for at least one application, and transmits the operation commands to the corresponding application deployed on the local system through a unified interface API. The application performs the corresponding operation based on the operation command and updates the current state of the application with the operation result.
7. The apparatus of claim 6, wherein, The operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, services are connected via REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, operating system hook functions are used to listen for system-level events of local software, capture and maintain the operation state, or interface elements are identified through OCR to dynamically update the tool_state field in the context; for local private system applications, SDK and middleware are used to achieve context synchronization between the private system application and the MCP protocol.
8. The apparatus of claim 7, wherein, The operation of building the MCP protocol in the cloud is as follows: Define the context data structure: Intent layer, used to define task objectives and constraints; Data flow layer, used to record data sources and output paths; The tool state 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 de-identification policies. Set up a version control mechanism to generate a unique version identifier for each context change, and store incremental differences (Delta) instead of full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using a publish-subscribe pattern to broadcast context change events, with associated applications receiving updates via message queues; Conflict resolution strategy: Time priority, based on the latest timestamp change, applicable to non-critical parameters; Manual arbitration is used to freeze the context and notify the user to intervene in the handling of critical data conflicts; offline synchronization is guaranteed by persisting the context checkpoints at regular intervals and automatically loading the most recent valid state when the task is resumed to ensure continuity in the event of network outage. Toolchain adaptation and execution optimization: Forward transformation converts structured intents in MCP into native operation instructions for the application; reverse transformation parses application output and extracts key information to update the context; atomic operation encapsulation records local software operation sequences through CV+OS hook functions to generate reusable script instructions; context binding triggers script execution when context conditions are met. Security and Access Control: Enhanced data security, supporting individual encryption of sensitive fields, with keys managed by the Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud, dynamic desensitization, and differentiated data returned based on user roles; Zero-trust permission management supports verifying digital certificates and role permissions each time an application accesses the context.
9. The apparatus of claim 8, wherein, In the execution unit, 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 application. Based on the operation commands of the application, the toolchain composed of the application is dynamically scheduled according to 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 operation is skipped. Before executing critical operations, a secondary confirmation process is triggered to verify the operation and prevent misoperation.
10. A computer storage medium, characterized in that The computer storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1-5.
