MCP adaptation method and device for operating system intelligent engine
Patent Information
- Application Number
- CN202511469268.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2045-10-15
AI Technical Summary
然而,不同的本地执行器和工具包具有不同的协议、数据格式及鉴权机制,造成了在集成多种组件时,开发者需要手动编写大量适配层,增加了系统的开发和维护成本,并降低了系统的扩展性和可靠性
[0015]在本申请实施例中,提供了一种面向操作系统智能引擎的MCP适配方法及装置,旨在通过智能任务调度和大模型优化提升操作系统在复杂任务执行中的效率与灵活性。系统包括统一自定义接口适配层、任务解析模块、智能工具箱管理模块及结果整合模块。用户输入自然语言指令后,系统通过“用户指令意图解析与识别模块”解析意图,选择本地或云端大模型生成结构化任务描述。统一适配层根据任务类型智能调度工具模块进行执行。系统具备动态网络检测功能,实时监测网络状态并自动切换运行模式,确保在稳定网络下使用云端大模型,在离线或不稳定网络下使用本地大模型。任务执行后,结果通过“结果收集与处理模块”整合,并通过“大模型推理与友好反馈模块”生成优化结果,实时反馈给用户,提高了国产操作麒麟系统环境下的任务执行效率和系统稳定性,适用于多种复杂应用场景。
Smart Images

