An edge computing terminal information query method and agent based on LLM and MCP protocols

By introducing a large language model and the MCP protocol for edge computing terminal information querying, the fragmentation problem of edge computing terminal operation and maintenance management is solved, achieving efficient, secure, and intelligent information querying, and adapting to the real-time and long-term operation and maintenance needs of industrial scenarios.

CN120892447BActive Publication Date: 2026-01-23NANJING NANZI INFORMATION TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511393982.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2026-01-23
Estimated Expiration
2045-09-28

AI Technical Summary

Technical Problem

In existing technologies, the operation and maintenance management of edge computing terminals is highly fragmented, resulting in complex operation and maintenance system integration, long development cycles, high maintenance costs, and low efficiency of manual query methods. It cannot meet the high requirements for real-time and continuity in industrial scenarios, and it is difficult to achieve cross-round, multi-target query intent parsing and accurate information acquisition.

Method used

An edge computing terminal information query method based on LLM and MCP protocols is adopted. The natural language query request is semantically parsed through a large language model. Combined with historical conversations and domain knowledge base, a structured query instruction is generated. The MCP client and server are used for authentication and tool interface calls. It supports free question and answer and timed query modes to achieve intelligent and secure information acquisition.

Benefits of technology

It significantly improves the efficiency, accuracy, and security of information retrieval on edge computing terminals, can understand users' multi-objective needs and implicit intentions, generate natural language answers, support real-time interaction and periodic monitoring, form a closed-loop intelligent query system, reduce the operation and maintenance threshold, and improve adaptability and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120892447B_ABST
    Figure CN120892447B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of edge computing device operation and maintenance in industrial scenarios, and specifically relates to an edge computing terminal information query method and an intelligent agent based on LLM and MCP protocols. The present application simultaneously supports a free question and answer mode and a timing query mode, the former satisfying the user's temporary and interactive information acquisition needs, and the latter being suitable for periodic and automated index collection and monitoring, thereby taking into account both real-time query and long-term operation and maintenance scenarios. Through LLM, the semantic analysis and context modeling of natural language requests can understand the user's multi-target needs and implicit intentions, and when generating natural language answers, the tone, professionalism and context consistency can also be adjusted, significantly improving the user experience. The adoption of MCP combined with encryption token realizes the bidirectional authentication and communication encryption of the client and the server, ensuring the security of the query process and the reliability of the result data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of edge computing device operation and maintenance technology in industrial scenarios, specifically involving an edge computing terminal information query method and intelligent agent based on LLM and MCP protocols. Background Technology

[0002] With the deep integration of edge computing, IoT, and AI technologies with the industrial sector, edge computing technology is being increasingly widely applied in industries such as power, manufacturing, and energy. Edge computing terminals are deployed at the network edge, close to the data source, enabling on-site data collection, processing, and preliminary analysis. This effectively reduces network overhead associated with data transmission to the cloud, meeting the urgent needs of industrial scenarios for real-time processing and low latency, and significantly improving the overall computing efficiency of the system.

[0003] However, with the rapid growth in the types and number of edge computing terminals, their operation and maintenance management faces severe challenges. Currently, the collection of operation and maintenance information for edge computing terminals is highly customized. Devices from different manufacturers and with different architectures (such as ARM and x86) often use different communication protocols, data formats, and interface specifications. Operation and maintenance personnel usually need to customize and develop dedicated information collection probes or API interfaces for different types of terminals. These customized programs also need to be adapted and debugged for the specific system environment of the terminal. This highly fragmented interface solution leads to complex operation and maintenance system integration, long development cycles, and high maintenance costs, seriously hindering large-scale deployment and widespread application.

[0004] In existing technologies, human querying or scripting methods require maintenance personnel to manually input commands or call fixed interfaces, which is time-consuming and inefficient. It cannot meet the high requirements for real-time and continuity in industrial scenarios, and it is difficult to understand users' natural language query requests. It also cannot combine historical conversations and domain knowledge to analyze query intent across rounds and multiple targets, resulting in inaccurate information acquisition. The interfaces provided by edge terminals are diverse and have differences. Traditional methods require manual judgment of calling methods and parameter matching, which is prone to errors and has high maintenance costs. It is difficult to achieve periodic task scheduling and parallel multi-task execution, and it has poor adaptability to large-scale, multi-terminal management scenarios. Summary of the Invention

[0005] The purpose of this invention is to provide an edge computing terminal information query method and intelligent agent based on LLM and MCP protocols, which can improve the efficiency, accuracy, intelligence and security of edge computing terminal information query by introducing LLM and MCP protocols.

[0006] The specific technical solution adopted by this invention is as follows:

[0007] A method for querying edge computing terminal information based on LLM and MCP protocols includes:

