Cross-environment AI task cooperative execution method and device based on MCP protocol, and storage medium
Through the cross-environment AI task collaborative execution method based on the MCP protocol, the problem of tool chain splitting, cross-environment collaboration inefficiency and security and privacy risks is solved, and efficient coordinated operation and data synchronization between cloud AI and local software is achieved, improving task success rate and operation efficiency.
Patent Information
- Application Number
- CN202510655952.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2045-05-21
AI Technical Summary
At present, enterprise intelligent transformation faces the problem of tool chain splitting. Cloud AI cannot operate local professional software, resulting in breakpoints in automated processes; cross-environmental collaboration is inefficient, data interaction requires manual transit, network fluctuations lead to task interruption, lack of offline continuous transmission mechanism; security and privacy risks, sensitive data is easily leaked.
Using a cross-environment AI task collaborative execution method based on MCP protocol, by encapsulating local applications as a unified interface API, the MCP protocol is built in the cloud to manage context, realize data consistency between different applications, and convert user operation requests into application operation commands, and dynamically schedule toolchain execution.
It realizes a two-way operation path between cloud AI and local non-API software, breaks through toolchain barriers, improves software operation efficiency, ensures that the cloud only obtains desensitization results, dynamically coordinates local hardware resources and cloud computing power, builds an elastic hybrid computing architecture, supports disconnected network transmission and operation verification, and improves the success rate of cross-environment tasks.
Smart Images