Figure CN122711213B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of large language model design, and in particular to an MCP adaptation method and apparatus for operating system intelligent engines. Background Technology
[0002] Currently, the market is flooded with lightweight models that can be executed locally on the terminal, as well as a large number of custom executors and toolkits. These localized components are widely used in smart homes, automotive systems, military terminals, and other scenarios. However, different local executors and toolkits have different protocols, data formats, and authentication mechanisms. This means that when integrating multiple components, developers need to manually write a large number of adaptation layers, which increases the development and maintenance costs of the system and reduces the system's scalability and reliability.
[0003] Currently, domestic operating systems such as Kylin OS differ significantly from traditional Linux in their underlying system calls, middleware interfaces, and driver models. This makes traditional adaptation layers unusable and necessitates secondary encapsulation and optimization. Furthermore, with the increasing demand for switching between online and offline modes, existing solutions face the challenge of introducing numerous logical branches into the adaptation layer, leading to a substantial increase in development, testing, and maintenance costs. Summary of the Invention
[0004] This application provides an MCP adaptation method and apparatus for operating system intelligent engines, realizing a novel adaptation framework that is compatible with and efficiently schedules local and cloud resources in domestic operating systems. It can solve the problem of heterogeneity of protocols and interfaces and improve the scalability and reliability of the system.
[0005] On the one hand, a method for MCP adaptation to an operating system's intelligent engine is provided, the method comprising: The natural language commands input by the user through the interface are preprocessed to obtain a structured task description; Through a custom interface adaptation layer, a target tool module is selected in the intelligent toolbox management mechanism. The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description. In the target tool module, the structured task description is executed by issuing execution instructions through the optimized MCP protocol, and the execution result corresponding to the target tool module is obtained. Based on the execution results and the current network status, a cloud-based or local large model is selected to optimize the execution results, and the optimized execution results are fed back to the front-end user interface.
[0006] Optionally, the preprocessing of natural language commands input by the user through the interface to obtain a structured task description includes: Obtain natural language commands input by the user through the interface; Based on the current network status, task complexity, and available resource servers, intelligently select between local deployment or cloud deployment for large models; The natural language instructions are subjected to deep semantic understanding and intent recognition using a selected large model; Based on the deep semantic understanding and intent recognition results, a structured task description is generated; A custom interface adaptation layer is adopted, and the structured task description is transmitted to the intelligent toolbox management mechanism through the optimized MCP protocol.
[0007] Optionally, the selection of target tool modules in the intelligent toolbox management mechanism through a custom interface adaptation layer includes: Receive the generated structured task description; By using a custom interface adaptation layer and an optimized MCP protocol, execution instructions are selected and sent to the target tool module. The target tool module executes the task according to the execution instruction and generates the corresponding execution result. The execution result serves as the input for subsequent steps, allowing the step of selecting a cloud or local large model to optimize the execution result for further processing and optimization.
[0008] Optionally, in the target tool module, executing the structured task description by issuing execution instructions through the optimized MCP protocol to obtain the execution result corresponding to the target tool module includes: By using a custom interface adaptation layer and the optimized MCP protocol, execution instructions are selected and sent to the target tool module. The target tool module executes the task according to the execution instruction and generates the execution result.
[0009] Optionally, the step of optimizing the execution result based on the execution result and the current network status by selecting a large model in the cloud or locally, and feeding back the optimized execution result to the front-end user interface, includes: Receive the execution results generated by the target tool module; Based on the current network status, dynamic decisions are made to select whether to use a local large model or a cloud-based large model to optimize the results. The execution results are optimized using the selected large model; The optimized execution results are fed back to the front-end user interface in real time, completing the task feedback.
[0010] Optionally, the tool module includes a local executor, a cloud service, and a hardware-accelerated executor, and the custom interface adaptation layer is also used to dynamically schedule and select the target tool module according to task requirements.
[0011] Optionally, the step of selecting and issuing execution instructions to the target tool module through a custom interface adaptation layer and the optimized MCP protocol includes: Receive the structured task description passed through the custom interface adaptation layer; Analyze the task types in the structured task description; Select the appropriate execution tool module; Generate corresponding execution instructions based on the requirements of the task; The optimized MCP protocol is used to send execution instructions to the target tool module; The execution command has been successfully received and is ready to be executed.
[0012] Optionally, optimizing the execution result using the selected large model includes: Analyze the types of execution results; Select the most suitable large model based on the network state; Launch the selected large model for in-depth optimization; Integrate the optimization results to ensure that the optimized results meet user needs; The optimized execution results are then passed to the front-end user interface.
[0013] On the other hand, an MCP adaptation device for an operating system's intelligent engine is provided, the device comprising: The preprocessing module is used to preprocess the natural language instructions input by the user through the interface to obtain a structured task description; The tool selection module is used to select a target tool module in the intelligent toolbox management mechanism through a custom interface adaptation layer. The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description. The task execution module is used in the target tool module to execute the structured task description by issuing execution instructions through the optimized MCP protocol, and obtain the execution result corresponding to the target tool module. The result optimization module is used to optimize the execution result based on the execution result and the current network status, selecting a large model in the cloud or on the local network, and then feeding back the optimized execution result to the front-end user interface.
[0014] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored in the computer program, which is loaded and executed by a processor to implement an MCP adaptation method for an operating system intelligent engine as described above.
[0015] This application provides an MCP adaptation method and apparatus for operating system intelligent engines, aiming to improve the efficiency and flexibility of the operating system in complex task execution through intelligent task scheduling and large model optimization. The system includes a unified custom interface adaptation layer, a task parsing module, an intelligent toolbox management module, and a result integration module. After the user inputs a natural language command, the system parses the intent through the "user command intent parsing and recognition module" and selects either a local or cloud-based large model to generate a structured task description. The unified adaptation layer intelligently schedules the tool module to execute the task based on the task type. The system has a dynamic network detection function, monitoring the network status in real time and automatically switching the operating mode to ensure that the cloud-based large model is used under a stable network, and the local large model is used under offline or unstable networks. After task execution, the results are integrated through the "result collection and processing module" and optimized results are generated through the "large model inference and user-friendly feedback module," providing real-time feedback to the user. This improves the task execution efficiency and system stability under the domestic operating system Kylin, making it suitable for various complex application scenarios. Attached Figure Description
[0016] Figure 1 The flowchart illustrates an exemplary embodiment of this application of an MCP adaptation method for an operating system intelligent engine. Figure 2 This illustration shows a schematic diagram of the overall architecture design of the adaptation system provided in an exemplary embodiment of this application; Figure 3 This application illustrates a main workflow diagram provided by an exemplary embodiment. Figure 4 This illustration shows a detailed diagram of the custom interface adaptation layer provided in an exemplary embodiment of this application; Figure 5 A diagram illustrating the system online / offline dynamic switching mechanism provided in an exemplary embodiment of this application is shown. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0018] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0019] In summary, this invention discloses a deep MCP adaptation and optimization technology for the domestic open-source Kylin operating system. It is important to emphasize that in practical applications, this can be implemented as an MCP adaptation system for the operating system's intelligent engine. This system is specifically designed for the domestic Kylin operating system, resolving its unique architecture, desktop environment (such as UKUI), and API compatibility issues. Therefore, in the following embodiments, if described as a system, it refers to the implemented system corresponding to an MCP adaptation method for the operating system's intelligent engine. This technology innovatively solves the heterogeneous problems of calling protocols, data formats, and authentication between traditional large models and executors. The core innovation lies in constructing a high-level, custom interface adaptation layer for multiple models and toolkits. This adaptation layer is designed for the efficient management and scheduling of multiple heterogeneous large language models (whether deployed locally or in the cloud) and an "intelligent toolkit" containing diverse online / offline servers, executors, and specialized tools.
[0020] Specifically, this invention establishes a unified custom interface adaptation layer, tailor-made for the domestic Kylin operating system environment, capable of seamlessly integrating multiple models and tools. Users input natural language commands (such as "turn on Bluetooth") through the front end, and the system first parses the user's intent using a large model. Subsequently, the custom interface adaptation layer, acting like an intelligent engine, automatically retrieves and calls the most suitable tool module, issues commands through the MCP protocol (or its optimized interface) to execute operations, and provides real-time feedback on the execution results.
[0021] This architecture not only enables seamless integration of various models and tools, but also greatly simplifies the integration and development process of new tools through a unified interface. Meanwhile, the system's built-in online / offline policy management function can adaptively switch between fully offline mode and cloud-based collaborative mode, ensuring real-time parsing and data privacy in offline environments. Simultaneously, it can fully utilize cloud computing power and the latest models when the network recovers, thereby improving the intelligence level, execution efficiency, system maintainability, and developer friendliness of complex instruction processing.
[0022] It includes the following key functions.
[0023] First, user command intent parsing and recognition. It can intelligently select a local or cloud-based large model based on the current network status and resource availability to perform deep semantic understanding and intent recognition of user commands, generating structured task descriptions.
[0024] Second, custom interfaces for secure calls to intelligent tools. The custom interface adaptation layer intelligently schedules appropriate tool modules from the "intelligent toolbox" to execute tasks based on the structured tasks generated by the intent parsing module.
[0025] Third, execution result collection and formatting. It can collect and format the raw results returned by the executor, provide real-time feedback to the user interface, and intelligently determine the system's operating mode through a dynamic network status detection mechanism.
[0026] Fourth, result integration and large-scale model inference. The collected execution results are integrated, and based on the network status, a large-scale model, either local or cloud-based, is selected for inference. The results are then presented to the user in a concise and user-friendly manner.
[0027] An MCP-adapted system for operating system intelligent engines is specifically designed for the domestically developed Kylin operating system. It resolves compatibility issues related to Kylin's unique architecture, desktop environment (such as UKUI), and API compatibility, ensuring stable operation within the domestic operating system environment. The system can intelligently switch between online and offline modes to adapt to different network environments, ensuring stable operation even with unstable networks and fully utilizing cloud computing power when the network recovers. Precise intent parsing and flexible command processing: Modular contextual prompts and dynamic prompt completion are achieved through the MCP protocol. Combined with deep semantics and intent parsing modules, it accurately distinguishes between system operations and question-and-answer interactions, significantly improving interaction accuracy and execution efficiency. The system supports local large-scale model deployment, ensuring efficient operation in network-restricted or no-network environments, protecting user data privacy and operational stability, and adapting to low-resource and data-isolated scenarios within the Kylin operating system environment. The MCP protocol, optimized for the Kylin operating system architecture and network environment, enables low-latency, secure, and reliable data transmission and command issuance, enhancing the processing capabilities of distributed tasks. By constructing an advanced custom interface adaptation layer as an intelligent engine, this system achieves unified management and intelligent invocation of multiple heterogeneous large language models (local or cloud-based) and diverse online / offline servers, executors, and specialized tools within a varied "intelligent toolbox," providing a seamless access and efficient collaborative user experience. Through the custom interface adaptation layer, this system significantly simplifies the tool integration process and improves the system's intelligence level, execution efficiency, maintainability, and developer friendliness under different network environments. This represents a significant technological advancement applicable to various complex application scenarios. The adaptation method is further disclosed below through various embodiments.
[0028] Example 1 Please refer to Figure 1 The diagram illustrates a flowchart of an MCP adaptation method for an operating system intelligent engine, provided in an exemplary embodiment of this application. It includes: Step 1: Preprocess the natural language commands input by the user through the interface to obtain a structured task description.
[0029] The system receives natural language commands input by the user through the interface and preprocesses them. This preprocessing includes semantic analysis, intent parsing, and contextual understanding of the commands, converting the natural language commands into structured task descriptions. Through this step, the system can accurately identify user intent and generate standardized task data, ensuring the accuracy and efficiency of subsequent operations.
[0030] Step 2: Select the target tool module in the smart toolbox management mechanism through the custom interface adaptation layer.
[0031] The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description.
[0032] After obtaining the structured task description, the system automatically retrieves and selects the most suitable target tool module through a custom interface adaptation layer, based on the intelligent toolbox management mechanism. This custom interface adaptation layer has the ability to intelligently select execution tools according to task requirements, and can efficiently match among multiple tool modules to ensure optimized task execution and optimal resource utilization. The technical effect of this step is automated scheduling, reduced manual intervention and system complexity, and improved tool usage efficiency.
[0033] Step 3: In the target tool module, the structured task description is executed by issuing execution instructions through the optimized MCP protocol to obtain the execution result corresponding to the target tool module.
[0034] After identifying the target tool module, the system issues execution instructions via the optimized MCP protocol, directing the target tool module to perform operations corresponding to the structured task description. The MCP protocol plays a communication and coordination role in this process, ensuring efficient and stable data transmission and task execution. The technical effect of this step is to achieve precise task execution and result feedback, guaranteeing the system's execution efficiency and accuracy.
[0035] Specifically, the optimizations involved in the MCP protocol include the following:
[0036] First, the system call interface of the domestic operating system Kylin was adjusted, and the optimized MCP protocol was fully adapted to functions such as data transmission, file operations, and process management. These adjustments ensure that the protocol can accurately and efficiently execute instructions when interacting with the underlying operating system of Kylin. For example, file operation and process scheduling instructions in the MCP protocol will be converted into API calls specific to Kylin. This not only avoids incompatibility issues of system calls but also improves execution efficiency and reduces errors or delays caused by system call mismatches.
[0037] In terms of resource management, the optimized MCP protocol provides refined management of hardware resources for the domestically developed Kylin operating system, particularly in terms of memory usage, CPU consumption, and network bandwidth consumption. By optimizing data structures, reducing unnecessary memory copies, and rationally scheduling threads, the protocol significantly reduces resource overhead, thereby improving execution efficiency. For example, the optimized protocol reduces the frequency of memory allocation and reclamation, ensuring maximum utilization of memory resources through the use of more efficient memory pool management technology. Regarding CPU usage, the optimized protocol employs multi-threaded processing and task allocation strategies to ensure load balancing when the system executes complex tasks, avoiding single-threaded bottlenecks.
[0038] Furthermore, to address the differences between the domestic Kylin operating system environment and traditional Linux systems, the optimized MCP protocol also developed a compatibility layer, resolving issues related to dependencies on specific libraries or runtime environments. When the domestic Kylin operating system lacks certain functional libraries or its versions are incompatible with the libraries relied upon by the MCP protocol, the compatibility layer translates the general instructions of MCP into instructions that the domestic Kylin operating system can understand and execute. This adapter development enables the MCP protocol to run on the domestic Kylin operating system without modifying the core logic of the existing protocol, thereby improving its cross-platform compatibility.
[0039] Furthermore, the optimized MCP protocol, when issuing execution commands, first transforms the structured task description into specific operation instructions through a custom interface adaptation layer, and intelligently schedules suitable tool modules based on the task type and current network status. When the protocol commands are transmitted to the target tool module, the optimized MCP protocol ensures the efficiency and reliability of command transmission. The commands in the protocol are sent through an optimized communication path, ensuring that data transmission is not blocked due to insufficient network bandwidth or resource contention, thus enabling the task to be completed smoothly.
[0040] Therefore, this series of optimizations in step 3 ensures that the MCP protocol can effectively execute tasks under the domestic operating system Kylin, improving system stability and task execution efficiency. Especially when dealing with complex tasks, it can make intelligent selections and optimize the execution process based on real-time status.
[0041] Step 4: Based on the execution result and the current network status, select either the cloud or local large model to optimize the execution result, and feed the optimized execution result back to the front-end user interface.
[0042] After the target tool module completes execution, the system selects an appropriate large model for result optimization based on the execution results and the current network status (e.g., online or offline). If the network is offline, the local large model is used; if the network is online and cloud computing resources are available, the system switches to the cloud-based large model. The optimized execution results are fed back to the front-end user interface in a structured form via the optimized MCP protocol. The technical effect of this step is to provide fast, accurate, and secure feedback, ensuring optimized user experience under various network conditions, while also improving the system's intelligent processing capabilities.
[0043] In summary, the MCP adaptation method for operating system intelligent engines provided in this application achieves efficient processing and execution optimization of natural language commands. First, the system performs deep semantic analysis and intent recognition on the natural language commands input by the user, converting them into a structured task description to ensure accurate identification of user needs. Next, a custom interface adaptation layer intelligently selects and schedules the most suitable tool module, optimizing resource utilization and task execution efficiency. Then, the system issues execution commands through the optimized MCP protocol, ensuring high efficiency and accuracy in task execution. Finally, the system intelligently selects a local or cloud-based large model for optimization based on the execution results and network status, ensuring rapid feedback of execution results in any network environment. Through these steps, this invention provides an intelligent, automated, and highly adaptable MCP adaptation method, significantly improving task execution efficiency, system flexibility, and user experience, overcoming the bottlenecks of protocol heterogeneity and network dependency in traditional methods.
[0044] Example 2 Step 1: Preprocess the natural language commands input by the user through the interface to obtain a structured task description.
[0045] Step 11: Obtain the natural language commands input by the user through the interface.
[0046] User instruction intent parsing and structured task description generation: accepts and preprocesses natural language instructions input by the user through the interface.
[0047] Step 12: Based on the current network status (online / offline), task complexity, and available resource servers, intelligently select between local deployment or cloud deployment for the large model.
[0048] Step 13: Perform deep semantic understanding and intent recognition on the natural language instructions using the selected large model.
[0049] Step 14: Based on the deep semantic understanding and intent recognition results, generate a structured task description.
[0050] That is, steps 12 to 14 have the ability to adapt to network status. Based on the current network status (online / offline), task complexity and available resource servers, it can intelligently choose to deploy the large model locally or in the cloud, perform deep semantic understanding and intent recognition on user commands, and parse them into a structured task description.
[0051] Step 15: Using a custom interface adaptation layer, the structured task description is transmitted to the intelligent toolbox management mechanism through the optimized MCP protocol.
[0052] To achieve this goal, the system incorporates a custom "intelligent toolbox" management mechanism, which includes diverse online / offline servers, executors, and specialized tools. The custom interface adaptation layer accepts structured task requirements from the intent parsing module and selects local or remote tool modules to perform specific operations via an optimized MCP protocol. In this step, to achieve accurate intent recognition and task parsing, the system introduces two core modules: a Prompt setting module and a semantic and intent parsing module.
[0053] The Prompt setting module, as the core module for user command intent parsing, ensures the system can accurately interpret user commands by dynamically adjusting the model's response strategy. This module, combined with the MCP protocol, generates appropriate prompts through preset roles and an auto-completion mechanism, providing more precise contextual information for subsequent semantic parsing. For example, when a user inputs "Check today's weather in Shanghai," the Prompt setting module, based on the preset "Information Query Assistant" role, automatically generates a completed prompt: "You are an information query assistant. Please first query the current date and time, and then query today's weather information for the city (Shanghai) specified by the user." Similarly, for the command "I want to turn on Bluetooth," the module, based on the "Operating System Command Manager" role, generates "You are an operating system command manager. Please perform the operation of turning on Bluetooth." Through this dynamic completion mechanism, the Prompt setting module effectively guides the large model to more accurately understand user intent, reducing ambiguity.
[0054] Building upon the initial processing of the Prompt setting module, the semantic and intent parsing module further refines the semantics and determines the intent of user input. This module deeply understands the specific meaning of instructions and accurately determines their execution goals, whether it's to perform system operations or engage in question-and-answer interaction with a larger model. Compared to traditional large models, this module solves the problem of scene differentiation through custom parsing rules, ensuring the system can flexibly respond to different types of input, whether it's synonym expressions, multi-turn dialogues, or ambiguous instructions. The system can combine context and history to complete information and execute appropriate operations. For example, when a user inputs "Print this," the system will infer the specific file based on the current context and complete the task.
[0055] In multi-turn command or continuous task scenarios, the semantic and intent parsing module ensures logical consistency and smooth task execution. This module deeply analyzes user input and combines it with the precise prompts provided by the MCP protocol, enabling the system to accurately map the user's true needs and generate structured task descriptions as input for subsequent intelligent tool calls. This design significantly improves the system's response accuracy and processing efficiency, providing strong support for the efficient execution of complex tasks. For direct and explicit short commands (such as "take a screenshot" or "shut down"), the module directly passes the command to the execution layer, avoiding redundant processing. For more complex descriptive commands (such as "I have some documents, please print them for me"), the prompt setting module simplifies them into concise key operations (such as "turn on the printer"). In multi-tasking scenarios, such as "The screen is a bit dim, turn on light mode, help me set the input method and find the Word documents I modified in the last week," the module can break down complex commands into multiple independent tasks and pass them to different modules for parallel processing, significantly improving the system's response efficiency.
[0056] After user commands are processed by the Prompt setting module and the semantic and intent parsing module, the system selects an appropriate large model for inference based on the network environment and task complexity. Deploying a local large model is particularly important in environments without or with limited network access. This allows the system to operate independently of cloud services, significantly improving operational stability and security while ensuring user data privacy. For the domestically developed Kylin operating system, this type of large model can be deeply integrated and automatically loads and initializes semantic functions, ensuring efficient operation even in low-resource environments. The system also supports optimized caching of inference results to avoid redundant calculations, thereby significantly improving response speed. Through this design, the system can not only respond quickly without cloud support but also effectively protect user privacy and information security in data isolation scenarios.
[0057] Step 2: Select the target tool module in the smart toolbox management mechanism through the custom interface adaptation layer.
[0058] Step 31: Receive the structured task description generated in Step 1.
[0059] The secure invocation of intelligent tools driven by structured task descriptions revolves around an intelligent toolbox management mechanism, a unified custom interface adaptation layer, and an optimized MCP protocol. These components work together to ensure that the system can securely and efficiently invoke various local or remote tools within the domestic open-source Kylin operating system environment to execute the structured task descriptions generated in step 1, thereby enabling flexible and diverse operation execution.
[0060] The intelligent toolbox management mechanism is the core of this solution's adaptation and optimization. This mechanism integrates diverse online / offline servers, executors, and specialized tools, and has been deeply optimized for the ecosystem of the domestic Kylin operating system. This mechanism provides centralized management and coordination of all available tools, ensuring the system can flexibly select and schedule appropriate tools based on structured task descriptions. For example, for tasks requiring specific hardware acceleration, the system can intelligently identify and invoke the corresponding executor; while for data queries or network communication, online / offline servers can be utilized, including common network services as well as the offline data processing capabilities unique to the domestic Kylin operating system. This refined management enables the system not only to handle routine tasks but also to efficiently cope with complex and ever-changing application scenarios within the domestic Kylin operating system environment, fully leveraging its domestic advantages.
[0061] Step 32: Select and send execution instructions to the target tool module through a custom interface adaptation layer and an optimized MCP protocol.
[0062] A unified custom interface adaptation layer serves as the connection solution between the intent parsing module (step 1) and the intelligent toolbox. The traditional MCP protocol itself has the advantage of being a unified protocol, capable of handling common operations such as web search. These operations have minimal differences across different operating systems and typically require no special adaptation. However, when these common protocols are applied to domestic operating systems like Kylin OS, which have unique architectures and desktop environments (such as UKUI), their limitations become apparent. For example, for system operations like "opening system settings," which heavily rely on the operating system's underlying APIs and desktop environment components, the original MCP protocol often fails to adapt or some tools and executors cannot function properly. To address these compatibility challenges unique to Kylin OS, this solution designs a unified custom interface adaptation layer. This adaptation layer is the key bridge connecting the intent parsing module and the intelligent toolbox. It is responsible for receiving structured task descriptions from the intent parsing module and converting them into instructions understandable by tools within the Kylin OS environment.
[0063] Step 33: The target tool module executes the task according to the execution instruction and generates the corresponding execution result.
[0064] This adaptation layer is responsible for receiving structured task descriptions from the intent parsing module and converting them into instructions understandable by tools within the domestic operating system Kylin. This means that for general operations, the adaptation layer can use or simplify the original MCP protocol's calling logic; however, for system operations specific to the domestic operating system Kylin, it performs deeply customized adaptation, intelligently identifying and processing the instruction sets, APIs, and file paths unique to the domestic operating system Kylin, thereby ensuring that even tools designed for other environments can be correctly mapped and executed under the action of the adaptation layer. For example, when the intent parsing module recognizes that the user needs to "open system settings," the adaptation layer will convert it into a specific calling command for that desktop environment based on the characteristics of the UKUI desktop environment of the domestic operating system Kylin, rather than simply applying general instructions.
[0065] Step 34: The execution result is used as input for subsequent steps, and is further processed and optimized in step 4.
[0066] The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description.
[0067] The optimized MCP protocol is the underlying communication protocol for tool selection and execution. It has been deeply optimized for the system architecture and network environment of the domestic operating system Kylin, and is responsible for efficiently selecting local or remote tool modules to execute specific operations based on structured task descriptions. This optimized protocol achieves low-latency and high-reliability communication while ensuring security. For example, when executing tasks requiring remote server collaboration, the MCP protocol can intelligently select the nearest available server compatible with the domestic operating system Kylin, ensuring the integrity and security of data transmission. This optimization makes the system perform exceptionally well in handling distributed tasks within the domestic operating system Kylin environment. Whether interacting with domestic databases, cloud computing platforms, or other domestically developed software and hardware, it significantly improves operational efficiency and user experience, ensuring the independent controllability of the domestic operating system. The execution of this step will produce the raw results of the tool or executor's operations, which will serve as input for the next step of result collection.
[0068] Step 3: In the target tool module, the structured task description is executed by issuing execution instructions through the optimized MCP protocol to obtain the execution result corresponding to the target tool module.
[0069] Step 41: Select and send execution instructions to the target tool module through the custom interface adaptation layer and the optimized MCP protocol.
[0070] After a tool or executor called by the custom unified interface adaptation layer completes its task in the domestic Kylin operating system environment, the system immediately initiates an efficient result collection mechanism. A typical example is searching for "Word documents created today": First, a time tool returns the current date; then, a file management tool opens a file search interface; finally, a file system executor searches for and returns a list of Word documents that meet the criteria. During this process, the system captures execution results in parallel from local applications within the domestic Kylin operating system (such as the output of the time tool and the file list from the file system executor) and possibly from remote services (if a network connection is available, such as metadata from a cloud-based document synchronization service) via an optimized MCP protocol. These diverse results are then initially processed.
[0071] Step 421: Receive the structured task description passed through the custom interface adaptation layer.
[0072] After the tools or executors invoked by the custom unified interface adaptation layer complete their tasks in the domestic Kylin operating system environment, the system immediately initiates an efficient result collection mechanism. In step 421, the system receives and processes the structured task description generated in step 1 through the custom interface adaptation layer. This step is crucial for the system to begin executing the task, ensuring that the task input is passed to the system through the adaptation layer. The adaptation layer acts as a bridge in this process, ensuring the effective reception of the task description for subsequent analysis and processing.
[0073] Step 422: Analyze the task types in the structured task description.
[0074] A typical example is finding "Word documents created today": First, a time tool returns the current date; then, a file management tool opens a file search interface; finally, a file system executor finds and returns a list of Word documents that match the criteria. In step 422, the system needs to analyze the task type in the structured task description and select the appropriate processing method based on the different requirements of the task. The example "finding Word documents created today" demonstrates the requirements of different types of tasks. By analyzing the structured description of the task, the system determines whether to perform a data query task or a file management task, thereby ensuring that the system can flexibly handle various task requirements.
[0075] Step 423: Select the appropriate execution tool module.
[0076] The system concurrently captures execution results from local applications within the domestically developed Kylin operating system (such as the output of time tools and file lists from file system executors) and, if a network connection is available, from remote services (such as metadata from cloud document synchronization services). In step 423, the system selects the most suitable tool module for executing the task based on the task type and available tool modules. The system considers both local tools and remote services to obtain the required execution results. Specifically, the system may select local time tools and file management tools, or, if a good network connection is available, call cloud services or other remote tool modules to execute the task. This selection process ensures the efficiency and accuracy of task execution.
[0077] Step 424: Generate the corresponding execution instructions according to the requirements of the task.
[0078] The diverse results will be initially processed. In step 424, the system generates specific execution instructions based on the task requirements. "Diverse results" refers to the system integrating the input results from different tool modules to generate a unified execution instruction. These instructions will be passed to the target tool module to ensure that each module can complete the task according to these instructions.
[0079] Step 425: The execution instructions are sent to the target tool module through the optimized MCP protocol.
[0080] This application possesses the capability to prioritize the use of domestically developed toolkits and executors on the Kylin operating system for task processing even in a completely offline state, ensuring the continuity and confidentiality of core functions. Step 425 involves sending execution instructions to the target tool module via the optimized MCP protocol. In this process, the MCP protocol ensures low-latency and high-reliability data transmission and can intelligently select between local and cloud-based tools based on network conditions. In offline mode, the system prioritizes the use of local tools to guarantee task processing continuity and data privacy. This mechanism ensures stable system operation in any network environment and allows for optimization based on actual conditions.
[0081] Step 426: Confirm that the execution command has been successfully received and prepare for execution.
[0082] The system intelligently considers using online servers or cloud-based toolkit executors to process tasks only when a stable network connection is detected, leveraging their greater computing power or richer data resources. In step 426, the system confirms successful receipt of the execution command by checking the network status and makes corresponding decisions based on the network conditions. If the network connection is stable, the system switches to cloud or remote service tools to utilize more powerful computing resources and data support. In the event of an unstable network or offline status, the system prioritizes local resources to ensure smooth task execution in any environment.
[0083] Step 42: The target tool module executes the task according to the execution instruction and generates the execution result.
[0084] The key to this step lies in its dynamic network status monitoring and intelligent mode decision-making capabilities. The system adaptively assesses the current network connection status in real time. In confidential scenarios, many office machines are not allowed to connect to the internet, and most of these locations commonly use the domestically developed Kylin operating system. This solution has the ability to prioritize using the local toolbox and executors of the Kylin operating system to handle tasks even when completely offline, ensuring the continuity and confidentiality of core functions. Only when a stable network connection is detected will the system intelligently consider using online servers or cloud-based toolbox executors to handle tasks, leveraging their more powerful computing capabilities or richer data resources. This mechanism ensures that the system can run freely in both network-connected and offline environments, meeting the operational needs of different scenarios. This is the unique and necessary advantage of this invention's solution in a domestically developed operating system environment. The output of this step is the execution result, initially formatted and filtered according to network status, which will serve as the input for the next step of large-scale model inference.
[0085] Step 4: Based on the execution result and the current network status, select either the cloud or local large model to optimize the execution result, and feed the optimized execution result back to the front-end user interface.
[0086] The tool module includes a local executor, a cloud service, and a hardware-accelerated executor. The custom interface adaptation layer is also used to dynamically schedule and select the target tool module according to task requirements.
[0087] Step 51: Receive the execution result generated by the target tool module in step 3.
[0088] This step first activates an intelligent results integration engine to deeply fuse and refine the captured multi-source data. For example, for a task like "finding Word documents created today," the integration engine will associate the discrete information—such as the current date, the running status of the file search tool, and a specific list of Word documents—to form a unified and logical result set.
[0089] In step 51, the system receives the execution results generated by the target tool module. These results are typically information from multiple sources (such as date, file status, file list, etc.). The system then activates an intelligent result integration engine to merge and integrate this data into a unified and logically clear result set.
[0090] Step 52: Based on the current network status, make dynamic decisions and choose to use either a local large model or a cloud-based large model to optimize the results.
[0091] The integrated result set will be used as input to the large model for secondary inference. This is a crucial intelligent decision point: based on the network status dynamically monitored in step 3, the system intelligently selects whether to call the cloud-based large model or the local large model on the domestic operating system, Kylin. In step 52, the system decides whether to use the local or cloud-based large model for result optimization based on the network status dynamically monitored in step 3. This decision point is intelligent, ensuring the selection of the most suitable resources for processing under the network environment by dynamically detecting network connectivity.
[0092] Step 53: Optimize the execution results using the selected large model.
[0093] When connected to the network, the system prioritizes using the large cloud-based model to leverage its superior computing power and richer knowledge base. However, considering that the domestic operating system Kylin typically does not allow network access in classified scenarios, or when offline, the system seamlessly switches to the locally deployed large model on the domestic Kylin operating system to ensure task continuity and data security. This is a significant advantage of this solution in a domestic operating system environment. In step 53, based on the network status decision made in the previous step, the system optimizes the execution results using the selected large model (local or cloud). The cloud-based large model typically has more powerful computing capabilities and a richer knowledge base, while in unstable network or classified scenarios, the local large model will be selected to ensure task continuity and data security.
[0094] Step 531: Analyze the type of execution result.
[0095] The integrated result set will be used as input to the larger model for secondary inference. Step 531 involves analyzing the execution results and identifying their types. Based on the integrated result set, the system will determine the types of tasks requiring further optimization, thereby deciding on the specific direction of optimization.
[0096] Step 532: Select the most suitable large model based on the network state.
[0097] Based on the network status dynamically monitored in step 3, the system intelligently selects between calling the cloud-based large model or the local large model of the domestic operating system, Kylin. Step 532 further refines the decision based on network status monitoring, intelligently selecting the most suitable large model. According to the real-time network conditions, the system decides whether to use the cloud-based large model for efficient computation or switch to the local model to ensure operational stability and data privacy.
[0098] Step 533: Start the selected large model and perform in-depth optimization.
[0099] When connected to the network, the system prioritizes utilizing the large cloud-based model to leverage its more powerful computing capabilities and richer knowledge base. Step 533 describes the process of launching the selected large model and initiating deep optimization of the execution results. The system utilizes the capabilities of the selected model to perform complex calculations and task inference to optimize the execution results of the user's request.
[0100] Step 534: Integrate the optimization results to ensure that the optimized results meet the user's needs.
[0101] After the large model inference is completed, the complex results are transformed into user-friendly natural language feedback. For example, if a user requests "turn on Bluetooth," once Bluetooth is successfully turned on, the system will not only perform the operation, but the large model will also generate a clear prompt message such as "Bluetooth has been successfully turned on," which will be displayed to the user in real time through the front-end interface. In step 534, the system integrates the results of the large model inference to ensure that the optimized results meet the user's needs. Through the large model's inference, the system transforms complex task results into natural language feedback that is easy for users to understand, and then displays it in the final form.
[0102] Step 535: Pass the optimized execution result to the front-end user interface.
[0103] Finally, through inference on a large model (local or cloud), the results are fed back to the front-end user interface in a concise and user-friendly manner in real time. Step 535 is the process of displaying the optimized execution results to the front-end user interface in real time using user-friendly natural language feedback. Ultimately, the system will clearly present the operation result to the user through the optimized inference results, thus completing the task feedback.
[0104] Step 54: Feedback the optimized execution results to the front-end user interface in real time to complete the task feedback.
[0105] Finally, the optimized execution result is fed back to the front-end user interface in real time, completing the task feedback. Step 54 further confirms step 535, ensuring that the optimized execution result is ultimately displayed to the user through the front-end user interface, completing the entire task feedback process. The system uses this step to complete task execution and user interaction, providing a good user experience.
[0106] In summary, Embodiment 2 of the invention achieves intelligent task processing and efficient scheduling within the domestic Kylin operating system environment through a custom interface adaptation layer and an optimized MCP protocol. Through intelligent task routing, the system can select between local or cloud-based large models based on task type and flexibly invoke specific tools and APIs of the domestic Kylin operating system, thereby ensuring accurate task execution and efficient processing. The optimized MCP protocol guarantees low-latency and high-reliability communication between the large model and tool modules, ensuring smooth task execution under different network environments. The system has a network status monitoring function, dynamically switching operating modes based on network connectivity. When the network is stable, cloud resources are prioritized; when offline or with an unstable network, it switches to local mode, ensuring the continuity of task execution and data security. Furthermore, the system performs secondary inference optimization on the large model and provides the optimized results to the user in concise and user-friendly natural language, improving the user experience. Through this series of technological innovations, Embodiment 2 significantly improves the adaptability, efficiency, and stability of the domestic Kylin operating system in complex task execution, particularly excelling in handling network environment changes and tool scheduling.
[0107] Example 3 Figure 2 This is a schematic diagram of the overall architecture design of the adaptation system corresponding to this invention. Figure 2 This application demonstrates the overall architecture of the MCP technology adaptation and optimization system for the domestically developed Kylin operating system. The system's workflow begins with the user inputting natural language through the interface. First, it enters the "User Command Intent Parsing and Recognition Module." This module dynamically selects between a local or cloud-based large-scale model for task parsing based on network conditions, and combines this with the MCP protocol to parse the command intent, ultimately outputting a structured task. Next, the core "Unified Custom Interface Adaptation Layer" receives the structured task and, through intelligent scheduling, flexibly calls various tool modules from the "Intelligent Toolbox," including online / offline tools and tools specifically designed for the domestically developed Kylin operating system, ensuring smooth task execution under different conditions.
[0108] During task execution, the results are further processed and optimized through the "Result Collection and Processing Module." Finally, the system uses the "Result Integration and Feedback Module" to call the large model again, generating user-friendly natural language feedback, which is then displayed to the user in real time through the front-end interface. All modules of the system run on the domestically developed Kylin operating system, ensuring efficient adaptability and dynamic scheduling capabilities to flexibly respond to various user needs while guaranteeing data security and privacy protection. Figure 2 It clearly demonstrates the application of MCP technology in the domestic operating system Kylin, showing how multi-level intelligent scheduling and large-scale model optimization can achieve efficient task processing and real-time feedback, greatly improving the system's intelligence level and user experience.
[0109] Figure 3 This is a flowchart illustrating the main workflow of the system provided in this application for processing user commands. The process begins with the user inputting a natural language command. The first step involves the "User Command Intent Parsing and Recognition" module. The system selects between a local or cloud-based large model based on the current network status and uses MCP technology to parse the user command, ultimately generating a structured task description. Next, in the second step, "Secure Invocation of Customized Unified Interface Intelligent Tools," the unified customized interface adaptation layer receives the task description and intelligently selects suitable tool modules from the "Intelligent Toolbox." These tool modules include both specific operating tools for the domestic Kylin operating system and general operating tools, ensuring efficient and secure task execution.
[0110] The third step, "Execution Result Collection and Preliminary Processing," involves the system collecting execution results from the tool modules and dynamically deciding the system's operating mode based on network conditions. If the system is in offline mode, local tools are prioritized for task processing; if the network connection is stable, the system can utilize cloud resources to improve processing efficiency. Finally, in the fourth step, "Result Integration, Large Model Inference, and User-Friendly Feedback," the system integrates the collected results and performs inference again using a large model to generate the final optimized result. This result is then presented to the user in real-time through the front-end user interface in a user-friendly natural language format, ensuring that the user receives clear and accurate information. Figure 3 It clearly presents the entire process from user input commands to final feedback results, demonstrating how to improve the system's intelligence level through MCP technology, a unified interface adaptation layer, and intelligent reasoning and optimization of large models, ensuring the system's flexibility and efficiency under various network conditions, and providing users with a more user-friendly interactive experience.
[0111] Figure 4 This is a detailed diagram illustrating the unified custom interface adaptation layer of this invention. Figure 4This paper details the internal workings of the unified "Custom Interface Adaptation Layer," a core component of this application. Upon receiving a structured task generated by the intent parsing module, this layer first identifies the task's characteristics through its internal "Task Type Judgment / Distribution Logic" module and processes and distributes the task accordingly. If the task is a general operation, the system directs it to the "General MCP Protocol Processing Unit," which uses the optimized MCP protocol for efficient interaction with tools. For operations specific to the domestic Kylin operating system requiring specific processing, the system delegates the task to the "Domestic Kylin Operating System-Specific API / Instruction Adaptation Unit." This unit is responsible for calling the native interfaces of the domestic Kylin operating system, ensuring that the task can be executed smoothly within the unique environment of the domestic Kylin operating system.
[0112] The key advantage of this design lies in its intelligent task classification and distribution mechanism, which enables compatibility and efficient management of various heterogeneous tools and the domestic Kylin operating system environment. In this way, the system can not only handle common general tasks but also seamlessly adapt to the unique system operations of the domestic Kylin operating system, ensuring that different types of tasks are executed promptly and accurately. This innovative design improves the system's flexibility and scalability, enabling it to operate efficiently in diverse application scenarios.
[0113] Figure 5 This diagram illustrates the online / offline dynamic switching mechanism of the system provided in this application. The system uses a "network status monitoring module" to monitor the current network connection status in real time. When the network is stable, the system switches to "online mode," where it can utilize the large cloud model and remote servers, leveraging their powerful computing capabilities and abundant resources to execute tasks. Conversely, when the network is disconnected or unstable, or when offline operation is required by system policy, the system automatically switches to "offline mode," prioritizing the use of local large models and tools for task processing, ensuring data security and the continuous availability of core functions. This switching mechanism ensures that the system can flexibly respond to various task requirements regardless of whether there is a network connection or not, especially in environments using the domestically developed Kylin operating system, maximizing system stability and reliability.
[0114] When the adaptation layer receives a structured task, it first makes a crucial judgment: "Does the task require specific processing by the domestic operating system Kylin?" If the judgment is "yes," the task will flow to the specific processing path of the domestic operating system Kylin and call the corresponding adaptation unit and instructions; if the judgment is "no," the task will be processed according to the general process, and the system will interact with the tool through the optimized MCP protocol. This decision-making process ensures that tasks can be intelligently distributed according to type and requirements, effectively handling different task types and ensuring the efficiency and flexibility of task execution. Finally, the processing results under different paths will be returned and summarized to the system, ensuring that user needs are responded to in a timely and accurate manner.
[0115] Example 4
[0116] The following provides illustrative examples of the execution code for key steps.
[0117] Text 1 is the pseudocode (Python implementation) of the task routing logic of the unified custom interface adaptation layer of this invention, as follows: def is_openkylin_specific_task(task_attributes): """Help function to determine if a task is a specific openKylin operation (example)"" The actual judgment logic will be more complex, possibly checking keywords, target APIs, etc. Return"kylin_specific_flag"in task_attributes or task_attributes.get("target_os") == "openKylin" def route_task_to_executor(structured_task): """ Adaptation layer core routing function structured_task: An object or dictionary containing information such as task type, target, and parameters. """ task_attributes=structured_task.get("attributes",{}) if is_openkylin_specific_task(task_attributes): #If it's a specific operation in OpenKylin print(f"task'{structured_task.get('name')}'->openKylin specific executor") #result=call_kylin_specific_executor(structured_task.get("kylin_command"),structured_task.get("params")) result=f"Executed Kylin-specific:{structured_task.get('name')}"# Simulate execution else: #If it's a general operation print(f"Task'{structured_task.get('name')}'->Generic MCP Executor") #result=call_generic_mcp_executor(structured_task.get("mcp_command"),structured_task.get("params")) result=f"Executed Generic MCP:{structured_task.get('name')}"# Simulate execution return result Here's an explanation of some key execution steps in the code. The helper function `is_openkylin_specific_task(task_attributes)` determines whether a task is an OpenKylin-specific operation. It makes this determination by checking if the task attributes contain a specific flag (such as "kylin_specific_flag") or if the target operating system is "openKylin". `route_task_to_executor(structured_task)` is the core routing function of the adaptation layer, responsible for determining which executor to assign the task to based on its structured information. First, it extracts the task's attributes from the incoming structured task, then calls `is_openkylin_specific_task()` to determine if the task is an OpenKylin-specific operation. If so, the task is assigned to an OpenKylin-specific executor; otherwise, it is passed to the generic MCP executor. After determining the executor, the system simulates task execution, processing the task using either the `call_kylin_specific_executor` or `call_generic_mcp_executor` function and returning the result. The current code uses the string "result" to simulate the execution result; in actual applications, the corresponding execution function will be called.
[0118] In short, the code snippet in Text 1 simulates how the "Unified Custom Interface Adaptation Layer" in this invention intelligently selects the executor based on the task type and achieves efficient task execution through the optimized MCP protocol. For openKylin-specific operations, the system calls the executor unique to the domestic operating system Kylin, ensuring good compatibility with the Kylin environment. For other general tasks, the system uses the MCP protocol to schedule general executors, ensuring seamless connection and execution of tasks across different tools.
[0119] Text 2 contains the pseudocode (Python implementation) of the intent parsing logic for intelligently selecting a large model in this invention, as follows: #Hypothetical system state acquisition function def get_current_system_status(): #Simulates returning system status; in reality, it will be dynamically obtained. #return{"network":"offline","task_complexity":"high"} return{"network":"online","task_complexity":"high","cloud_service_ok":True} #return{"network":"online","task_complexity":"low","cloud_service_ok":True} def select_llm_for_intent_parsing(user_command_text): """ Intelligent selection of LLM for intent parsing user_command_text: The original text entered by the user. """ status=get_current_system_status() llm_type_selected=None llm_config={} if status["network"]=="offline": llm_type_selected="local_llm" llm_config={"model_name":"local_default_model","reason":"Networkoffline"} elif status["network"]=="online"and status.get("cloud_service_ok"): if status["task_complexity"]=="high": llm_type_selected="cloud_llm" llm_config={"model_name":"cloud_advanced_model","reason":"Online,highcomplexity"} else:#task_complexity is low or medium llm_type_selected="local_llm" # Or select a lightweight cloud model llm_config={"model_name":"local_fast_model","reason":"Online,low / medium complexity,prefer local / fast"} else: # Online but cloud service is poor or unknown status llm_type_selected="local_llm" llm_config={"model_name":"local_fallback_model","reason":"Fallback orunstable cloud"} print(f"Command:'{user_command_text}'->Select LLM:{llm_type_selected}(Configuration:{llm_config})") #structured_intent=call_actual_llm(llm_type_selected,llm_config,user_command_text) structured_intent={"intent":"parsed_intent_for_"+user_command_text,"llm_used":llm_type_selected}#Simulation parsing return structured_intent Here's an explanation of some key execution steps in the code. The `get_current_system_status()` function simulates returning system status information, including network connectivity, task complexity, and cloud service status. It dynamically selects the appropriate large model for task processing based on the current system status. `select_llm_for_intent_parsing(user_command_text)`: This is the core function for intelligently selecting the large model for intent parsing. It first obtains the system status using `get_current_system_status()`, then selects the most suitable large model based on network status, task complexity, and cloud service status. If the network is offline, the local large model is selected; if the network is online and the cloud service is normal, and the task complexity is high, the cloud-based large model is selected; if the task complexity is low, the local large model is used first to improve processing speed. If the network is unstable or the cloud service is unavailable, it falls back to the local large model. The output function ultimately returns a simulated structured intent, indicating that the user's command has been parsed and the appropriate large model has been selected for processing.
[0120] In short, the code in text 2 simulates how to intelligently select a large model for task parsing based on the system's actual state (network connectivity, task complexity, etc.). This aligns with the technical solution of this invention, where the system can automatically switch to a local large model when the network is unstable or cloud services are unavailable, thus ensuring the stability and continuity of task execution. Conversely, when cloud services are available and task complexity is high, the system will prioritize using the cloud-based large model to ensure efficient task processing.
[0121] Text 3 contains the pseudocode (Python implementation) of the dynamic network detection module logic of this invention, as follows: #Global state (simplified; in practice, it may be managed through classes or modules) SYSTEM_NETWORK_STATUS="offline"#Optional: "offline", "online", "forced_offline" FORCED_OFFLINE_POLICY=False # Whether the policy forces offline activity # Simulate low-level network test functions def _ping_gateway(): #print("Pinging gateway...") #A ping operation will actually be performed. return True or False def _check_critical_services(services_to_check): #print(f"Checking critical services:{services_to_check}...") #In practice, we will try to connect to each service. #for service in services_to_check: #if not is_reachable(service):return False return True or False def update_and_broadcast_network_status(new_status): "Update global state and simulate broadcast events" global SYSTEM_NETWORK_STATUS if SYSTEM_NETWORK_STATUS!=new_status: SYSTEM_NETWORK_STATUS=new_status print(f"EVENT:NetworkStatusChanged->{SYSTEM_NETWORK_STATUS}") return SYSTEM_NETWORK_STATUS def check_current_network_status(): """Core Network State Inspection Functions""" if FORCED_OFFLINE_POLICY: return update_and_broadcast_network_status("forced_offline") if not _ping_gateway(): return update_and_broadcast_network_status("offline") #The assumed list of key services should actually be read from the configuration. critical_services=["cloud_llm_api","online_tool_server"] if not _check_critical_services(critical_services): The basic network is working, but critical services are down, which may be equivalent to the system being offline. Return `update_and_broadcast_network_status("offline")` or `"online_limited"` if your system supports it. return update_and_broadcast_network_status("online") This section explains some key execution steps in the code. The functions `_ping_gateway()` and `_check_critical_services()` simulate network status checks. `_ping_gateway()` checks if the network gateway is reachable, determining if the network is functioning correctly; `_check_critical_services()` checks if critical services (such as cloud-based LLMAPI, online tool servers, etc.) are available, classifying them as offline if unavailable. The function `update_and_broadcast_network_status(new_status)` updates and broadcasts the network status. If the network status changes (e.g., switching from online to offline), the system updates the global network status and notifies other modules. `check_current_network_status()` is the core function, determining the current network status based on the system's network connectivity and policies. If the network is unreachable or critical services are unavailable, the system sets the status to offline; if the network recovers and services are functioning correctly, the system sets the status to online. This function uses `_ping_gateway()` and `_check_critical_services()` to determine the current network status and updates it accordingly as needed.
[0122] In short, the code snippet in text 3 demonstrates the dynamic network detection function in this invention. The system determines whether to switch to offline or online mode by monitoring the network status in real time. If the network is disconnected or unstable, the system will switch to offline mode according to a strategy, prioritizing the use of local tools and large models for task processing; when the network is restored and critical services are available, the system will switch back to online mode, utilizing cloud resources for task execution. This dynamic switching mechanism ensures the system's flexibility and reliability under different network environments.
[0123] In summary, the code examples provided in this embodiment implement the key technical functions of this invention under the domestically developed Kylin operating system environment, including a unified task routing mechanism, intelligent large model selection and intent parsing, and a dynamic network status monitoring and switching mechanism. These technical implementations not only support efficient task execution and optimization but also ensure the stability and flexibility of the system under different network environments, thereby improving the overall user experience.
[0124] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0125] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0126] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for MCP adaptation to an operating system's intelligent engine, characterized in that, The method includes: The process involves preprocessing natural language commands input by the user through an interface to obtain a structured task description. This preprocessing includes: acquiring the natural language commands input by the user through the interface; intelligently selecting a large model for local or cloud deployment based on the current network status, task complexity, and available resource servers; performing deep semantic understanding and intent recognition on the natural language commands using the selected large model; generating a structured task description based on the results of the deep semantic understanding and intent recognition; and using a custom interface adaptation layer to transmit the structured task description to the intelligent toolbox management mechanism via an optimized MCP protocol. Through a custom interface adaptation layer, a target tool module is selected in the intelligent toolbox management mechanism. The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description. The tool module includes a local executor, a cloud service, and a hardware-accelerated executor. The custom interface adaptation layer is also used to dynamically schedule and select the target tool module according to task requirements. In the target tool module, the structured task description is executed by issuing execution instructions through the optimized MCP protocol, and the execution result corresponding to the target tool module is obtained. Based on the execution results and the current network status, the execution results are optimized using either a cloud-based or local large model, and the optimized execution results are then fed back to the front-end user interface.
2. The method according to claim 1, characterized in that, In the target tool module, the structured task description is executed by issuing execution instructions through the optimized MCP protocol to obtain the execution result corresponding to the target tool module, including: By using a custom interface adaptation layer and the optimized MCP protocol, execution instructions are selected and sent to the target tool module. The target tool module executes the task according to the execution instruction and generates the execution result.
3. The method according to claim 1, characterized in that, Based on the execution result and the current network status, the process of selecting a cloud-based or local large model to optimize the execution result and then feeding the optimized result back to the front-end user interface includes: Receive the execution results generated by the target tool module; Based on the current network status, dynamic decisions are made to select whether to use a local large model or a cloud-based large model to optimize the results. The execution results are optimized using the selected large model; The optimized execution results are fed back to the front-end user interface in real time, completing the task feedback.
4. The method according to claim 2, characterized in that, The step of selecting and issuing execution instructions to the target tool module through a custom interface adaptation layer and the optimized MCP protocol includes: Receive the structured task description passed through the custom interface adaptation layer; Analyze the task types in the structured task description; Select the appropriate execution tool module; Generate corresponding execution instructions based on the requirements of the task; The optimized MCP protocol is used to send execution instructions to the target tool module; The execution command has been successfully received and is ready to be executed.
5. The method according to claim 3, characterized in that, The optimization of the execution results using the selected large model includes: Analyze the types of execution results; Select the most suitable large model based on the network state; Launch the selected large model for in-depth optimization; Integrate the optimization results to ensure that the optimized results meet user needs; The optimized execution results are then passed to the front-end user interface.
6. An MCP adapter device for an operating system's intelligent engine, characterized in that, The device includes: The preprocessing module is used to preprocess the natural language commands input by the user through the interface to obtain a structured task description. It is also used to: acquire the natural language commands input by the user through the interface; intelligently select a large model for local or cloud deployment based on the current network status, task complexity, and available resource servers; perform deep semantic understanding and intent recognition on the natural language commands using the selected large model; generate a structured task description based on the results of the deep semantic understanding and intent recognition; and use a custom interface adaptation layer to transmit the structured task description to the intelligent toolbox management mechanism through an optimized MCP protocol. The tool selection module is used to select a target tool module in the intelligent toolbox management mechanism through a custom interface adaptation layer. The custom interface adaptation layer is used to automatically retrieve and call the tool module most suitable for executing the structured task description. The tool module includes a local executor, a cloud service, and a hardware-accelerated executor. The custom interface adaptation layer is also used to dynamically schedule and select the target tool module according to task requirements. The task execution module is used in the target tool module to execute the structured task description by issuing execution instructions through the optimized MCP protocol, and obtain the execution result corresponding to the target tool module. The result optimization module is used to optimize the execution result based on the execution result and the current network status, selecting a large model in the cloud or on the local network, and then feeding back the optimized execution result to the front-end user interface.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement an MCP adaptation method for an operating system intelligent engine as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Operation system user intention processing method and device based on local large model and storage medium
CN119884340A
Cloud environment intelligent operation and maintenance method and system based on MCP protocol
CN120639769A