[0008] Receive query mode information, which includes free question and answer mode and timed query mode, and obtain the corresponding query request based on the query mode;

[0009] Based on a large language model, semantic parsing of query requests is performed to obtain the query intent of the target edge computing terminal;

[0010] The MCP client establishes a connection with the MCP server of the target edge computing terminal and completes authentication based on the encrypted token.

[0011] Obtain the description information of callable tool interfaces from the MCP server, and generate structured query instructions based on the query intent;

[0012] The MCP server executes structured query commands and returns structured result data;

[0013] The large language model processes the structured result data to generate query results that users can understand.

[0014] In one preferred embodiment, the free-response question-and-answer mode includes:

[0015] Users submit natural language query requests through the Agent client. LangChain combines the natural language query requests with predefined edge computing terminal IP address mapping table prompts to form enhanced prompts and passes them to LLM for intent parsing and task decomposition.

[0016] LLM extracts the target edge computing terminal IP based on the mapping table and identifies the metadata of the tools to be invoked.

[0017] LLM drives the MCP client to establish a connection with the target MCP server and completes SM2-based token generation and verification;

[0018] LLM generates JSON-formatted structured call parameters based on the metadata of the invoked tool and initiates a call to the server via the MCP protocol;

[0019] The MCP server executes the call and returns a structured result;

[0020] LLM integrates the structured results and generates readable natural language answers, which are then returned to the user through the Agent client.

[0021] In a preferred embodiment, in the free-response question-and-answer mode, after receiving a natural language query request, the contextual semantic model of the query content in the natural language query request is performed. Combining historical conversation content and domain knowledge base, the implicit intent and multi-objective needs across rounds are identified, and a multi-level query intent representation is generated during the parsing process. The multi-level query intent representation includes question category, entity object, target indicator and logical relationship.

[0022] In a preferred embodiment, in the free question-and-answer mode, during the tool metadata invocation stage, the obtained tool description information is automatically semantically mapped, a large language model is used to perform in-depth analysis of the tool functions and input / output parameters, and a candidate tool set is dynamically generated based on the semantic matching results.

[0023] In a preferred embodiment, in the free-response question-and-answer mode, during the natural language response generation stage, the structured results are transformed into natural language answers. Furthermore, a context enhancement mechanism and a prompt word optimization mechanism are introduced based on a large language model. The context enhancement mechanism is used to jointly model the current query results with the historical query results, while the prompt word optimization mechanism is used to adjust the tone, professionalism, and expression of the generated answer.

[0024] In a preferred embodiment, the timed query mode includes:

[0025] The client program triggers scheduled query tasks at preset time intervals based on the cron scheduling mechanism;

[0026] LangChain injects prompts for scheduled query tasks into its DAG execution engine, driving the LLM to generate enhanced query requests and driving the MCP client to retrieve metadata from the tool registry center from the MCP server.

[0027] The MCP client establishes a connection with the MCP server and completes SM2-based token verification. The MCP server executes data collection according to the enhanced query command and returns structured response data in Protocol Buffers serialization format.

[0028] LLM converts the returned structured response data into database write statements and stores them.

[0029] In a preferred embodiment, the cron scheduling mechanism in the scheduled query mode allows users to set task plans through a graphical interface. The task plan includes the query cycle, query objects, storage strategy, and alarm conditions.

[0030] In a preferred embodiment, during the scheduled query mode, the DAG execution engine injection stage is constructed using a Directed Acyclic Graph (DAG) structure. Each node represents a subquery task, and nodes are connected through data dependencies. The DAG structure can be dynamically expanded or shrunk at runtime and supports parallel execution of multiple nodes.

[0031] In a preferred embodiment, during scheduled query mode, the monitoring metrics obtained through MCP are stored in a MongoDB database in BSON format, and timestamps and task IDs are automatically added as index fields.

[0032] This invention also provides an intelligent agent for querying edge computing terminal information based on LLM and MCP protocols, used in the aforementioned method for querying edge computing terminal information based on LLM and MCP protocols, comprising:

[0033] The query receiving module is used to receive query mode information, which includes free question and answer mode and timed query mode, and obtain the corresponding query request based on the query mode;

[0034] The query intent module performs semantic parsing of query requests based on a large language model to obtain the query intent of the target edge computing terminal;

[0035] The authentication module is used to establish a connection between the MCP client and the MCP server of the target edge computing terminal, and to complete authentication based on the encrypted token.

[0036] The intent generation module is used to obtain the description information of callable tool interfaces from the MCP server and generate structured query instructions based on the query intent.

[0037] The structured results module is used by the MCP server to execute structured query commands and return structured result data;

[0038] The query results module is used by the large language model to process structured result data and generate query results that users can understand.