Figure CN120186142A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of the integration of artificial intelligence and distributed processing, and particularly relates to a cross-environment AI task collaborative execution method, device, and storage medium based on the MCP protocol. Background Art
[0002] Currently, enterprises' intelligent transformation faces the following technical obstacles in tool chain fragmentation: Tool operation barrier: Cloud AI can only operate Web applications with open APIs (such as Salesforce, Google Workspace), and cannot control local professional software (such as the Adobe suite, EDA tools), resulting in breakpoints in the automation process. Industry research shows that 38% of the operations in enterprises' key businesses rely on non-API local software (Forrester 2023 report). Traditional local automation solutions (such as AutoHotkey, SikuliX) rely on script recording and playback and lack the intelligent collaboration ability with cloud AI and cannot dynamically respond to demand changes.
[0003] Inefficient cross-environment collaboration: The data interaction between Web and local tools requires manual transfer (such as downloading cloud data → local processing → re-uploading), and the average time consumption increases by 57% (Gartner data). When a task is interrupted due to network fluctuations, there is no offline resume mechanism, and the task restart cost is high.
[0004] Security and privacy risks: There is a risk of easy leakage of sensitive data. Summary of the Invention
[0005] In view of one or more of the above technical defects in the prior art, the present invention proposes the following technical solutions.
[0006] A cross-environment AI task collaborative execution method based on the MCP protocol (i.e., the model context protocol), the method comprising: An encapsulation step of encapsulating multiple different application programs deployed on a local system into a unified interface API respectively, each application program corresponding to a unified interface API, and the encapsulated unified interface API supports context-aware operations; A context management step of building the MCP protocol in the cloud and obtaining the current state of each application program executing a task through the unified interface API based on the MCP protocol, and making the data between different application programs consistent through the context of the current state; Execution steps: Receive the operation request input by the user in the cloud, convert the operation request of the user into an MCP operation intention based on the MCP protocol, convert the MCP operation intention into operation commands for at least one application, and transmit the operation commands to the corresponding application deployed on the local system through the unified interface API. The application executes corresponding operations based on the operation commands and updates the current state of the application using the operation results.
[0007] Furthermore, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: For web applications, dock with the service through REST / GraphQL API to obtain data in real time and map it to context fields; for utility applications, use operating system hook functions to listen for system-level events of local software, capture the operation status and maintain it, or identify interface elements through OCR to dynamically update the tool_state field in the context. For local private system applications, use SDK and middleware 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: The intention layer is used to define task objectives 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. Context synchronization and conflict management: Real-time synchronization, use the publish-subscribe mode to broadcast context change events, and associated applications receive updates through message queues; conflict resolution strategies: Time sequence priority, with the change of the latest timestamp as the standard, applicable to non-critical parameters; manual arbitration, for critical data conflicts, freeze the context and notify the user to intervene and handle; offline synchronization guarantee, persist the context checkpoint at regular intervals, and automatically load the most recent valid state when the task is restored to ensure continuity in the scenario of network disconnection. Toolchain adaptation and execution optimization: Forward conversion, convert the structured intention in MCP into the native instruction of the operation instruction of the application; reverse conversion, parse the application output and extract key information to update the context; encapsulate atomic operations, record the operation sequence of local software through CV+OS hook functions to generate reusable script instructions; context binding, trigger the execution of the script when the context conditions are met. Security and Permission Control: Enhanced data security, supporting separate encryption of sensitive fields. The encryption key is managed by a Hardware Security Module (HSM) to ensure that only ciphertext is processed in the cloud. Dynamic data masking returns differentiated data according to user roles. Zero-trust permission management supports verifying digital certificates and role permissions each time an application accesses the context.
[0009] Furthermore, in the execution step, the MCP operation intention is disassembled into task sub-graphs through task dependency parsing, and the task sub-graphs are converted into operation commands of the corresponding application. Based on the operation commands of the application, the toolchain composed of applications is dynamically scheduled based on the context state to enable continuous task execution. If the network is interrupted during the execution, the most recent context checkpoint is loaded from the session pool, and the completed operations are skipped. Before performing critical operations, a secondary confirmation process is triggered for operation verification to prevent misoperations.
[0010] Furthermore, the operation of dynamically scheduling the toolchain composed of applications based on the context state according to the operation commands of the application is as follows: Sort all the operation commands obtained by converting all task sub-graphs 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 toolchain of the application. Monitor the context state of the currently executed operation command. If the context state meets the condition for executing the next operation command, call the application corresponding to the next operation instruction in the toolchain until all operation commands are executed.
[0011] Further, 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 size of the first memory 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. The size of the second memory requested by 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 context state data executed in the first memory is sent to the cloud for storage. At the same time, the size of the third memory is determined based on the third operation command in the operation command execution dependency graph. 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 recycle the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, a third memory is applied for in the cloud, and an application program image corresponding to the third operation command is built in the third memory of the cloud, and the third operation command is executed using this image until all the operation commands in the operation command execution dependency graph have been executed, where there are at least three operation commands in the operation command execution dependency graph.
[0012] Further, a monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time and provide exception alerts and audit traces.
[0013] The present invention also proposes a cross-environment AI task collaborative execution device based on the MCP protocol. The device includes: An encapsulation unit that encapsulates multiple different application programs deployed on the local system into a unified interface API respectively. Each application program corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations; A context management unit that builds the MCP protocol in the cloud and obtains the current status of each application program executing tasks through the unified interface API based on the MCP protocol, and makes the data between different application programs consistent through the context of the current status; An execution unit that receives an operation request input by a user in the cloud, converts the operation request of the user into an MCP operation intention based on the MCP protocol, and converts the MCP operation intention into operation commands of at least one application program, and transmits the operation commands to the corresponding application program deployed on the local system through the unified interface API. The application program performs corresponding operations based on the operation commands and updates the current status of the application program using the operation results.
[0014] Furthermore, the operation of encapsulating multiple different applications deployed locally into a unified interface API is as follows: for Web applications, connect to the service through REST / GraphQL API, obtain data in real time and map it to context fields; for utility applications, use operating system hook functions to listen for system-level events of local software, capture operation states and maintain them, or identify interface elements through OCR to dynamically update the tool_state field in the context. For local private system applications, use SDK and middleware to achieve context synchronization between private system applications and the MCP protocol.
[0015] Furthermore, the operation of building the MCP protocol in the cloud is as follows: 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 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 desensitization policies; set up a version control mechanism, generate a unique version identifier for each context change, store incremental differences (Delta) instead of full data to reduce storage overhead; Context synchronization and conflict management: for real-time synchronization, use the publish-subscribe mode to broadcast context change events, and associated applications receive updates through message queues; conflict resolution strategies: time priority, with changes at the latest timestamp as the standard, applicable to non-critical parameters; manual arbitration, for critical data conflicts, freeze the context and notify the user to intervene and handle; offline synchronization guarantee, persist the context checkpoint at regular intervals, and automatically load the most recent valid state when the task is restored to ensure continuity in the case of network disconnection; Toolchain adaptation and execution optimization: forward conversion, convert the structured intent in MCP into native operation instructions of the application; reverse conversion, parse the application output and extract key information to update the context; encapsulate atomic operations, record the operation sequence of local software through CV + OS hook functions to generate reusable script instructions; context binding, trigger the execution of the script when the context conditions are met; Security and permission control: enhance data security, support encrypting sensitive fields separately, and the key is managed by a hardware security module (HSM) to ensure that only ciphertext is processed in the cloud, and perform dynamic desensitization to return differentiated data according to user roles; zero-trust permission management, support verifying the digital certificate and role permissions of each application when accessing the context.
[0016] Further, in the execution unit, the MCP operation intention is disassembled into task sub-graphs through task-dependency parsing, and the task sub-graphs are converted into operation commands of the corresponding application. Based on the operation commands of the application and the context state, the tool chain composed of applications is dynamically scheduled to enable continuous execution of tasks. During the execution process, if the network is interrupted, the most recent context checkpoint is loaded from the session pool, and the completed operations are skipped. Before performing critical operations, a secondary confirmation process is triggered to verify the operations and prevent misoperations.
[0017] Further, the operation of dynamically scheduling the tool chain composed of applications based on the operation commands of the application and the context state is as follows: all the operation commands obtained by converting all task sub-graphs are sorted based on task dependencies to obtain an operation command execution dependency graph. Based on the operation command execution dependency graph, an application call sequence is generated to obtain the tool chain of the application. The context state of the currently executed operation command is monitored. If the context state meets the condition for executing the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.
[0018] Further, after obtaining the operation command execution dependency graph, the cloud uses the first thread to send a first memory usage request to the local system. The size of the first memory 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 the second thread to send a second memory usage request to the local system. The size of the second memory 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. At the same time, the size of the third memory is determined based on the third operation command in the operation command execution dependency graph. 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 the 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, and the third operation command is executed using this image until all operation commands in the operation command execution dependency graph are executed, where there are at least three operation commands in the operation command execution dependency graph.
[0019] Further, a monitoring and auditing layer is set up in the cloud to monitor the status of the local system in real time and provide exception alerts and audit traces.
[0020] The present invention also provides a computer-readable storage medium, on which computer program code is stored, and when the computer program code is executed by a computer, the method described above is executed.
[0021] The technical effects of the present invention are as follows: A cross-environment AI task collaborative execution method, device and storage medium based on the MCP protocol of the present invention encapsulate step S101, and respectively encapsulate multiple different application programs deployed on a local system into a unified interface API, and each application program corresponds to a unified interface API. The encapsulated unified interface API supports context-aware operations; context management step S102, constructs the MCP protocol in the cloud, and based on the MCP protocol, obtains the current state of each application program executing a task through the unified interface API, and makes the data between different application programs consistent through the context of the current state; execution step S103, receives an operation request input by a user in the cloud, converts the operation request of the user into an MCP operation intention based on the MCP protocol, and converts the MCP operation intention into operation commands of at least one application program, and transmits the operation commands to the corresponding application program deployed on the local system through the unified interface API. The application program performs corresponding operations based on the operation commands, and updates the current state of the application program using the operation results. The present invention establishes a two-way operation path between cloud AI and local non-API software, breaks through the tool chain barrier, realizes "usable but invisible" for local sensitive data, ensures that the cloud only obtains desensitized results, dynamically coordinates local hardware resources and cloud computing power, constructs an elastic hybrid computing architecture, and supports mechanisms such as offline resume and operation verification, improving the success rate of cross-environment tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Other features, objects, and advantages of the present application will become more apparent by reading the detailed description of the non-limiting embodiments with reference to the following 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 DESCRIPTION OF THE EMBODIMENTS
[0025] The following further elaborates the present application in conjunction with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related invention, rather than limiting the invention. Additionally, it should be noted that for the sake of description, only parts related to the relevant invention are shown in the drawings.
[0026] It should be noted that, without conflict, the embodiments in this application and the features in the embodiments can be combined with each other. The following will detail this application with reference to the accompanying drawings and in combination with the embodiments.
[0027] Figure 1 Disclosed is a method for cross-environment AI task collaborative execution based on the MCP protocol of the present invention. The method includes: Packaging step S101: Packaging multiple different application programs deployed on the local system into unified interface APIs respectively. Each application program corresponds to a unified interface API, and the packaged unified interface API supports context-aware operations; Context management step S102: Building the MCP protocol in the cloud, and obtaining the current status of each application program executing tasks through the unified interface API based on the MCP protocol, so that the data between different application programs is consistent through the context of the current status; Execution step S103: Receiving an operation request input by the user in the cloud, converting the operation request of the user into an MCP operation intention based on the MCP protocol, converting the MCP operation intention into operation commands of at least one application program, and transmitting the operation commands to the corresponding application program deployed on the local system through the unified interface API. The application program performs corresponding operations based on the operation commands and updates the current status of the application program with the operation results.
[0028] For example, if the operation request input by the user is 'Please obtain the attendance record form of employees in March', it can be converted into an MCP operation intention based on the MCP protocol. For example, the operation intention is to check whether the user has the identity of an attendance administrator. If so, log in to human systems such as the attendance system and the DingTalk clock-in system to obtain the attendance data of employees in March, and finally generate local system commands to be called, such as: web-based attendance data acquisition command, DingTalk application clock-in data acquisition command, excel form generation command, etc., thus realizing the interaction between the AI application and the local application program.
[0029] In the present invention, multiple different application programs deployed on a local system are first encapsulated into a unified interface API, with each application program corresponding to a unified interface API. The encapsulated unified interface API supports context-aware operations. An MCP protocol is built in the cloud, and based on the MCP protocol, the current status of each application program executing a task is obtained through the unified interface API. The context of the current status enables the data between different application programs to be consistent. Finally, an operation request input by a user is received in the cloud, the operation request of the user is converted into an MCP operation intention based on the MCP protocol, and the MCP operation intention is converted into operation commands for at least one application program. The operation commands are transmitted to the corresponding application program deployed on the local system through the unified interface API. The application program performs corresponding operations based on the operation commands and updates the current status of the application program using the operation results. That is, the present invention realizes the interaction between AI applications and application programs of traditional local systems based on the MCP protocol, and can synchronize data between multiple applications based on the context of the MCP, That is, a hybrid control channel is built through the MCP protocol, a two-way operation path between cloud AI and local non-API software is established, the toolchain barrier is broken through, and the software operation efficiency is improved. This is an important inventive point of the present invention.
[0030] In one embodiment, the operation of encapsulating multiple different application programs deployed locally into a unified interface API is as follows: for Web application programs, the service is docked through REST / GraphQL API to obtain data in real time and map it to context fields; for tool application programs, the operating system hook function is used to listen for system-level events of local software, capture the operation status and maintain it, or identify interface elements through OCR to dynamically update the tool_state field in the context. For local private system application programs, the SDK and middleware are used to achieve context synchronization between the private system application program and the MCP protocol.
[0031] In the present invention, heterogeneous tools (Web applications, local software, private systems) are encapsulated into a unified interface, supporting context-aware operations, so that operations can be performed using the MCP protocol context, improving the intelligence level of local non-AI applications, thereby improving application efficiency. This is another important inventive concept of the present invention.
[0032] In one embodiment, the operation of building the MCP protocol in the cloud is as follows: Define the context data structure: The intent layer is used to define task objectives 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. Each time the context changes, a unique version identifier is generated, and incremental differences (Delta) are stored instead of full data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using the publish-subscribe mode to broadcast context change events, and associated applications receive updates through message queues; Conflict resolution strategy: Time sequence priority, with the change of the latest timestamp as the standard, applicable to non-critical parameters; Manual arbitration, for critical data conflicts, freeze the context and notify the user to intervene and handle; Offline synchronization guarantee, persist the context checkpoint at regular intervals, and automatically load the latest valid state when the task is restored to ensure continuity in the case of network disconnection; Toolchain adaptation and execution optimization: Forward conversion, converting the structured intent in MCP into the native instructions of the application's operation instructions; Reverse conversion, parsing the application output and extracting key information to update the context; Atomic operation encapsulation, recording the local software operation sequence through CV+OS hook functions to generate reusable script instructions; Context binding, triggering the execution of the script when the context conditions are met; Security and permission control: Enhanced data security, supporting separate encryption of sensitive fields, and the key is managed by a hardware security module (HSM) to ensure that only ciphertext is processed in the cloud, and dynamic desensitization, returning differentiated data according to user roles; Zero-trust permission management, each time an application accesses the context, it supports verifying its digital certificate and role permissions.
[0033] In the present invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly called in the form of encapsulating a unified interface. Through the conversion between MCP intents and the native instructions of the application, the AI application can convert the operation requests input by the user into one or more operation commands of local non-AI applications, and call the corresponding applications based on certain rules. Finally, the operation results required by the user are obtained. Moreover, by recording the local software operation sequence through CV+OS hook functions to generate reusable script instructions, and context binding triggering the execution of the script when the context conditions are met, the efficiency and accuracy of the operation command execution are improved, and high-reliability execution guarantee can be provided, supporting mechanisms such as offline resume and operation verification, and increasing the cross-environment task success rate to 99.9%. This is another important inventive concept of the present invention.
[0034] In terms of data storage, the present invention uses a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, and the timestamp, operator, and change content are recorded. The present invention also supports version backtracking, and the historical state can be quickly located through the timeline or event tags (such as "task start", "parameter update"). It also supports security auditing. By using persistence technology to record key operations (such as context deletion, permission change), it ensures that the logs cannot be tampered with, which is convenient for compliance review. These are all important inventive concepts of the present invention.
[0035] In one embodiment, in the execution step S103, the MCP operation intention is disassembled into task sub-graphs through task dependency parsing, and the task sub-graphs are converted into operation commands of the corresponding application. Based on the operation commands of the application, the tool chain composed of applications is dynamically scheduled based on the context state, so that the tasks are continuously executed. If the network is interrupted during the execution, the most recent context checkpoint is loaded from the session pool, and the completed operations are skipped. Before performing critical operations, a secondary confirmation process is triggered for operation verification to prevent misoperations.
[0036] In one embodiment, the operation of dynamically scheduling the tool chain composed of applications based on the context state according to the operation commands of the application is as follows: all operation commands obtained by converting all task sub-graphs based on task dependencies are sorted to obtain an operation command execution dependency graph. Based on the operation command execution dependency graph, an application call sequence is generated to obtain the tool chain of the application. The context state of the currently executed operation command is monitored. If the context state meets the condition for executing the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.
[0037] Another important inventive concept of the present invention is that since the MCP operation intention may involve multiple applications, such as the example of 'obtaining the attendance records of employees in March' mentioned above. In order to improve the execution efficiency of non-AI local applications, therefore, it is necessary to disassemble the MCP operation intention into task sub-graphs through task dependency parsing based on the MCP protocol in the cloud. Each node in the task sub-graph corresponds to an operation of an application, and a tool chain of the application is generated based on the task sub-graph, so that the applications can be called in a chain to process the operation commands in sequence, improving the processing efficiency. And through enhanced privacy protection, the local sensitive data is made "usable but invisible", ensuring that only the desensitized results are obtained in the cloud. For example, only the attendance records of users are obtained from the human resources system, without obtaining other privacy data of users in the human resources system. This is another important inventive point of the present 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 size of the first memory 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. The size of the second memory requested by 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 context state data executed in the first memory is sent to the cloud for storage. At the same time, the size of the third memory is determined based on the third operation command in the operation command execution dependency graph. 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 recycle the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, a third memory is applied for in the cloud, and an application image corresponding to the third operation command is built in the third memory of the cloud, and the third operation command is executed using this image until all the operation commands in the operation command execution dependency graph have been executed. Among them, there are at least three operation commands in the operation command execution dependency graph.
[0039] In the present invention, since the user's operation requests generally involve the operations of multiple non-AI local applications, and generally more than three are required to meet a complex user requirement. Therefore, when a large number of non-local applications are called simultaneously, if they are all processed locally, it will greatly affect the performance of the local system. The present invention creatively proposes that generally the first and second applications are executed locally. If the memory for 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 operations. Of course, it is also possible to start executing in the cloud from the second operation command, but this will waste a large amount of bandwidth (because the image of the application needs to be built). Based on the current situation, the performance of the local system is generally relatively high. Therefore, it is determined whether to transfer to the cloud for execution starting from the third operation command, which can avoid occupying a large amount of bandwidth and also avoid greatly affecting the performance of the local system, thereby realizing the dynamic coordination of local hardware resources and cloud resources and constructing an elastic hybrid computing architecture. This is an important inventive concept of the present 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 and provide anomaly alerts and audit traceability. For example, Prometheus is used to monitor resource utilization (such as GPU load, memory occupancy), and Grafana is combined to generate a visualization panel. For example, anomaly handling: automatic alert: when an anomaly (such as tool response timeout) is detected, trigger SMS / email notifications. Context snapshot retention: Save the context version at the time of anomaly occurrence to support retrospective analysis after manual intervention.
[0041] Figure 2 An AI task collaborative execution device based on the MCP protocol of the present invention is shown. The device includes: An encapsulation unit 201 that encapsulates multiple different application programs deployed on the local system into a unified interface API respectively. Each application program corresponds to a unified interface API, and the encapsulated unified interface API supports context-aware operations; A context management unit 202 that constructs the MCP protocol in the cloud and obtains the current status of each application program executing tasks through the unified interface API based on the MCP protocol, and makes the data between different application programs consistent through the context of the current status; An execution unit 203 that receives an operation request input by a user in the cloud, converts the operation request of the user into an MCP operation intention based on the MCP protocol, and converts the MCP operation intention into operation commands of at least one application program, and transmits the operation commands to the corresponding application program deployed on the local system through the unified interface API. The application program performs corresponding operations based on the operation commands and updates the current status of the application program using the operation results.
[0042] For example, if the operation request input by the user is 'Please obtain the attendance record form of employees in March', it can be converted into an MCP operation intention based on the MCP protocol. For example, the operation intention is to check whether the user has the identity of an attendance administrator. If so, log in to human systems such as the attendance system and DingTalk clock-in system to obtain the attendance data of employees in March, and finally generate the local system commands that need to be called, such as: web-based attendance data acquisition command, DingTalk application clock-in data acquisition command, excel form generation command, etc., thus realizing the interaction between the AI application and the local application program.
[0043] In the present invention, multiple different application programs deployed on a local system are first encapsulated into a unified interface API respectively, with each application program corresponding to a unified interface API. The encapsulated unified interface API supports context-aware operations. An MCP protocol is built in the cloud, and based on the MCP protocol, the current status of each application program executing tasks is obtained through the unified interface API. The context of the current status enables the data between different application programs to be consistent. Finally, an operation request input by a user is received in the cloud, the operation request of the user is converted into an MCP operation intention based on the MCP protocol, and the MCP operation intention is converted into operation commands for at least one application program. The operation commands are transmitted through the unified interface API to the corresponding application program deployed on the local system. The application program performs corresponding operations based on the operation commands and updates the current status of the application program with the operation results. That is, the present invention realizes the interaction between AI applications and application programs of traditional local systems based on the MCP protocol, and can synchronize data among multiple applications based on the context of the MCP, namely, a hybrid control channel is built through the MCP protocol, a two-way operation path between cloud AI and local non-API software is established, the toolchain barrier is broken through, and the software operation efficiency is improved. This is an important inventive point of the present invention.
[0044] In one embodiment, the operation of encapsulating multiple different application programs deployed locally into a unified interface API is as follows: for Web application programs, the service is docked through REST / GraphQL API to obtain data in real time and map it to context fields; for tool application programs, the operating system hook function is used to listen for system-level events of local software, capture the operation status and maintain it, or identify interface elements through OCR to dynamically update the tool_state field in the context. For local private system application programs, SDK and middleware are used to realize the context synchronization between the private system application program and the MCP protocol.
[0045] In the present invention, heterogeneous tools (Web applications, local software, private systems) are encapsulated into a unified interface, which supports context-aware operations, so that operations can be performed using the MCP protocol context, improving the intelligence level of local non-AI applications and thus improving the application efficiency. This is another important inventive concept of the present invention.
[0046] In one embodiment, the operation of building the MCP protocol in the cloud is as follows: Define the context data structure: The intent layer is used to define task objectives 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. Each time the context changes, a unique version identifier is generated, and incremental differences (Delta) are stored instead of full-scale data to reduce storage overhead; Context synchronization and conflict management: Real-time synchronization, using the publish-subscribe mode to broadcast context change events, and associated applications receive updates through message queues; Conflict resolution strategy: Time sequence priority, with the change of the latest timestamp as the standard, applicable to non-critical parameters; Manual arbitration, for critical data conflicts, freeze the context and notify the user to intervene and handle; Offline synchronization guarantee, persist the context checkpoint at regular intervals, and automatically load the most recent valid state when the task is restored to ensure continuity in the scenario of network disconnection; Toolchain adaptation and execution optimization: Forward conversion, converting the structured intent in MCP into the native instructions of the application's operation instructions; Reverse conversion, parsing the application output and extracting key information to update the context; Atomic operation encapsulation, recording the local software operation sequence through CV+OS hook functions to generate reusable script instructions; Context binding, triggering the execution of the script when the context conditions are met; Security and permission control: Enhanced data security, supporting separate encryption of sensitive fields, and the key is managed by a hardware security module (HSM) to ensure that only ciphertext is processed in the cloud, and dynamic desensitization, returning differentiated data according to user roles; Zero-trust permission management, each time an application accesses the context, it supports verifying its digital certificate and role permissions.
[0047] In the present invention, by implementing the MCP protocol in the cloud, local non-AI applications can be uniformly called in the form of encapsulating a unified interface. Through the conversion between MCP intents and the native instructions of the application, the AI application can convert the operation requests input by the user into one or more operation commands of local non-AI applications, and call the corresponding applications based on certain rules. Finally, the operation results required by the user are obtained. Moreover, by recording the local software operation sequence through CV+OS hook functions to generate reusable script instructions, and context binding triggering the execution of the script when the context conditions are met, the efficiency and accuracy of the execution of the operation commands are improved. This is another important inventive concept of the present invention.
[0048] In terms of data storage, the present invention uses a distributed database (Redis) to store context snapshots. Each context change generates an incremental version, and the timestamp, operator, and change content are recorded. The present invention also supports version backtracking, and historical states can be quickly located through the timeline or event tags (such as "task start", "parameter update"). It also supports security auditing. Key operations (such as context deletion, permission change) are recorded through persistence technology to ensure that the logs cannot be tampered with, which is convenient for compliance review. These are all important inventive concepts of the present invention.
[0049] In one embodiment, in the execution unit 203, the MCP operation intention is disassembled into task sub-graphs through task dependency parsing, and the task sub-graphs are converted into operation commands of the corresponding application. Based on the operation commands of the application, the tool chain composed of applications is dynamically scheduled based on the context state, so that the tasks are continuously executed. If the network is interrupted during the execution process, the nearest context checkpoint is loaded from the session pool, and the completed operations are skipped. Before performing critical operations, a secondary confirmation process is triggered for operation verification to prevent misoperations.
[0050] In one embodiment, the operation of dynamically scheduling the tool chain composed of applications based on the context state according to the operation commands of the application is as follows: all operation commands obtained by converting all task sub-graphs are sorted based on task dependencies 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. If the context state meets the condition for executing the next operation command, the application corresponding to the next operation instruction is called in the tool chain until all operation commands are executed.
[0051] Another important inventive concept of the present invention is that since the MCP operation intention may involve multiple applications, such as the previously exemplified 'obtaining the attendance records of employees in March'. In order to improve the execution efficiency of non-AI local applications, therefore, it is necessary to disassemble the MCP operation intention into task sub-graphs through task dependency parsing based on the MCP protocol in the cloud. Each node in the task sub-graph corresponds to an operation of an application, and a tool chain of the application is generated based on the task sub-graph, so that the applications can be called in a chain to process the operation commands in sequence, improving the processing efficiency. And through enhanced privacy protection, the local sensitive data is made "usable but invisible", ensuring that only the desensitized results are obtained in the cloud. For example, only the attendance records of users are obtained from the human resources system, without obtaining other privacy data of users in the human resources system. This is another important inventive point of the present 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 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. 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 detecting that the first operation command has been executed, the context state data executed in the first memory is sent to the cloud for storage. At the same time, the 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 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 reclaim the first memory. If the remaining memory space of the local system cannot meet the third memory usage request, a 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, and the third operation command is executed using this image until all the operation commands in the operation command execution dependency graph have been executed. Among them, there are at least three operation commands in the operation command execution dependency graph.
[0053] In the present invention, since the user's operation requests generally involve the operations of multiple non-AI local applications, and generally more than three are required to meet a complex user requirement. Therefore, when a large number of non-local applications are called simultaneously, if they are all processed locally, it will greatly affect the performance of the local system. The present invention creatively proposes that generally the first and second applications are executed locally. If the memory for 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 execute the corresponding operation. Of course, it is also possible to start executing in the cloud from the second operation command, but this will waste a large amount of bandwidth (because the image of the application needs to be constructed). Based on the current situation, the performance of the local system is generally relatively high. Therefore, it is only judged whether to transfer to the cloud for execution from the third operation command, which can avoid occupying a large amount of bandwidth and also avoid overly affecting the performance of the local system, thereby realizing the dynamic coordination of local hardware resources and cloud resources and constructing an elastic hybrid computing architecture. This is an important inventive concept of the present invention.
[0054] In one embodiment of the present invention, a computer storage medium is proposed. A computer program is stored on the computer storage medium. When the computer program on the computer storage medium is executed by a processor, the above method is implemented. The computer storage medium can be a hard disk, DVD, CD, flash memory, etc.
[0055] For the convenience of description, the above device is described by dividing it into various units according to 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. Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present 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 for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the device described in each embodiment or some parts of the embodiments of the present application.
[0056] Finally, it should be noted that the above embodiments are only used to illustrate rather than limit the technical solution of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that the present invention can still be modified or equivalently replaced. Any modification or partial replacement without departing from the spirit and scope of the present invention shall be covered by 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, and the encapsulated unified interface API supports context-aware operations; The context management step is to build the MCP protocol in the cloud and obtain the current status of each application's execution task 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. 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 intention based on the MCP protocol, converting the MCP operation intention into an operation command of at least one application, and transmitting the operation command to a corresponding application deployed on a local system through a unified interface API, wherein the application performs a corresponding operation based on the operation command and uses the operation result to update a current state of the application.
2. The method according to claim 1, characterized in that The operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, docking 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 listen to system-level events of local software, capturing operation status and maintaining it, or identifying interface elements through OCR, 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 of constructing the MCP protocol in the cloud are: 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; 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, store incremental differences (Delta) instead of full data, and 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: freeze the context and notify the user to intervene in case of key data conflicts; offline synchronization guarantee: persist the context checkpoints at regular intervals, and automatically load the most recent valid state when the task is resumed to ensure continuity in network disconnection scenarios; Toolchain adaptation and execution optimization: forward conversion, converting the structured intent in MCP into native instructions of the application's operation instructions; reverse conversion, parsing the application output and extracting key information to update the context; atomic operation encapsulation, recording the local software operation sequence through CV+OS hook function, generating reusable script instructions; context binding, triggering the execution of the script when the context conditions are met; Security and permission control: Data security is enhanced, supporting separate encryption of sensitive fields. The keys are managed by the hardware security module (HSM), ensuring that only ciphertext is processed in the cloud, dynamically desensitizing, and returning differentiated data based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions every time an application accesses a context.
4. The method according to claim 3, characterized in that In the execution step, the MCP operation intention is decomposed into task subgraphs through task dependency parsing, and the task subgraphs are converted into operation commands of corresponding applications. The tool chain composed of applications is dynamically scheduled based on the context state according to the operation commands of the applications, so that the tasks are executed continuously. If the network is interrupted during the execution process, 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.
5. The method according to claim 4, 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.
6. 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. A context management unit builds an MCP protocol in the cloud, and obtains the current status of each application executing a task through a unified interface API based on the MCP protocol, and keeps the data between different applications consistent through the context of the current status; The execution unit receives an operation request input by a user in the cloud, converts the user's operation request into an MCP operation intention based on the MCP protocol, converts the MCP operation intention 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.
7. The device according to claim 6, characterized in that The operations of encapsulating multiple different applications deployed locally into a unified interface API are as follows: for Web applications, docking 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 listen to system-level events of local software, capturing operation status and maintaining it, or identifying interface elements through OCR, 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.
8. The device according to claim 7, characterized in that The operations of constructing the MCP protocol in the cloud are: 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; 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, store incremental differences (Delta) instead of full data, and 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: freeze the context and notify the user to intervene in case of key data conflicts; offline synchronization guarantee: persist the context checkpoints at regular intervals, and automatically load the most recent valid state when the task is resumed to ensure continuity in network disconnection scenarios; Toolchain adaptation and execution optimization: forward conversion, converting the structured intent in MCP into native instructions of the application's operation instructions; reverse conversion, parsing the application output and extracting key information to update the context; atomic operation encapsulation, recording the local software operation sequence through CV+OS hook function, generating reusable script instructions; context binding, triggering the execution of the script when the context conditions are met; Security and permission control: Data security is enhanced, supporting separate encryption of sensitive fields. The keys are managed by the hardware security module (HSM), ensuring that only ciphertext is processed in the cloud, dynamically desensitizing, and returning differentiated data based on user roles. Zero-trust permission management supports verification of digital certificates and role permissions every time an application accesses a context.
9. The device according to claim 8, characterized in that 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 corresponding applications. The tool chain composed of applications is dynamically scheduled based on the context state according to the operation commands of the applications, so that the tasks are executed continuously. If the network is interrupted during the execution process, 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.
10. 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 5 is implemented.
Citation Information
Patent Citations
Cross-platform data communication board card data processing method and device
CN119420785A
Method and system for realizing automatic code generation by using multiple AI Agents
CN119861916A
Method, device, equipment and product for executing task
CN120013493A
Security gateway that implements multiple communication cryptographic operation parallelism
KR1020180026230A
Method for classifying the recycling grade of waste battery
KR1020230054978A
Cited By
AI intelligent assistant end cloud collaboration method and device based on cloud computer
CN120614353A
Dynamic calling method and system for AI large model and heterogeneous system based on MCP protocol
CN120676061A
An AI large model and heterogeneous system dynamic calling method and system based on an MCP protocol
CN120676061B
Database installation and deployment method based on MCP protocol
CN120743299A
A database installation and deployment method based on MCP protocol
CN120743299B