An implicit MCP calling method, system, and computer-readable storage medium
By converting MCP description information into vectors and performing retrieval matching scoring, the MCP description vector with the highest comprehensive score is selected for invocation. This solves the problems of low efficiency and poor response caused by the increase in the number of MCPs, and realizes efficient and high-quality MCP invocation, which is suitable for large language model systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, as the number of MCPs increases, their description information will occupy a large amount of the limited context input window, resulting in low overall efficiency of data retrieval and poor response quality, and even causing call failure.
The description information of multiple MCPs is converted into multiple MCP description vectors and stored. User requests are received to generate query vectors. The query vectors are used to search, match and score multiple MCP description vectors. The MCP description vector with the highest comprehensive score is selected for use.
It reduces the injection of irrelevant MCP information, avoids description information crowding the context window, improves the overall efficiency of data retrieval, optimizes the user experience, and improves the quality of call response. It is especially suitable for systems with large language models as the front-end interaction entry point.
Smart Images

Figure CN122086955A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and in particular to an implicit MCP calling method, system, and computer-readable storage medium. Background Technology
[0002] Currently, when integrating and calling external tools or data sources using MCP (Model Context Protocol), it mainly relies on manual specification. Users or developers must explicitly select and describe the required MCP in the request, and the system then loads its complete description into the context input window of the large language model for invocation.
[0003] This approach has significant limitations. First, it requires users to be familiar with available MCPs and their interfaces, resulting in a high barrier to entry. This places a heavy cognitive burden and learning cost on non-professional users or when faced with a large, dynamically updated MCP resource library, greatly reducing the system's usability and accessibility. Second, as the number of MCPs increases, their descriptive information can significantly encroach on the limited context input window, potentially exceeding the context input limit and leading to insufficient available space for processing core tasks. This severely impacts the overall performance and response quality of the large language model, and may even cause call failures. Furthermore, the system has poor scalability and cannot dynamically and in real-time update MCP resources according to user needs. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to address at least one defect of the related technologies mentioned in the background: as the number of MCPs increases, their description information will occupy a large amount of the limited context input window, resulting in low overall efficiency of data retrieval and poor response quality, and even causing call failure.
[0005] The technical solution adopted by this invention to solve its technical problem is: to construct an MCP implicit calling method, including the following steps: The description information of multiple MCPs is converted into multiple MCP description vectors and stored; Receive user requests and generate query vectors based on user requests; The query vector is used to search, match, and score multiple MCP description vectors, and the MCP description vector with the highest overall score is selected for use.
[0006] In some embodiments, the MCP description vector is uniformly encoded by the embedding model.
[0007] In some embodiments, the MCP description vector includes at least one of: function name, applicable domain label, and historical call success rate.
[0008] In some embodiments, generating a query vector based on a user request includes: extracting intent keywords and task types from the user request, and then mapping the user request to a standardized query vector.
[0009] In some embodiments, after generating the query vector based on the user request, the method further includes: providing relevant prompts based on the user request, and adjusting the query vector based on the user's feedback on the relevant prompts.
[0010] In some embodiments, query vectors are used to retrieve, match, and score multiple MCP description vectors, and the MCP description vector with the highest comprehensive score is selected for invocation. This includes: using query vectors to perform dense vector similarity analysis on multiple MCP description vectors to obtain the semantic similarity relevance score of each MCP description vector, and performing sparse keyword matching on multiple MCP description vectors to obtain the keyword statistical relevance score of each MCP description vector, and selecting the MCP description vector with the highest comprehensive score of semantic similarity relevance score and keyword statistical relevance score for invocation.
[0011] In some embodiments, the method further includes: Execute the MCP description vector with the highest overall score that was called, and return the execution result; Display execution results and receive user feedback. Update the search matching information based on the feedback to optimize the subsequent MCP description vector call results.
[0012] In some embodiments, the feedback information includes at least one of explicit feedback, implicit feedback, and performance quality metrics.
[0013] This invention also constructs an MCP implicit calling system, comprising: A vector database is used to convert the description information of multiple MCPs into multiple MCP description vectors and store them. The user-side interface is used to input user requests and submit them to the request handler; and... The request processor receives user requests, generates query vectors based on user requests, and uses the query vectors to search, match, and score multiple MCP description vectors in the vector database, selecting the MCP description vector with the highest overall score for invocation.
[0014] The present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the MCP implicit call method of any of the above embodiments.
[0015] By implementing this invention, the following beneficial effects are achieved: This invention transforms the description information of multiple MCPs into multiple MCP description vectors and stores them, converting user requests into query vectors. This reduces the injection of irrelevant MCP information, prevents description information from crowding out the limited context window, and improves the overall efficiency of data retrieval. Users also no longer need to remember or search for MCP names, achieving "what you want is what you get," thus optimizing the user experience. Furthermore, by using query vectors to search, match, and score multiple MCP description vectors, and selecting the MCP description vector with the highest overall score for retrieval, the quality of the call response is further improved. This is particularly suitable for systems where a large language model serves as the front-end interaction entry point. Attached Figure Description
[0016] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 A flowchart of an embodiment of an MCP implicit invocation method according to the present invention is shown; Figure 2 The flowchart shown is an embodiment of the MCP implicit invocation method of the present invention. Figure 3 This diagram illustrates the overall structure of an embodiment of the MCP implicit calling system of the present invention. Figure 4 A schematic diagram of the overall structure of another embodiment of the MCP implicit calling system of the present invention is shown. Detailed Implementation
[0017] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0018] It should be noted that the flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0019] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0020] It should be noted that "at least two" refers to at least two, which can be two, three, or any number. "At least one" can be one, two, or any number.
[0021] MCP (Model Context Protocol) is generally used to refer to a mechanism that standardizes the passing and management of runtime context information for models. Its core objective is to standardize a secure and efficient way to connect large language models with external tools, data sources, and services.
[0022] Context refers to the background information that an LLM (Large Language Model) relies on when generating output, such as dialogue history, instructions for the current task, and input speech and image information.
[0023] like Figure 1 As shown, some embodiments of the present invention disclose an implicit MCP calling method, including the following steps: The description information of multiple MCPs is converted into multiple MCP description vectors and stored; Receive user requests and generate query vectors based on user requests; The query vector is used to search, match, and score multiple MCP description vectors, and the MCP description vector with the highest overall score is selected for use.
[0024] This embodiment transforms the description information of multiple MCPs into multiple MCP description vectors and stores them, converting user requests into query vectors. This reduces the injection of irrelevant MCP information, prevents description information from crowding out the limited context window, and improves the overall efficiency of data retrieval. Users also do not need to remember or search for MCP names, achieving "what you want is what you get," thus optimizing the user experience. Furthermore, by using query vectors to search, match, and score multiple MCP description vectors, and selecting the MCP description vector with the highest overall score for retrieval, the quality of the call response is further improved. This is particularly suitable for systems where a large language model serves as the front-end interaction entry point.
[0025] In some embodiments, the user request includes one of the following: a task description in natural language, structured instructions, and semi-structured instructions. For example, the task description in natural language might be "Help me generate a weekly sales report" or "Analyze user activity trends for the past week." Structured / semi-structured instructions are API request bodies or JSON-formatted task templates.
[0026] In some embodiments, the MCP description vector is uniformly encoded by an embedding model (such as a fine-tuned Sentence-BERT model). The MCP description vector includes at least one of the following: function name, applicable domain label, and historical call success rate.
[0027] In some embodiments, generating a query vector based on a user request includes: extracting intent keywords and task types from the user request, and then mapping the user request to a standardized query vector to avoid interference from original natural language noise.
[0028] In some embodiments, after generating the query vector based on the user request, the process further includes: providing relevant prompts based on the user request, and adjusting the query vector based on the user's feedback on the relevant prompts. For example, the relevant prompts could be "Do you want to generate a report or analyze trends?", which clarifies the user's intent and improves the accuracy of vector retrieval.
[0029] In some embodiments, query vectors are used to retrieve, match, and score multiple MCP description vectors, and the MCP description vector with the highest comprehensive score is selected for invocation. This includes: using query vectors to perform dense vector similarity analysis on multiple MCP description vectors to obtain the semantic similarity relevance score of each MCP description vector, and performing sparse keyword matching on multiple MCP description vectors to obtain the keyword statistical relevance score of each MCP description vector, and selecting the MCP description vector with the highest comprehensive score of semantic similarity relevance score and keyword statistical relevance score for invocation.
[0030] Specifically, dense vector similarity analysis (e.g., cosine similarity) is performed on multiple MCP description vectors using the query vector to obtain the semantic similarity relevance score of each MCP description vector. Sparse keyword matching (e.g., BM25, Best Matching 25, a function for calculating keyword relevance scores between queries and documents) is then performed on the multiple MCP description vectors using the query vector to obtain the keyword statistical relevance score of each MCP description vector. The MCP description vector with the highest combined score of semantic similarity relevance score and keyword statistical relevance score is then retrieved. By introducing a hybrid retrieval strategy, combining dense vector similarity analysis and sparse keyword matching, recall and precision are improved.
[0031] In some embodiments, the process of using query vectors to search, match, and score multiple MCP description vectors further includes: obtaining the semantic similarity relevance score and the keyword statistical relevance score of each MCP description vector, assigning a greater weight to the semantic similarity relevance score than the keyword statistical relevance score, and calculating a comprehensive score of the semantic similarity relevance score and the keyword statistical relevance score, so that the MCP with the best semantic match is recalled first.
[0032] like Figure 2 As shown, in some embodiments, the method further includes: Execute the MCP description vector with the highest overall score that was called, and return the execution result; Display execution results and receive user feedback. Update the search matching information based on the feedback to optimize the subsequent MCP description vector call results.
[0033] Specifically, updating the retrieval matching information based on feedback includes: performing structured parsing of the feedback information to obtain the retrieval matching information. This retrieval matching information includes the MCP description vector itself, MCP metadata weights, and negative sample records. The MCP description vector itself can be adjusted through feedback weighted averaging or gradient updates. MCP metadata weights include semantic similarity relevance score weights and keyword statistical relevance score weights. Negative sample records record query pairs of query vectors rejected by the user and their corresponding MCP description vectors, used for comparative learning.
[0034] In some embodiments, manual review is also supported when updating search matching information to ensure the security of the update.
[0035] In some embodiments, the feedback information includes at least one of explicit feedback, implicit feedback, and performance metrics. Specifically, explicit feedback is the user's direct evaluation of the execution result, such as user ratings (e.g., 1-5 stars), whether it was "useful / useless," or whether the wrong tool was used. Implicit feedback is user behavior data, such as whether the user continues to ask follow-up questions, abandons the service, or repeatedly submits similar requests. Performance metrics are system log data, such as MCP execution time, completeness of returned results, and error codes. This feedback information will be backpropagated through reinforcement learning reward signals or supervised fine-tuning loss functions to drive vector space optimization, dynamically adjust the weights of the corresponding MCP vectors, or trigger vector fine-tuning mechanisms, thereby optimizing subsequent retrieval accuracy.
[0036] like Figure 3 As shown, some embodiments of the present invention disclose an MCP implicit calling system, including: A vector database is used to convert the description information of multiple MCPs into multiple MCP description vectors and store them. The user terminal is used to input user requests and submit them to the request processor; and... A request processor is configured to receive the user request, generate a query vector based on the user request, and use the query vector to search, match, and score multiple MCP description vectors in the vector database, and select the MCP description vector with the highest comprehensive score for invocation.
[0037] This embodiment transforms the description information of multiple MCPs into multiple MCP description vectors and stores them, converting user requests into query vectors. This reduces the injection of irrelevant MCP information, prevents description information from crowding out the limited context window, and improves the overall efficiency of data retrieval. Users also do not need to remember or search for MCP names, achieving "what you want is what you get," thus optimizing the user experience. Furthermore, by using query vectors to search, match, and score multiple MCP description vectors, and selecting the MCP description vector with the highest overall score for retrieval, the quality of the call response is further improved. This is particularly suitable for systems where a large language model serves as the front-end interaction entry point.
[0038] In some embodiments, the user request includes one of the following: a task description in natural language, structured instructions, and semi-structured instructions. For example, the task description in natural language might be "Help me generate a weekly sales report" or "Analyze user activity trends for the past week." Structured / semi-structured instructions can be API request bodies or JSON-formatted task templates. It should be noted that the user end includes, but is not limited to, human-computer interaction interfaces or other client devices that input user requests.
[0039] In some embodiments, the MCP description vector is uniformly encoded by an embedding model (such as a fine-tuned Sentence-BERT model). The MCP description vector includes at least one of the following: function name, applicable domain label, and historical call success rate.
[0040] In some embodiments, generating a query vector based on a user request includes: extracting intent keywords and task types from the user request, and then mapping the user request to a standardized query vector to avoid interference from original natural language noise.
[0041] In some embodiments, after generating the query vector based on the user request, the process further includes: providing relevant prompts based on the user request, and adjusting the query vector based on the user's feedback on the relevant prompts. For example, the relevant prompts could be "Do you want to generate a report or analyze trends?", which clarifies the user's intent and improves the accuracy of vector retrieval.
[0042] In some embodiments, query vectors are used to retrieve, match, and score multiple MCP description vectors, and the MCP description vector with the highest comprehensive score is selected for invocation. This includes: using query vectors to perform dense vector similarity analysis on multiple MCP description vectors to obtain the semantic similarity relevance score of each MCP description vector, and performing sparse keyword matching on multiple MCP description vectors to obtain the keyword statistical relevance score of each MCP description vector, and selecting the MCP description vector with the highest comprehensive score of semantic similarity relevance score and keyword statistical relevance score for invocation.
[0043] Specifically, dense vector similarity analysis (e.g., cosine similarity) is performed on multiple MCP description vectors using the query vector to obtain the semantic similarity relevance score of each MCP description vector. Sparse keyword matching (e.g., BM25, Best Matching 25, a function for calculating keyword relevance scores between queries and documents) is then performed on the multiple MCP description vectors using the query vector to obtain the keyword statistical relevance score of each MCP description vector. The MCP description vector with the highest combined score of semantic similarity relevance score and keyword statistical relevance score is then retrieved. By introducing a hybrid retrieval strategy, combining dense vector similarity analysis and sparse keyword matching, recall and precision are improved.
[0044] In some embodiments, the process of using query vectors to search, match, and score multiple MCP description vectors further includes: obtaining the semantic similarity relevance score and the keyword statistical relevance score of each MCP description vector, assigning a greater weight to the semantic similarity relevance score than the keyword statistical relevance score, and calculating a comprehensive score of the semantic similarity relevance score and the keyword statistical relevance score, so that the MCP with the best semantic match is recalled first.
[0045] like Figure 4 As shown, in some embodiments of the present invention, the system further includes an actuator and a feedback module. The executor executes the MCP description vector with the highest overall score that is invoked by the requested processor and returns the execution result. The client-side also displays the execution result, receives user feedback, and sends it to the feedback module. The feedback module updates the retrieval and matching information in the vector database based on the feedback information to optimize subsequent MCP description vector invocation results.
[0046] Specifically, updating the retrieval matching information based on feedback includes: performing structured parsing of the feedback information to obtain the retrieval matching information. This retrieval matching information includes the MCP description vector itself, MCP metadata weights, and negative sample records. The MCP description vector itself can be adjusted through feedback weighted averaging or gradient updates. MCP metadata weights include semantic similarity relevance score weights and keyword statistical relevance score weights. Negative sample records record query pairs of query vectors rejected by the user and their corresponding MCP description vectors, used for comparative learning.
[0047] In some embodiments, manual review is also supported when updating search matching information to ensure the security of the update.
[0048] In some embodiments, the feedback information includes at least one of explicit feedback, implicit feedback, and performance metrics. Specifically, explicit feedback is the user's direct evaluation of the execution result, such as user ratings (e.g., 1-5 stars), whether it was "useful / useless," or whether the wrong tool was used. Implicit feedback is user behavior data, such as whether the user continues to ask follow-up questions, abandons the service, or repeatedly submits similar requests. Performance metrics are system log data, such as MCP execution time, completeness of returned results, and error codes. This feedback information will be backpropagated through reinforcement learning reward signals or supervised fine-tuning loss functions to drive vector space optimization, dynamically adjust the weights of the corresponding MCP vectors, or trigger vector fine-tuning mechanisms, thereby optimizing subsequent retrieval accuracy.
[0049] Some embodiments of the present invention also disclose a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the MCP implicit invocation method as described in any of the above embodiments.
[0050] By implementing this invention, the following beneficial effects are achieved: This invention transforms the description information of multiple MCPs into multiple MCP description vectors and stores them, converting user requests into query vectors. This reduces the injection of irrelevant MCP information, prevents description information from crowding out the limited context window, and improves the overall efficiency of data retrieval. Users also no longer need to remember or search for MCP names, achieving "what you want is what you get," thus optimizing the user experience. Furthermore, by using query vectors to search, match, and score multiple MCP description vectors, and selecting the MCP description vector with the highest overall score for retrieval, the quality of the call response is further improved. This is particularly suitable for systems where a large language model serves as the front-end interaction entry point.
[0051] By clarifying the user's intent through relevant prompts before invoking the MCP description vector, retrieval accuracy is improved. The vector retrieval matching mechanism incorporates dense vector similarity analysis and a weighted comprehensive score for sparse keyword matching, prioritizing the recall of the semantically most matching MCP description vector, thus improving recall and precision. After execution, the retrieval matching information is updated based on user feedback to optimize subsequent MCP description vector invocation results. This feedback loop enables continuous performance improvement through system adaptability.
[0052] It is understood that the above embodiments only illustrate some implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can freely combine the above embodiments or technical features without departing from the concept of the present invention, and can also make several modifications and improvements, all of which fall within the protection scope of the present invention. That is, the embodiments described "in some embodiments" can be freely combined with any of the preceding and following embodiments. Therefore, all equivalent transformations and modifications made within the scope of the claims of the present invention should be covered by the claims of the present invention.
Claims
1. An implicit MCP calling method, characterized in that, Includes the following steps: The description information of multiple MCPs is converted into multiple MCP description vectors and stored; Receive user requests and generate query vectors based on the user requests; The query vector is used to search, match, and score multiple MCP description vectors, and the MCP description vector with the highest comprehensive score is selected for use.
2. The MCP implicit calling method according to claim 1, characterized in that, The MCP description vector is uniformly encoded by the embedding model.
3. The MCP implicit calling method according to claim 1, characterized in that, The MCP description vector includes: At least one of the following: function name, applicable domain label, and historical call success rate.
4. The MCP implicit calling method according to claim 1, characterized in that, The step of generating a query vector based on the user request includes: Extract the intent keywords and task type from the user request, and then map the user request into a standardized query vector.
5. The MCP implicit calling method according to claim 1, characterized in that, After generating the query vector based on the user request, the process further includes: Provide relevant prompts based on the user's request, and adjust the query vector based on the user's feedback on the relevant prompts.
6. The MCP implicit calling method according to claim 1, characterized in that, The step of using the query vector to retrieve, match, and score multiple MCP description vectors, and selecting the MCP description vector with the highest comprehensive score for retrieval, includes: The query vector is used to perform dense vector similarity analysis on multiple MCP description vectors to obtain the semantic similarity relevance score of each MCP description vector, and sparse keyword matching is performed on multiple MCP description vectors to obtain the keyword statistical relevance score of each MCP description vector. The MCP description vector with the highest comprehensive score of semantic similarity relevance score and keyword statistical relevance score is selected for invocation.
7. The MCP implicit calling method according to claim 1, characterized in that, The method also includes: Execute the MCP description vector with the highest overall score that was called, and return the execution result; Display the execution results and receive feedback from the user; The search matching information is updated based on the feedback information to optimize the subsequent MCP description vector call results.
8. The MCP implicit calling method according to claim 7, characterized in that, The feedback information includes: At least one of explicit feedback, implicit feedback, and performance quality metrics.
9. An MCP implicit calling system, characterized in that, include: A vector database is used to convert the description information of multiple MCPs into multiple MCP description vectors and store them. The user terminal is used to input user requests and submit the user requests to the request processor. as well as, A request processor is configured to receive the user request, generate a query vector based on the user request, and use the query vector to search, match, and score multiple MCP description vectors in the vector database, and select the MCP description vector with the highest comprehensive score for invocation.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the MCP implicit invocation method as described in any one of claims 1-8.