[0039] The technical effects achieved by this invention are as follows:

[0040] This invention simultaneously supports both free-response question-and-answer mode and scheduled query mode. The former satisfies users' temporary and interactive information acquisition needs, while the latter is suitable for periodic and automated indicator collection and monitoring, thus accommodating both real-time query and long-term operation and maintenance scenarios. By using LLM to perform semantic parsing and context modeling on natural language requests, it can understand users' multi-objective needs and implicit intentions. When generating natural language answers, it can also adjust the tone, professionalism, and contextual consistency, significantly improving the user experience. It uses MCP combined with encrypted tokens to achieve two-way authentication and communication encryption between the client and the server, ensuring the security of the query process and the reliability of the result data. LLM can automatically generate structured query instructions from tool description information and supports fault tolerance for missing parameters and input errors, improving adaptability in complex query environments. The two modes can be scheduled through a unified session management module. The query results of the free-response question-and-answer mode can trigger new scheduled tasks, and the historical data of scheduled queries can assist in answering free-response questions, thus forming a closed-loop intelligent query system with good scalability and application value. Attached Figure Description

[0041] Figure 1 This is a flowchart of the method provided by the present invention;

[0042] Figure 2 This is a module diagram provided by the present invention. Detailed Implementation

[0043] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0044] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0045] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in a preferred embodiment" appearing in different places throughout this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that mutually excludes other embodiments.

[0046] Furthermore, the present invention will be described in detail with reference to the schematic diagrams. When describing the embodiments of the present invention in detail, the schematic diagrams are merely examples for ease of explanation and should not limit the scope of protection of the present invention.

[0047] Please see the appendix Figure 1As shown, a method for querying edge computing terminal information based on LLM and MCP protocols is provided, including:

[0048] S1. Receive query mode information, including free question and answer mode and timed query mode, and obtain the corresponding query request based on the query mode;

[0049] S2. Based on the large language model, perform semantic parsing on the query request to obtain the query intent of the target edge computing terminal;

[0050] S3. Establish a connection with the MCP server of the target edge computing terminal through the MCP client, and complete the authentication based on the encrypted token;

[0051] S4. Obtain the description information of callable tool interfaces from the MCP server, and generate structured query instructions based on the query intent;

[0052] S5 and MCP servers execute structured query commands and return structured result data;

[0053] S6, the large language model, processes the structured result data to generate query results that users can understand.

[0054] As described in steps S1 to S6 above, query mode information is received. This information includes free-response query mode and scheduled query mode. When the user selects free-response query mode, the user inputs a natural language query request through the Agent client. The LangChain framework combines this request with predefined prompts and mapping table information to generate enhanced prompts, which are then sent to the LLM for parsing. When the user selects scheduled query mode, a query task is triggered periodically through a cron scheduling mechanism, generating the corresponding query request. The Large Language Model (LLM) performs semantic parsing on the received query request, extracting the query intent of the target edge computing terminal, including the question category, target object, etc. The required tool information and query logic relationships are defined. For the free-response question-and-answer mode, LLM can also combine contextual semantics, historical sessions, and knowledge bases to support complex intent parsing across rounds. The Model Context Protocol (MCP) client establishes a connection with the MCP server of the target edge computing terminal and completes authentication based on an encrypted token. The token is generated and verified using the SM2 national cryptographic algorithm to achieve two-way authentication and communication security. The LLM obtains the description information of the callable tool interfaces from the MCP server, automatically performs semantic mapping on the tool functions and input / output parameters, and dynamically generates the optimal tool call combination. Then, it constructs structured query instructions in JSON or Protocol Buffers format. The MCP server executes the corresponding query or collection operation according to the received structured query instructions and returns the results to the client in the form of structured data. In the timed query mode, the results are displayed using Protocol Buffers. Buffers are serialized for efficient transmission and subsequent storage. The large language model processes the returned structured results, combining context enhancement and prompt word optimization mechanisms to transform them into natural language results that are easy for users to understand, and then feeds them back to the user. In the scheduled query mode, the LLM also transforms the structured results into database write statements and stores them in MongoDB or other target databases. It supports both free-response question-and-answer mode and scheduled query mode. The former meets users' temporary and interactive information retrieval needs, while the latter is suitable for periodic and automated indicator collection and monitoring, thus accommodating both real-time query and long-term operation and maintenance scenarios. Through the LLM, natural language requests are processed... This system performs semantic parsing and contextual modeling to understand users' multi-objective needs and implicit intentions. When generating natural language answers, it can adjust tone, professionalism, and contextual consistency, significantly improving user experience. It employs MCP combined with encrypted tokens to achieve two-way authentication and encrypted communication between the client and server, ensuring the security of the query process and the reliability of the result data. LLM can automatically generate structured query instructions from tool description information and supports fault tolerance for missing parameters and input errors, improving adaptability in complex query environments. Both modes can be scheduled through a unified session management module; query results in the free-response mode can trigger new scheduled tasks.Historical data queried periodically can assist in answering free-response questions, thus forming a closed-loop intelligent query system with good scalability and application value.

[0055] In a preferred implementation, the open-ended question-and-answer mode includes:

[0056] Users submit natural language query requests through the Agent client. LangChain combines the natural language query requests with predefined edge computing terminal IP address mapping table prompts to form enhanced prompts and passes them to LLM for intent parsing and task decomposition.

[0057] LLM extracts the target edge computing terminal IP based on the mapping table and identifies the metadata of the tools to be invoked.

[0058] LLM drives the MCP client to establish a connection with the target MCP server and completes SM2-based token generation and verification;

[0059] LLM generates JSON-formatted structured call parameters based on the metadata of the invoked tool and initiates a call to the server via the MCP protocol;

[0060] The MCP server executes the call and returns a structured result;

[0061] LLM integrates the structured results and generates readable natural language answers, which are then returned to the user through the Agent client.

[0062] As described above, users submit natural language query requests through the Agent client. These requests often lack strict syntax and structured format. LangChain combines the user's natural language request with a predefined edge computing terminal IP address mapping table to generate an enhanced prompt input LLM. This allows the LLM to automatically associate the target terminal during parsing. Based on the enhanced prompt, the LLM performs intent parsing and task decomposition to identify the user's true query target. It then uses the mapping table to determine the specific terminal IP and related tool metadata to be accessed. The LLM drives the MCP client to establish a connection with the target MCP server, using the SM2 algorithm to generate and verify an encrypted token, thus ensuring communication security and the legitimacy of the user's identity. The LLM automatically generates structured call parameters in JSON format based on the tool metadata and initiates a call to the server via the MCP protocol, transforming the natural language request into machine-executable instructions. After executing the call, the MCP server returns structured result data. The LLM integrates, semantically transforms, and refines this result to generate... The system provides natural language responses tailored to user habits and returns them to the Agent client, achieving a seamless conversion from user natural language requests to JSON-formatted call parameters. Users can operate edge computing terminals without needing to master complex command syntax. Through automatic identification of IP address mapping tables and tool metadata, users do not need to worry about underlying terminal addresses and interface information, lowering the technical threshold for operation and maintenance. The introduction of the SM2 algorithm and encrypted token verification mechanism effectively ensures the communication security and data trustworthiness between the MCP client and the MCP server. The results are integrated and generated by LLM, automatically optimizing the readability, tone, and professionalism of the responses for a more natural and smooth user experience. It supports task decomposition and tool metadata matching, intelligently selecting appropriate interfaces or functional modules in complex operation and maintenance scenarios, improving the accuracy and automation of queries and operations. Based on LangChain, LLM, and MCP protocols, it has high scalability and can support different edge computing environments and future additions of tool interfaces.

[0063] In a preferred implementation, in the free-response question-and-answer mode, after receiving a natural language query request, the contextual semantic model of the query content in the natural language query request is performed. By combining historical conversation content and domain knowledge base, implicit intentions and multi-objective needs across rounds are identified, and a multi-level query intent representation is generated during the parsing process. The multi-level query intent representation includes question category, entity object, target indicator and logical relationship.

[0064] As described above, after a user submits a natural language query request, the query statement undergoes basic semantic understanding and keyword extraction. The current query is associated with historical conversation content, and LLM (Local Language Modeling) is used to model the dialogue context, identifying the contextual relationships between different rounds. A domain knowledge base is used as background information to assist in identifying technical terms, business objects, and their relationships. Through contextual semantic modeling, implicit needs that are not directly expressed by the user but are logically related can be discovered, such as the continuation of query goals across rounds, implicit parameter inheritance, and simultaneous requests for multiple goals. During the parsing process, a hierarchical intent representation is formed, including question categories (e.g., status queries, performance diagnostics, configuration retrieval), entity objects (specific edge computing terminals, modules, or resource objects), and target metrics (e.g., CPU usage). (Factors such as rate, memory consumption, network latency, etc.), logical relationships (constraints, parallel relationships, or conditional relationships between different objectives), and multi-level intent representation provide a semantic foundation for subsequent tool interface selection and structured query instruction generation, making the calling logic more accurate. Through context modeling, it can understand complex query requests across rounds and multiple objectives, avoiding omissions or misjudgments caused by single-round parsing. It can inherit contextual information from historical dialogues, so users do not need to repeatedly input clearly defined parameters, improving interaction efficiency. Through multi-level intent representation, queries are decomposed into categories, objects, indicators, and logical relationships, enabling complex problems to be processed systematically. Combined with a domain knowledge base, it can adapt to the specialized terminology of different industrial scenarios or professional fields, improving the professionalism and applicability of queries.

[0065] In a preferred implementation, in the free question-and-answer mode, during the tool metadata invocation stage, the obtained tool description information is automatically semantically mapped, a large language model is used to perform in-depth analysis of the tool functions and input / output parameters, and a candidate tool set is dynamically generated based on the semantic matching results.

[0066] The above describes the process of obtaining interface descriptions of currently available tools from the MCP server. This includes tool function descriptions, input parameters, output parameters, and constraints. A Large Language Model (LLM) is used to semantically parse the tool description text, transforming it into standardized semantic vectors. Simultaneously, a corresponding semantic vector is generated for the user's query intent. Similarity is calculated between the two using semantic matching methods. The LLM deeply understands the tool's functional boundaries, identifies the types of input parameters (e.g., strings, numbers, time series) and their logical constraints, and parses the semantic meaning and possible result formats of the output parameters, ensuring that the tool's output meets the user's query goals. Based on the semantic matching results, all callable tools are filtered to form a candidate tool set that matches the current query intent. If multiple tools meet the criteria, they can be dynamically sorted according to priority rules (e.g., functional coverage, parameter completeness, historical call success rate) for subsequent calling modules to select from. Automatic semantic mapping avoids errors caused by relying solely on keywords or fixed mapping rules, ensuring a high degree of alignment between tool functions and user intent. The dynamic generation of the candidate tool set supports parallel or combined calls, improving adaptability to complex, multi-objective tasks.

[0067] In a preferred implementation, in the free-response question-and-answer mode, during the natural language answer generation stage, the structured results are converted into natural language answers. Furthermore, a context enhancement mechanism and a prompt word optimization mechanism are introduced based on a large language model. The context enhancement mechanism is used to jointly model the current query results with the historical query results, while the prompt word optimization mechanism is used to adjust the tone, professionalism, and expression of the generated answer.

[0068] As described above, after executing a query through the MCP server, the obtained result data is structured data (such as JSON format). The Large Language Model (LLM) receives the structured data, parses the field content and its semantic relationships, and converts it into answer text that conforms to the expression habits of natural language. During the conversion process, the LLM can automatically supplement contextual information to make the answer more complete and easy to understand. The LLM jointly models the current query results with the content of historical query sessions, comparing the question categories, entity objects, indicators, etc. in the historical query records to identify potential continuous or related questions. When generating the answer, relevant historical information can be integrated so that the answer not only responds to the current query but also forms a coherent explanation or suggestion based on previous queries. Users or the system can preset prompt word strategies, including answer tone, professionalism, and conciseness. To meet requirements such as clarity, LLM automatically adjusts the style and presentation of generated text based on prompts. For example, it uses technical jargon and precise expressions for professionals and plain language and examples for ordinary users. After generating an initial answer, LLM can iteratively optimize the text through internal evaluation mechanisms (such as consistency checks and logical integrity checks) to ensure that the final answer is accurate, logically clear, and naturally languaged. It converts structured data into natural language and combines contextual information to make the answer not only accurate but also easy for users to understand. The context enhancement mechanism can understand the relationship between multiple rounds of queries, achieve continuous answers across queries, and avoid isolated processing of single queries. The prompt optimization mechanism allows the answer style and professionalism to be adjusted according to user needs or identity, improving the readability and friendliness of the answer.

[0069] In a preferred implementation, the timed query mode includes:

[0070] The client program triggers scheduled query tasks at preset time intervals based on the cron scheduling mechanism;

[0071] LangChain injects prompts for scheduled query tasks into its DAG execution engine, driving the LLM to generate enhanced query requests and driving the MCP client to retrieve metadata from the tool registry center from the MCP server.

[0072] The MCP client establishes a connection with the MCP server and completes SM2-based token verification. The MCP server executes data collection according to the enhanced query command and returns structured response data in Protocol Buffers serialization format.

[0073] LLM converts the returned structured response data into database write statements and stores them.

[0074] As described above, the client program automatically triggers scheduled query tasks at preset time intervals (such as hourly, daily, or custom cycles) through a cron scheduling mechanism. Users can set the query cycle, query objects, storage strategies, and alarm conditions in a graphical interface or configuration file. The tasks execute automatically according to the plan without manual intervention. LangChain injects the prompts for the scheduled query tasks into the DAG (Directed Acyclic Graph) execution engine. The DAG execution engine breaks down the scheduled tasks into multiple sub-tasks, with each node representing a sub-query task. Nodes are connected through data dependencies, supporting parallel execution and dynamic scaling. LLM generates enhanced query requests based on the prompts and DAG node information, ensuring that the query content is related to the context and historical state of the target data, improving query accuracy. The MCP client establishes a connection with the MCP server of the target edge computing terminal and uses an SM2 encrypted token for authentication, ensuring secure and reliable data access. The MCP server performs data collection according to the enhanced query instructions and uses Protocol... The Buffers serialization format returns structured response data, improving data transmission efficiency and parsing speed. LLM parses the returned structured response data and converts it into database write statements. The data is stored in a preset database, supporting subsequent queries, analysis, or alarm triggering. The timed query mode enables automated data collection without manual intervention, ensuring continuous acquisition and monitoring of data from edge computing terminals. The combination of the DAG execution engine and LLM enhanced query enables efficient execution of each subtask and understands data dependencies and context between tasks, improving overall query accuracy. The SM2 Token-based authentication mechanism ensures secure data transmission and access. The Protocol Buffers format ensures data integrity and efficient serialization. LLM converts structured data into database write statements, facilitating historical data storage, traceability analysis, and trend prediction. The DAG structure allows task nodes to dynamically expand or shrink, processing multiple subtasks in parallel, improving adaptability and response speed in complex scenarios.

[0075] In a preferred implementation, in the scheduled query mode, the cron scheduling mechanism allows users to set task plans through a graphical interface, whereby the task plan includes the query period, query objects, storage policies, and alarm conditions.

[0076] As described above, users can visually configure scheduled query tasks through a graphical user interface (GUI) provided by the client, without directly modifying code or configuration files. The interface allows users to set multiple parameters, including the query period (e.g., hourly, daily, weekly, or custom time intervals), the query object (specifying the edge computing terminal devices or data types to be queried), the storage strategy (selecting the storage method for query results, such as database tables, log files, or remote storage), and alarm conditions (setting thresholds or exception rules to trigger alarms or notifications when query results meet the conditions). The task plan generated by the graphical interface is converted into a cron job, which is automatically scheduled by the client program according to the set period. Triggered execution: The cron scheduling mechanism works in conjunction with LLM and MCP clients to automate task execution without user intervention. Each time a task is triggered, an enhanced query request is generated based on the parameters configured in the graphical interface. This drives the DAG execution engine to split the task into subtasks, and the LLM schedules the MCP client to execute the query operation. After the query is completed, the results are saved according to the storage policy, and corresponding notifications are triggered when alarm conditions are met. The graphical interface provides an intuitive operation method, allowing users to set up complex query plans without programming experience, thus lowering the barrier to entry. Users can customize the query cycle, objects, storage policies, and alarm conditions to achieve fine-grained management of different edge computing terminals.

[0077] In a preferred implementation, during the DAG execution engine injection phase in the timed query mode, a Directed Acyclic Graph (DAG) structure is used for construction. Each node represents a subquery task, and nodes are connected through data dependencies. The DAG structure can be dynamically expanded or shrunk at runtime and supports parallel execution of multiple nodes.

[0078] As described above, in the scheduled query mode, each time a task is triggered, the scheduled query task is injected into the DAG execution engine. A Directed Acyclic Graph (DAG) consists of multiple nodes and directed edges. Nodes represent individual sub-query tasks or operation units, such as retrieving data from a specified edge terminal, parsing tool metadata, or generating database write statements. Directed edges represent data dependencies between nodes, ensuring that sub-tasks are executed in the order of dependencies. The DAG execution engine determines the execution order based on the node dependencies and adds nodes without dependencies or whose dependencies are completed to the executable queue. For independent sub-query tasks, multiple execution threads can be started simultaneously, improving overall efficiency. To improve query efficiency, the DAG structure supports dynamic modification at runtime, including expansion (adding new query nodes or subtasks to accommodate new query needs) and contraction (deleting completed or redundant nodes to save computing resources). This mechanism ensures the flexibility of task execution and the efficient use of system resources. The DAG execution engine works in conjunction with LLM and MCP clients to break down timed tasks into multiple subtasks and dynamically schedule their execution through DAG, enabling automated processing of large-scale and complex query tasks. By executing multiple nodes in parallel, the total task time is reduced, especially when querying multiple edge terminals or complex multi-step tasks.

[0079] In a preferred implementation, in the scheduled query mode, the monitoring metrics obtained through MCP are stored in a MongoDB database in BSON format, and timestamps and task IDs are automatically added as index fields.

[0080] As described above, the MCP client sends enhanced query commands to the target edge computing terminal via the MCP protocol. The terminal executes the query and returns monitoring indicator data. The returned data is parsed by LLM or a program and converted into BSON format. BSON is the binary JSON storage format recommended by MongoDB, which can support complex data structures and efficient storage. The monitoring indicator data converted to BSON format is written to the MongoDB database. During the writing process, a timestamp field is automatically added to record the specific time of data collection for historical tracking and time-series analysis. At the same time, a task ID field is added to identify the scheduled query task that triggered the data collection, ensuring data traceability. The timestamp and task ID are set as index fields, allowing MongoDB to quickly locate data for a specified task or time period, improving query efficiency. The index also supports operations such as grouping by task, aggregation analysis by time period, and real-time alarms. Data collection triggered by scheduled tasks is split into subtasks through the DAG execution engine. After each subtask is completed, the results are stored in MongoDB in BSON format, realizing fully automatic, periodic, and structured data management.

[0081] Please see the appendix Figure 2As shown, the present invention also provides an intelligent agent for querying edge computing terminal information based on LLM and MCP protocols, used in the aforementioned method for querying edge computing terminal information based on LLM and MCP protocols, comprising:

[0082] The query receiving module is used to receive query mode information, which includes free question and answer mode and timed query mode, and obtain the corresponding query request based on the query mode;

[0083] The query intent module performs semantic parsing of query requests based on a large language model to obtain the query intent of the target edge computing terminal;

[0084] The authentication module is used to establish a connection between the MCP client and the MCP server of the target edge computing terminal, and to complete authentication based on the encrypted token.

[0085] The intent generation module is used to obtain the description information of callable tool interfaces from the MCP server and generate structured query instructions based on the query intent.

[0086] The structured results module is used by the MCP server to execute structured query commands and return structured result data;

[0087] The query results module is used by the large language model to process structured result data and generate query results that users can understand.

[0088] The query receiving module, as described above, is responsible for receiving query requests submitted by users. It supports two query modes: free-response and scheduled query. In free-response mode, users input natural language query requests through the Agent client, and the system passes them to the Large Language Model (LLM) for processing. In scheduled query mode, the system triggers query requests through preset scheduled tasks (such as cron scheduling) to ensure periodic and automated data acquisition. Based on the query mode type, the appropriate processing flow is selected to generate the corresponding query request. The query intent module performs semantic parsing of the query request based on the Large Language Model (LLM) to understand the user's query intent. In free-response mode, the LLM combines context... Information, historical conversations, and domain knowledge bases are used to generate multi-layered query intent representations, including question categories, entity objects, target metrics, and logical relationships. This transforms natural language requests into structured operational objectives, providing precise guidance for subsequent tool calls. The authentication module establishes a connection between the MCP client and the MCP server of the target edge computing terminal, completing authentication based on SM2 or other encrypted tokens to ensure the security of data interaction and guarantee that only authorized users or systems can access terminal information, effectively preventing unauthorized access and data leakage. The intent generation module obtains the description information of callable tool interfaces from the MCP server and generates structured representations based on the parsed query intent. In free-response question-and-answer mode, the LLM performs semantic mapping on tool functions and input / output parameters for query commands (such as JSON format), dynamically generating a set of candidate tools to ensure that the query task accurately matches the available interfaces on the terminal. In scheduled query mode, enhanced query commands can be split and processed in parallel using a DAG structure to achieve efficient data acquisition. The structured results module executes operations based on the structured query commands through the MCP server and returns structured result data, responsible for receiving, parsing, and initially integrating this data. The query results module uses a large language model to convert the structured results into natural language answers that users can understand, or generates database write statements in scheduled query mode. It can automatically add timestamps and task IDs, introduce context enhancement and prompt optimization mechanisms to improve the professionalism, readability, and continuity of multi-turn conversations. It also supports free question-and-answer mode and timed query mode, realizing the dual functions of real-time interaction and periodic monitoring to adapt to different application scenarios. It uses LLM combined with context and domain knowledge base to identify implicit intents and multi-objective needs across rounds, improving the accuracy and comprehensiveness of queries. Automatic semantic mapping tool interface dynamically generates candidate tool sets to ensure that query tasks accurately match available interfaces on the terminal, reducing manual intervention. The MCP protocol combined with encrypted tokens is used for authentication to ensure the security of terminal data transmission and prevent unauthorized access.

[0089] The above description is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention. Structures, devices, and operating methods not specifically described or explained in this invention are implemented according to conventional methods in the art unless otherwise specified or limited.

Claims

1. An edge computing terminal information query method based on LLM and MCP protocols, characterized in that, Comprise: Receiving query mode information, wherein the query mode information includes free question and answer mode and timing query mode, obtaining corresponding query request based on the query mode; Based on the large language model, the semantic analysis of the query request is carried out, and the query intention of the target edge computing terminal is obtained; Through the MCP client and the MCP service end of the target edge computing terminal, the connection is established, and the identity authentication is completed based on the encrypted token; Get the tool interface description information that can be called from the MCP service end, and generate structured query instruction according to the query intention; The MCP service end executes the structured query instruction and returns the structured result data; The large language model processes the structured result data to generate user understandable query result output; When the query mode information is free question and answer mode, the user inputs natural language query request through Agent client, LangChain framework combines the natural language query request with pre-defined prompt words and mapping table information to generate enhanced prompt for LLM to analyze; LLM performs intention analysis and task decomposition based on the enhanced prompt, identifies the user's real query target, and determines the terminal IP and tool metadata required to be accessed in combination with the mapping table; According to the tool metadata, the JSON format structured calling parameter is automatically generated, and the calling is initiated to the server through MCP protocol, so that the natural language request is converted into machine executable instruction; The tool description text is analyzed, which is converted into a standardized semantic vector, and the user query intention is generated, and the similarity of the two is calculated by semantic matching method, LLM deeply understands the function boundary of the tool, identifies the type of input parameter and its logical constraint condition, and analyzes the semantic meaning and result format of the output parameter; When the query mode information is timing query mode, the client program triggers the timing query task according to the preset time interval based on cron scheduling mechanism; LangChain injects the prompt words of timing query task into its DAG execution engine to drive LLM to generate enhanced query request and drive MCP client to obtain tool registry center metadata from MCP service end; MCP client and MCP service end establish connection and complete SM2 based token verification, MCP service end executes collection according to enhanced query instruction and returns structured response data in Protocol Buffers serialization format; LLM converts the returned structured response data into database write statement and stores it. 2.The method of querying information of an edge computing terminal based on LLM and MCP protocols according to claim 1, characterized in that, In free question and answer mode, after receiving the natural language query request, the query content in the natural language query request is modeled based on context semantics, combined with historical conversation content and domain knowledge base, the cross-turn implicit intention and multi-target demand are identified, and multi-level query intention representation is generated in the analysis process, wherein the multi-level query intention representation includes problem category, entity object, target index and logical relationship. 3.The method of claim 1, wherein, In the free Q&A mode, during the tool metadata calling stage, the obtained tool description information is automatically semantically mapped, the tool function and input / output parameters are deeply analyzed using a large language model, and a candidate tool set is dynamically generated based on the semantic matching results. 4.The method of querying information of an edge computing terminal based on LLM and MCP protocols according to claim 1, characterized in that, In the free Q&A mode, during the natural language answer generation stage, the structured results are converted into natural language answers, and a context enhancement mechanism and a prompt word optimization mechanism are introduced based on the large language model, wherein the context enhancement mechanism is used to jointly model the current query results and historical query results, and the prompt word optimization mechanism is used to adjust the tone, professional level and expression of the generated answers. 5.The method of querying information of an edge computing terminal based on LLM and MCP protocols according to claim 1, characterized in that, In the timing query mode, the cron scheduling mechanism allows users to set task plans through a graphical interface, wherein the task plan includes query period, query object, storage strategy and alarm condition. 6.The method of querying information of edge computing terminal based on LLM and MCP protocol according to claim 1, characterized in that, In the timing query mode, during the injection DAG execution engine stage, a directed acyclic graph (DAG) structure is used for construction, each node represents a subquery task, and the nodes are connected through data dependency relationships, wherein the DAG structure can be dynamically expanded or contracted at runtime and supports multi-node parallel execution.

7. The edge computing terminal information query method based on LLM and MCP protocols according to claim 6, characterized in that, In the timing query mode, the monitoring indicators obtained through the MCP are stored in the MongoDB database in BSON format, and a timestamp and a task ID are automatically added as index fields.

8. An edge computing terminal information query agent based on LLM and MCP protocols, applied to the edge computing terminal information query method based on LLM and MCP protocols in any one of claims 1 to 7, characterized in that, Comprise: A query receiving module for receiving query mode information, wherein the query mode information includes a free Q&A mode and a timing query mode, and a corresponding query request is obtained based on the query mode; A query intention module for performing semantic analysis on the query request based on a large language model to obtain the query intention of the target edge computing terminal; An identity verification module for establishing a connection with the MCP server of the target edge computing terminal through the MCP client and completing identity verification based on an encrypted token; An intention generation module for obtaining callable tool interface description information from the MCP server and generating structured query instructions according to the query intention; A structured result module for executing structured query instructions by the MCP server and returning structured result data; A query result module for processing the structured result data by a large language model to generate a user-understandable query result output.

Citation Information

Patent Citations

  • Data analysis method and device, storage medium and electronic equipment

    CN120611800A

  • Endogenous security database query method and device based on large model and MCP protocol

    CN120631919A