A secure MCP protocol authentication method and system

By combining digital certificate verification and public/private key signature mechanisms with timestamp verification, the problems of weak identity authentication and insufficient data integrity in the MCP protocol authentication method are solved, realizing secure and reliable communication and efficient data transmission between intelligent agents and target resources.

CN120896794BActive Publication Date: 2026-01-06GUIZHOU ELECTRONIC CERTIFICATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511417149.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-01-06
Estimated Expiration
2045-09-29

AI Technical Summary

Technical Problem

Existing MCP protocol authentication methods are weak in the identity authentication process and lack verification of data integrity and timeliness, making it easy for attackers to impersonate legitimate intelligent agents, which may lead to the leakage of customer transaction records, data loss, or business disruption.

Method used

The legality and validity of each interaction are ensured through digital certificate verification and public-private key signing mechanisms between the intelligent agent, the MCP server, and the target resource. The integrity and freshness of the data are guaranteed through timestamp and timeliness verification mechanisms.

Benefits of technology

It enables trusted communication between intelligent agents, servers, and target resources, prevents replay attacks, ensures the security and integrity of data during transmission and processing, and optimizes data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120896794B_ABST
    Figure CN120896794B_ABST
Patent Text Reader

Abstract

The application provides a safe MCP protocol authentication method and system, and relates to the technical field of information security, the method comprises the following steps: based on the processing result that the identity authentication of an intelligent agent is successful and the digital signature verification is passed, an MCP server parses a target resource identifier, constructs a resource access instruction containing intelligent agent identity information, an operation instruction and a new timestamp, uses a server private key to perform digital signature, and sends an access request containing a server digital certificate, a digital signature and a resource access instruction to a target resource; the target resource receives the access request, verifies the legality of the MCP server digital certificate, uses the server public key to verify the digital signature, and checks the integrity and timeliness of the resource access instruction. The application improves the security of multi-entity interaction based on the MCP protocol, and provides a solid guarantee for the trusted communication between the intelligent agent, the server and the target resource.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to a secure MCP protocol authentication method and system. Background Technology

[0002] In the field of information security, with the widespread adoption of various intelligent applications, interaction scenarios based on the MCP protocol are increasing. When in use, the intelligent customer service system (as an intelligent agent) needs to access the backend database (target resource) through the MCP server to obtain customer transaction records and provide accurate services to customers. The intelligent customer service system initiates an MCP call request instruction containing the target resource identifier (i.e., database address and other identification information), operation instructions (such as querying a customer's transaction records for the past month) and timestamp, and sends it to the MCP server after digital signature.

[0003] However, existing MCP protocol authentication methods may have the following drawbacks:

[0004] On the one hand, in the identity authentication process, some authentication mechanisms may be relatively weak, and the authentication requirements of different MCP servers may vary greatly. Some may even lack basic API key protection. This makes it possible for attackers to easily impersonate legitimate intelligent agents and send malicious requests to the MCP server. If the attacker successfully impersonates an intelligent customer service representative, the MCP server will forward the malicious request to the database when identity authentication fails, which may lead to the leakage of customer transaction records.

[0005] On the other hand, there may be a lack of strict verification of data integrity and timeliness during data transmission. For example, an attacker may intercept resource access instructions or response data during transmission, tamper with the operation instructions or timestamps, and then send them again. If the receiver does not strictly verify the data, executing incorrect instructions may cause data loss or business disruption, thereby affecting system security and stability. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to provide a secure MCP protocol authentication method and system, which improves the security of multi-entity interaction based on the MCP protocol and provides a solid guarantee for trusted communication between intelligent agents, servers and target resources.

[0007] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0008] Firstly, a secure MCP protocol authentication method is provided, the method comprising:

[0009] Step 1: Based on the successful authentication of the agent's identity and the successful verification of the digital signature, the MCP server parses the target resource identifier, constructs a resource access instruction containing the agent's identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends an access request containing the server's digital certificate, digital signature and resource access instruction to the target resource.

[0010] Step 2: The target resource receives the access request, verifies the legality of the MCP server's digital certificate, verifies the digital signature using the server's public key, and checks the integrity and timeliness of the resource access instruction.

[0011] Step 3: Based on the successful authentication and digital signature verification results of the MCP server, the target resource executes the operation instructions, generates response data containing the execution results and timestamps, performs digital signature using the target resource's private key, and sends the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server.

[0012] Step 4: The MCP server receives the operation response, verifies the legality of the target resource digital certificate based on the received response data, verifies the digital signature using the target resource public key, and checks the integrity and timeliness of the response data to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed.

[0013] Step 5: Based on the successful authentication of the target resource identity and the successful verification of the digital signature, the MCP server forwards the response data to the intelligent agent to complete the authentication process.

[0014] Secondly, a secure MCP protocol authentication system includes:

[0015] The sending module is used to parse the target resource identifier based on the processing result of successful agent identity authentication and digital signature verification. It constructs a resource access instruction containing agent identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends the access request containing the server's digital certificate, digital signature and resource access instruction to the target resource.

[0016] The verification module is used to receive access requests for the target resource, verify the legality of the MCP server's digital certificate, verify the digital signature using the server's public key, and verify the integrity and timeliness of the resource access instructions.

[0017] The response generation module is used to execute operation instructions on the target resource based on the processing result of successful identity authentication and digital signature verification on the MCP server, generate response data containing the execution result and timestamp, perform digital signature using the target resource's private key, and send the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server.

[0018] The verification module is used by the MCP server to receive operation responses, verify the legality of the target resource digital certificate based on the received response data, verify the digital signature using the target resource public key, and check the integrity and timeliness of the response data, so as to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed.

[0019] The forwarding module is used to forward the response data to the intelligent agent to complete the authentication process based on the successful authentication of the target resource identity and the successful verification of the digital signature.

[0020] Thirdly, a computing device includes:

[0021] One or more processors;

[0022] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.

[0023] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.

[0024] The above-described solution of the present invention has at least the following beneficial effects:

[0025] Through digital certificate verification and public-private key signature mechanisms between the intelligent agent, MCP server, and target resource, the identity of each participating entity is reliably confirmed. Each interaction requires verification of the legality and validity of the other party's digital certificate, ensuring that only entities certified by a trusted authority and within their validity period can participate in communication. All transmitted instructions and response data are digitally signed, and the receiver can verify the signature using the corresponding public key to confirm that the data has not been tampered with, ensuring data integrity. At the same time, the introduction of timestamps and timeliness verification mechanisms can effectively resist replay attacks, ensuring the freshness and validity of data during transmission and processing. A complete closed-loop verification process is implemented, from the intelligent agent initiating a request to the MCP server forwarding the request, the target resource executing the operation, and the response data being sent back to the intelligent agent. Each link verifies the legality of the upstream entity and provides verifiable identity and data evidence for the downstream links, avoiding the overall risk that a single point of security vulnerability may cause. Through detailed design such as data block processing and the application of secure transmission protocols, data transmission efficiency and security are further optimized. Especially when processing large execution result data, block processing can reduce transmission pressure and achieve a balance between efficiency and security. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating a secure MCP protocol authentication method provided by an embodiment of the present invention.

[0027] Figure 2 This is a schematic diagram of a secure MCP protocol authentication system provided by an embodiment of the present invention. Detailed Implementation

[0028] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0029] like Figure 1 As shown, an embodiment of the present invention proposes a secure MCP protocol authentication method, the method comprising the following steps:

[0030] Step 1: Based on the successful authentication of the agent's identity and the successful verification of the digital signature, the MCP server parses the target resource identifier, constructs a resource access instruction containing the agent's identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends an access request containing the server's digital certificate, digital signature and resource access instruction to the target resource.

[0031] Step 2: The target resource receives the access request, verifies the legality of the MCP server's digital certificate, verifies the digital signature using the server's public key, and checks the integrity and timeliness of the resource access instruction.

[0032] Step 3: Based on the successful authentication and digital signature verification results of the MCP server, the target resource executes the operation instructions, generates response data containing the execution results and timestamps, performs digital signature using the target resource's private key, and sends the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server.

[0033] Step 4: The MCP server receives the operation response, verifies the legality of the target resource digital certificate based on the received response data, verifies the digital signature using the target resource public key, and checks the integrity and timeliness of the response data to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed.

[0034] Step 5: Based on the successful authentication of the target resource identity and the successful verification of the digital signature, the MCP server forwards the response data to the intelligent agent to complete the authentication process.

[0035] In this embodiment of the invention, the MCP (Management and Control Protocol) is a communication protocol used for management and control interactions between multiple entities (such as agents, servers, and target resources). The MCP server is a core node for intermediate forwarding and security verification based on the MCP protocol, acting as a bridge and security gateway between agents (such as intelligent customer service) and target resources (such as backend databases). By reconstructing resource access instructions and attaching a new timestamp, the instructions are strongly bound to the forwarding behavior of the MCP server, and the new timestamp provides a basis for subsequent timeliness verification. The server uses a private key to sign and carries a digital certificate, enabling the target resource to directly verify the legitimacy of the instruction's source. The instructions contain agent identity information, facilitating the target resource's traceability of the operation initiator and providing a basis for access control and auditing. Verifying the legitimacy of the MCP server's digital certificate ensures that the target resource only responds to requests from legitimate servers. Verifying the digital signature using the server's public key determines whether the resource access instructions have been tampered with, ensuring instruction integrity. The timely nature of the instructions effectively prevents replay attacks, preventing attackers from illegally accessing resources by repeatedly using expired instructions. The target resource signs the response data and includes its own certificate, enabling the MCP server to verify the true source of the response. The response data contains a timestamp, providing a basis for the MCP server to verify its timeliness. The response data is signed and bound to the target resource's private key, ensuring that the execution result is not tampered with during transmission. Verifying the legality of the target resource's certificate confirms that the response data comes from a trusted target resource, and verifying the signature through the target resource's public key ensures that the response data is not tampered with during transmission, guaranteeing data integrity. Verifying the timeliness of the response data filters out expired responses, ensuring that the agent receives the latest and valid execution result. The result is forwarded only after both the target resource's identity and the response data have been verified, providing double security endorsement for the agent and ensuring that the response received by the agent is authentic and complete.

[0036] In a preferred embodiment of the present invention, before the intelligent agent's identity authentication is successful and the digital signature verification is passed, the method further includes:

[0037] The agent generates an MCP call request instruction containing a target resource identifier, operation instructions, and a timestamp. Using an asymmetric encryption algorithm and the agent's private key, the agent digitally signs the call request instruction, generating an authentication request message containing the agent's digital certificate, digital signature, and call request instruction, which is then sent to the MCP server. Specifically, the agent first determines the target resource to be accessed and specifies the operation to be performed on that resource. Then, it generates an MCP call request instruction containing a target resource identifier, specific operation instructions, and current time information. The target resource identifier is used to uniquely identify the system resource to be accessed, the operation instructions are used to instruct the target resource to perform a specific operation, and the timestamp is used to mark the generation time of the request instruction.

[0038] The agent selects a suitable asymmetric encryption algorithm, calls its own stored private key, and performs digital signature processing on the generated MCP call request instruction. After completing the digital signature processing, the agent combines its own digital certificate, the digital signature obtained after signing, and the original MCP call request instruction in a preset format to form a complete authentication request message. This message contains all the information required to verify the agent's identity and the call request instruction.

[0039] The agent sends the generated authentication request message to the MCP server through a preset communication channel.

[0040] After receiving the authentication request message, the MCP server obtains the agent's digital certificate by parsing the message content. It then verifies the legality and validity of the digital certificate according to a pre-configured access control policy. Using the agent's public key, it decrypts and verifies the digital signature using a cryptographic verification algorithm. Simultaneously, it verifies the data integrity and timestamp validity of the call request instruction, resulting in successful agent authentication and digital signature verification. Specifically, the MCP server receives the authentication request message sent by the agent through its communication interface and initiates a message parsing program. It disassembles the message according to a preset format, extracting the agent's digital certificate, digital signature, and MCP call request instruction, among other components. Next, the MCP server retrieves the pre-configured access control policy from its locally stored security configuration. This policy includes the certificate specifications and permission scope of agents allowed to access the system. Then, it checks the parsed agent's digital certificate according to this access control policy, verifying whether the certificate was issued by a trusted certificate authority, whether it is valid, and whether it conforms to the system's access specifications.

[0041] After verifying the agent's digital certificate, the MCP server extracts the agent's public key from the certificate, calls a preset cryptographic verification algorithm, and uses the public key to decrypt the parsed digital signature. The validity of the digital signature is verified by comparing the decryption result with the MCP call request instruction. At the same time, the MCP server verifies the data integrity of the MCP call request instruction, checking whether data loss or tampering occurred during transmission. It also extracts the timestamp from the instruction and compares it with the current system time to verify whether the timestamp is within the preset valid time range, thereby determining the timeliness of the call request instruction.

[0042] Through a series of operations, including verifying the agent's digital certificate, decrypting and verifying the digital signature, verifying the data integrity of the call request command, and verifying the timeliness of the timestamp, the MCP server integrates all the verification results and finally determines that the agent's identity authentication is successful and the digital signature verification is passed.

[0043] In this embodiment of the invention, the intelligent agent incorporates a timestamp when generating a call request instruction and digitally signs it using its own private key, while simultaneously sending it to the MCP server along with a digital certificate. This process ensures the traceability of the call request instruction's origin, enabling the MCP server to accurately identify the identity of the intelligent agent initiating the request. After receiving the authentication request message, the MCP server first parses and obtains the intelligent agent's digital certificate, and then verifies the certificate's legality and validity according to the pre-configured access control policy. This operation can filter out intelligent agents that do not have a legitimate identity or exceed their authorized scope, preventing unauthorized intelligent agents from accessing the system. The MCP server uses the intelligent agent's public key to decrypt and verify the digital signature, while also verifying the data integrity and timestamp validity of the call request instruction. This effectively confirms that the call request instruction has not been tampered with during transmission, ensuring the authenticity of the instruction content. At the same time, timestamp verification prevents attackers from reusing expired instructions to carry out replay attacks, further enhancing the security of request instruction transmission.

[0044] In a preferred embodiment of the present invention, step 1 above includes:

[0045] Step 11: Based on the successful agent identity authentication and digital signature verification, the MCP server parses the target resource identifier contained in the call request instruction. It then determines the network address and access interface of the target resource using a resource identifier parsing algorithm. Specifically, after successful agent identity authentication and digital signature verification, the MCP server extracts the target resource identifier from the verified call request instruction. Subsequently, the MCP server initiates the resource identifier parsing algorithm, which performs layered parsing of the target resource identifier according to preset parsing rules. First, it identifies the resource type of the target resource, then matches the corresponding parsing logic based on the resource type, thereby extracting key information for locating the target resource. This key information is then compared with the resource mapping table stored locally on the MCP server to ultimately determine the network address corresponding to the target resource and the access interface used for data interaction.

[0046] Step 12: Based on the network address and access interface of the target resource, construct a resource access instruction containing agent identity information, operation instructions, and a new timestamp. The new timestamp is obtained from a trusted time source using a time synchronization protocol. Specifically, after obtaining the network address and access interface of the target resource, the MCP server will begin constructing the resource access instruction based on these two pieces of information. First, the MCP server will extract the key identity identifier from the previously verified agent identity information and write it as the core content of the agent identity information into the resource access instruction. Then, it will completely copy the verified operation instructions from the call request instruction into the resource access instruction. At the same time, the MCP server will start the time synchronization module, which establishes a connection with a trusted time source through a preset time synchronization protocol, obtains the current standard time from the trusted time source as the new timestamp, and writes the new timestamp into the resource access instruction.

[0047] Step 13: Based on the resource access instruction, use the server's private key to perform a digital signature calculation on it using a digital signature algorithm to generate a server digital signature. Specifically, for the constructed resource access instruction, the MCP server will retrieve its own server private key from its local key storage area and load a preset digital signature algorithm. This algorithm will first hash the resource access instruction to generate a corresponding message digest; then, it will use the server's private key to encrypt the message digest. Through this series of processes, a server digital signature uniquely corresponding to the resource access instruction will be generated.

[0048] Step 14: Based on the server's digital signature and resource access instructions, an access request containing the server's digital certificate, digital signature, and resource access instructions is sent to the target resource via a secure transmission protocol. The server's digital certificate contains the MCP server's public key information and identity identifier. Specifically, after obtaining the server's digital signature and resource access instructions, the MCP server retrieves its own server digital certificate from the certificate storage area. This server digital certificate contains the MCP server's public key information and a unique identity identifier used to identify the server. Subsequently, the MCP server encapsulates the server digital certificate, the generated server digital signature, and the resource access instructions into the same data structure according to a preset message format to form a complete access request. Then, the MCP server activates a preset secure transmission protocol to establish a secure transmission channel corresponding to the target resource's network address, and then sends the constructed access request to the target resource's access interface through this secure transmission channel.

[0049] In this embodiment of the invention, by parsing the target resource identifier and determining its network address and access interface, the MCP server can accurately locate the target system resource, avoiding incorrect access due to ambiguous resource identifiers or parsing errors, thus laying an accurate foundation for the accurate transmission of subsequent instructions. The new timestamp mechanism based on a trusted time source ensures the authority and uniformity of time information, effectively avoiding timestamp verification deviations caused by asynchronous local times of various entities. Simultaneously, the new timestamp is distinguishable from the timestamp of the agent's original request, allowing the target resource to clearly identify the instruction as a valid instruction forwarded by the MCP server. By signing the resource access instruction with the server's private key, the identity of the MCP server is deeply bound to the instruction, enabling the target resource to directly confirm whether the instruction comes from a legitimate MCP server after receiving it by verifying the signature. Sending the access request with the server's digital certificate and a secure transmission protocol provides the target resource with the public key information and identity identifier required to verify the server's identity, and also prevents the access request from being eavesdropped on or tampered with during transmission through a secure transmission channel. This provides protection from both identity verification and transmission security perspectives, ensuring that the access request arrives at the target resource securely and completely.

[0050] In a preferred embodiment of the present invention, step 2 above includes:

[0051] Step 21: After receiving the access request from the MCP server, the target resource parses the request content to obtain the server's digital certificate. It then verifies the legitimacy of the issuing authority of the digital certificate against the Certificate Authority Trust List and checks that the certificate's validity period is valid, thus obtaining a verified server digital certificate. Specifically, after receiving the access request from the MCP server, the target resource starts a request parsing program to parse the request and extract the included server digital certificate. Next, the target resource retrieves the locally stored Certificate Authority Trust List and compares the issuing authority information recorded in the server digital certificate with the information in the trust list to verify whether the issuing authority is within the trusted scope. Simultaneously, the target resource checks the start and end times of the validity period recorded in the server digital certificate to determine if the current time is within the validity period. Through the above verification, the server digital certificate is confirmed to be legitimate and valid, thus obtaining a verified server digital certificate.

[0052] Step 22: Based on the verified server digital certificate, extract the MCP server public key information contained therein. Using this public key, decrypt and verify the server digital signature in the access request using an asymmetric decryption algorithm to confirm the integrity and authenticity of the resource access instruction, thus obtaining a verified server digital signature. Specifically, after obtaining the verified server digital certificate, the target resource extracts the MCP server public key information from the certificate; then, the target resource loads a preset asymmetric decryption algorithm and uses the extracted MCP server public key to decrypt the server digital signature contained in the access request, obtaining the corresponding message digest through decryption. Simultaneously, the target resource performs hash calculation on the resource access instruction to generate a new message digest; the two message digests are compared. If they match, it is confirmed that the resource access instruction has not been tampered with and originates from a legitimate MCP server, thus confirming the integrity and authenticity of the resource access instruction, and thereby obtaining a verified server digital signature.

[0053] Step 23: Based on the verified server digital signature, parse the timestamp information in the resource access instruction, and use a time window verification algorithm to verify the timeliness of the timestamp. Confirm that the instruction is within the valid time range, and obtain the result that the server timestamp timeliness verification is passed. Specifically, based on the verified server digital signature, the target resource will parse the resource access instruction and extract the timestamp information contained therein. Then, the target resource will activate the time window verification algorithm. This algorithm will first obtain the current system time of the target resource, and then determine the start and end range of the time window according to the preset valid time threshold. The extracted timestamp is compared with the time window. If the timestamp is within the time window range, the resource access instruction is confirmed to be within the valid time, that is, the timeliness of the instruction is confirmed, thus obtaining the result that the server timestamp timeliness verification is passed.

[0054] Step 24: Based on the successful verification of the server timestamp validity, combined with the successful verification of the server digital certificate and the server digital signature, the final processing result of successful MCP server identity authentication and successful digital signature verification is confirmed. Specifically, after obtaining the successful verification of the server timestamp validity, the target resource will summarize and judge the three verification results by combining the previous successful verification status of the server digital certificate and the successful verification status of the server digital signature. When all three verification results are successful, the target resource finally confirms that the MCP server's identity is legitimate and the digital signature it sent is valid, that is, the processing result of successful MCP server identity authentication and successful digital signature verification is obtained.

[0055] In this embodiment of the invention, by verifying the legitimacy and validity of the issuing authority of the server's digital certificate, it can be ensured that the access requests received by the target resource come from an MCP server that has been certified by a trusted authority and is in a valid state, thus preventing the target resource from responding to instructions from untrusted servers. Based on the verified server digital certificate, the public key is extracted, and the server's digital signature is decrypted and verified. The correspondence between the public and private keys can confirm that the digital signature was indeed generated by the corresponding MCP server. At the same time, by verifying the consistency between the signature and the resource access instruction, it is ensured that the resource access instruction has not been tampered with during transmission. The time window verification algorithm is used to verify the timeliness of the timestamp in the resource access instruction. By setting a reasonable time window range, it can be determined whether the instruction was sent within the valid time, effectively resisting replay attacks. By combining the verification results of the server digital certificate, digital signature, and timestamp, the identity of the MCP server and the validity of the signature are finally confirmed. Through the superposition effect of multi-dimensional verification, a complete security verification closed loop is formed, ensuring that only legitimate access requests that have undergone comprehensive verification can be recognized by the target resource.

[0056] In a preferred embodiment of the present invention, step 3 above includes:

[0057] Step 31: Based on the successful authentication of the MCP server and the successful verification of the digital signature, the target resource executes the operation instructions defined in the resource access instruction, generating the original execution result data, specifically including:

[0058] The target resource here is the backend customer transaction database that the intelligent customer service system needs to access. After verifying the legitimacy of the MCP server through its own verification logic, that is, after confirming that the server's digital certificate is issued by a trusted authority and is within its validity period, and that the digital signature matches the resource access instruction without tampering, the internal instruction execution and data generation process is initiated. First, the initialization operation is completed, and the preset instruction parsing rule base is loaded. This rule base contains the operation instruction format, database field mapping relationship and data permission verification standard specified by the MCP protocol. At the same time, the historical verification log of communication with the MCP server is retrieved to confirm that this access is a continuous and legitimate session, and to avoid illegal reconnection after the session is interrupted.

[0059] Next, the operation instructions in the resource access instructions are analyzed in depth. From the instruction fields, the following are extracted: operation type identifier (here, the operation type identifier is a customer transaction record query), target customer unique identifier (e.g., customer ID number 110101XXXX0101XXXX or customer ID in the system, such as IDCUST202405XXXX), time range conditions (e.g., the past month, which will be automatically converted to a specific time interval; for example, if the current time is May 20, 2024, the converted time interval is from 00:00:00 on April 20, 2024 to 23:59:59 on May 20, 2024), and the required return value. The system retrieves a list of transaction fields (such as transaction time, transaction amount, transaction channel, transaction object, and transaction status); it also performs validity checks on the parsed content, including whether the customer identifier conforms to the database storage format (e.g., the ID number must be 18 digits, and the customer ID must be CUST plus 8 digits), whether the time range is valid (the start time must not be later than the end time, and the end time must not be later than the current system time), and whether the field list is within the range allowed for database queries (excluding sensitive fields such as the complete customer bank card number and password hash value). If the verification fails, a temporary result indicating invalid command parameters is generated; if the verification passes, the system proceeds to the data query stage.

[0060] Subsequently, a call is initiated to the database's internal customer transaction data query interface V3.1 (this interface is a dedicated interface pre-set by the database, and can only be called by authenticated external systems such as the MCP server through legitimate commands); when initiating the call, the parsed legitimate parameters (customer ID, time range, field list) are encapsulated into a query request packet according to the interface's required format, and an interface call credential is attached (this credential contains the target resource's internal identity identifier DB-CUST-TRADE-001 and the temporary authorization code for this session) to ensure that the interface only responds to requests from this legitimate session; after receiving the request packet, the interface first verifies the validity of the credential (temporary authorization code). The system checks whether the authorization code is valid and whether it is bound to the MCP server session. Then, it locates the customer's dedicated data partition in the database based on the customer ID (the database uses a partitioned storage method, with each customer's transaction data stored independently in the corresponding partition, which improves query efficiency and enhances data security). The query logic is then executed, traversing all records in the transaction record table within the partition that match the time range, filtering out field data that matches the field list, and filtering out abnormal data (such as invalid records with negative transaction amounts or incomplete transaction status exceeding 72 hours). Finally, 35 customer transaction records that meet the criteria are extracted.

[0061] During the generation of raw data, a geometric feature hashing algorithm preprocessing flow is simultaneously initiated to perform geometric feature association processing on the extracted transaction record data: First, key numerical fields are selected from each transaction record (such as transaction amount, e.g., 198.50 yuan, 5000.00 yuan, which will be converted into integer forms 19850, 500000 to avoid floating-point errors; and the transaction timestamp, which will be converted from the transaction time 14:30:21 on April 25, 2024 to the Unix timestamp 1714060221). Then, these two values ​​of each record are mapped to a feature point in two-dimensional space, where the converted integer of the transaction amount is used as the x-coordinate of the feature point, and the transaction timestamp is used as the y-coordinate of the feature point (for example, if a record has a transaction amount of 198.50 yuan and a timestamp of 1714060221, the corresponding feature points are XXXXXX and XXXXXXXXXX). Then, the spatial distribution characteristics of all 35 feature points are calculated: First, the center point coordinates of the feature points are calculated by summing all x-coordinates and dividing by 35 to obtain the center point x-value, and summing all y-coordinates and dividing by 35 to obtain the center point y-value; Second, the distance from each feature point to the center point is calculated, based on the distance calculation method between two points in a rectangular coordinate system, that is, the square root of the sum of the square of the difference between the x-coordinates and the square of the difference between the y-coordinates of the two points; Third, after arranging the feature points in ascending order by transaction timestamp, the angle formed between two adjacent feature points and the center point is calculated, with the center point as the origin and the x-axis as the positive direction, and the angle range is determined by the direction of the line connecting adjacent feature points and the center point; Finally, these spatial feature information are encapsulated into a geometric feature preprocessing field, which includes the total number of feature points (35), center point coordinates (XXXXXX and XXXXXXXXXX), average distance (XXXXX), and angle deviation range (XX° to XX°).

[0062] Finally, the three parts are integrated into the original execution result data through the instruction execution and data generation process. The first part is the basic information segment, which includes the instruction ID of this query (this ID is consistent with the resource access instruction ID sent by the MCP server and is used for association matching), the query execution time (e.g., 15:02:30 on May 20, 2024), and 35 valid data records. The second part is the transaction record data segment, which stores 35 transaction records in a structured form (e.g., a tabular data structure). Each record contains five fields: transaction time, transaction amount, transaction channel, transaction object, and transaction status. The field values ​​are consistent with the original database storage and have not been tampered with. The third part is the geometric feature preprocessing segment, which is the geometric feature preprocessing field encapsulated above. The integrated original execution result data is checked for integrity. After confirming that there are no missing parts, no errors in field mapping, and that the number of feature points is consistent with the number of transaction records, it is stored in the temporary data cache area of ​​the target resource (this cache area is only visible to this session and will be automatically cleared after the session ends), thus completing the generation of the original execution result data.

[0063] Step 32: Based on the original execution result data, a data segmentation algorithm is used to divide it into segments, resulting in segmented execution result data, specifically including:

[0064] The target resource first performs byte count and analysis on the raw execution result data stored in the temporary data cache. The test results show that the raw execution result data contains three parts: a basic information segment of about 280 bytes, a transaction record data segment storing 35 transaction records (each record contains 5 fields, averaging about 65 bytes per record) totaling about 2275 bytes, and a geometric feature preprocessing segment of about 420 bytes, for a total data volume of about 2975 bytes. The system's preset maximum transmission threshold for a single block of data is 1024 bytes. The current total data volume exceeds this threshold. Direct transmission may easily lead to network transmission timeouts or data packet loss. Therefore, it is necessary to start the block processing process.

[0065] Upon entering the block processing flow, the structure mapping rules of the original execution result data are first loaded, mapping the original execution result data into a virtual two-dimensional data plane according to functional areas. The rows of the two-dimensional data plane correspond to the functional partitions of the original data, and the columns correspond to the number of data units within each functional partition. The specific mapping logic is as follows: the first row is allocated to the basic information segment. Because the basic information segment is indivisible metadata (containing instruction ID, query execution time, and the number of valid data entries), this row has a single-column structure, corresponding to the first row and first column area in the two-dimensional plane. The second row is allocated to the transaction record data segment, which contains 35 structured transaction records. Based on the maximum transmission threshold for a single block, each column... It can hold a maximum of 12 transaction records (12 records are approximately 780 bytes, less than the 1024-byte threshold), so this row has a three-column structure, corresponding to the three regions of the second row and first column, the second row and second column, and the second row and third column in the two-dimensional plane; the third row is allocated to the geometric feature preprocessing section, which is the feature data that cannot be divided as a whole (including the total number of feature points, center point coordinates, average distance, and the range of included angle deviation), so this row has a single-column structure, corresponding to the region of the third row and first column in the two-dimensional plane; finally, the entire original execution result data is mapped to a virtual two-dimensional data plane of 3 rows and 4 columns, which is divided into 5 non-overlapping grid cells (1 in the first row, 3 in the second row, and 1 in the third row).

[0066] Subsequently, the two-dimensional data plane is physically divided according to the preset grid size (row height corresponds to the byte length of each functional partition, and column width corresponds to the maximum number of bytes of data in a single column within each functional partition), forming 5 independent grid units. During the cutting process, the number of bytes in each grid unit is checked in real time: the first grid unit in the first row and first column (corresponding to the basic information segment) has approximately 280 bytes, which meets the threshold requirement; the second grid unit in the first row and first column (corresponding to the first 12 transaction records) has approximately 780 bytes, the second grid unit in the second row and second column (corresponding to the middle 12 transaction records) has approximately 780 bytes, and the third grid unit in the second row and third column (corresponding to the last 11 transaction records) has approximately 715 bytes, all of which meet the threshold requirement; the third grid unit in the first row and first column (corresponding to the geometric feature preprocessing segment) has approximately 420 bytes, which meets the threshold requirement.

[0067] After segmentation, the corresponding data content is extracted from each grid cell: Complete basic information segment data is extracted from the first row, first column grid cell, including instruction ID, query execution time, and number of valid data entries; complete field data for transaction records 1 to 12 is extracted from the second row, first column grid cell (each record includes transaction time, transaction amount, transaction channel, transaction object, and transaction status); complete field data for transaction records 13 to 24 is extracted from the second row, second column grid cell; complete field data for transaction records 25 to 35 is extracted from the second row, third column grid cell; and complete geometric feature preprocessing segment data is extracted from the third row, first column grid cell, including the total number of feature points, center point coordinates, average distance, and angle deviation range.

[0068] Next, unique identifiers are added to each extracted data block: First, grid coordinate identifiers, in the format of row number-column number, where the block identifier corresponding to the grid cell in the first row and first column is row 1 column 1, the block identifier corresponding to the grid cell in the second row and first column is row 2 column 1, the block identifier corresponding to the grid cell in the second row and second column is row 2 column 2, the block identifier corresponding to the grid cell in the second row and third column is row 2 column 3, and the block identifier corresponding to the grid cell in the third row and first column is row 3 column 1; Second, block sequence number, arranged according to the row priority order of the grid cells in the two-dimensional plane, where row 1 column 1 is block 1, row 2 column 1 is block 2, row 2 column 2 is block 3, row 2 column 3 is block 4, and row 3 column 1 is block 5; Third, total grid quantity identifier, clearly indicating that the total number of grid cells in this block is 5. The identifier information of each block is added to the header of the block data, forming an identifier header plus data body structure, where the identifier header contains three fields: grid coordinates, block sequence number, and total grid quantity, and the data body is the original data content extracted from the corresponding grid cell.

[0069] Finally, perform integrity checks on all segmented data: verify that the identifier information of each segment is unique and without duplication, and that the data body of each segment completely contains all the data of the corresponding grid cell (for example, segment 2 needs to be confirmed to contain all fields of transaction records 1 to 12 without any missing data). After merging the data bodies of all segments, verify that they are completely consistent with the original execution result data (by comparing the number of bytes and verifying key fields). After the verification is passed, store the five segmented execution result data with grid coordinate identifiers in the segmented data cache of the target resource. The cache is stored in order of segment number.

[0070] Step 33: Based on the segmented execution result data, add the current timestamp information to construct response data containing the segmented execution results and timestamps, specifically including:

[0071] The target resource first establishes a connection with a trusted time server designated by the system via a preset network protocol to synchronize its time. After the connection is established, it sends a time request command to the trusted time server to request the current standard time. Upon receiving the request, the trusted time server returns time data containing year, month, day, hour, minute, second, and microsecond-level precision, along with its own timestamp signature (used to verify that the time data has not been tampered with). After receiving the time data, the target resource first verifies the validity of the server's timestamp signature to confirm that the time data originates from the trusted server and has not been modified. Then, it compares the received standard time with the target resource's local system time to calculate the time deviation. If the deviation is less than a preset allowable deviation threshold (e.g., 50 milliseconds), the standard time is directly used as the current timestamp. If the deviation exceeds the threshold, a local time calibration process is initiated to adjust the local system time to match the standard time before obtaining the calibrated time as the current timestamp. The final timestamp format is YYYY-MM-DDHH:MM:SS.ssssss, for example, 2024-05-2015:05:42.123456. This timestamp will be used to mark the generation time of the response data.

[0072] Subsequently, response data is constructed according to the preset response data structure template. The template defines that the response data must include three core parts: header metadata, block data, and verification information. Each part must be arranged in a fixed order to ensure that the receiver can parse it correctly.

[0073] When constructing the header metadata, first, the timestamp obtained above is filled into the timestamp field of the header metadata; then, the total grid size information is extracted from the segmented execution result data generated in step 32. Since the original execution result data in step 32 is mapped to a virtual two-dimensional data plane of 3 rows and 4 columns, the total grid size is recorded as 3 rows and 4 columns and filled into the corresponding field; finally, the total number of segmented execution result data is counted. Step 32 generates a total of 5 data blocks, so the total number of blocks is recorded as 5 and filled into the corresponding field. At the same time, the header metadata also needs to add a response data identifier field. This field is a randomly generated unique string (32 bits long) used to uniquely identify the response data generated this time and avoid confusion with other response data; finally, the header metadata contains four fields: timestamp, total grid size, total number of blocks, and response data identifier. The fields are arranged in the order of response data identifier, timestamp, total grid size, and total number of blocks.

[0074] When constructing the segmented data section, the five segmented execution result data generated in step 32 are read from the segmented data cache and arranged in a row-major order according to the grid coordinates (i.e., first by row number from smallest to largest, and then by column number from smallest to largest within the same row). The specific arrangement order is as follows: first, segment 1 (basic information segment data) corresponding to row 1, column 1 is arranged; then segment 2 (transaction records 1 to 12) corresponding to row 2, column 1 is arranged; then segment 3 (transaction records 13 to 24) corresponding to row 2, column 2 is arranged; and finally segment 4 (transaction records 1 to 24) corresponding to row 2, column 3 is arranged. (Transaction records 25 to 35), finally arrange the block 5 (geometric feature preprocessing segment data) corresponding to row 3 and column 1; at the beginning of each block data, retain the grid coordinate identifier, block number, and total grid quantity identifier added in step 32 to ensure that the receiver can clearly understand the position of each block in the original data plane and the overall block situation; after the arrangement is completed, the block data part forms a continuous data stream, and each block is distinguished by a preset separator (a fixed character sequence of 8 characters in length) to avoid parsing errors after the block data is spliced.

[0075] When constructing the verification information section, a geometric feature hash algorithm is used. First, each block of the segmented data section is traversed to extract data related to spatial features: for blocks 2, 3, and 4 (all transaction record data blocks), the coordinates of the feature points corresponding to the transaction records within each block are extracted (i.e., the integer converted from the transaction amount and the Unix timestamp corresponding to the transaction timestamp); for blocks 1 (basic information segment) and 5 (geometric feature preprocessing segment), the grid coordinate identifiers and key metadata of the blocks are extracted (such as the instruction ID of block 1 and the total number of feature points in block 5); then, all the extracted data is integrated according to the block arrangement order. A dataset containing the association between spatial feature points and metadata is formed. Then, a hash calculation is performed on the dataset. During the calculation, the numerical data in the dataset (such as feature point coordinates and grid coordinates) is first converted into a fixed-length byte stream, and the non-numerical data (such as instruction IDs) is converted into a byte stream according to a preset encoding rule. Finally, all byte streams are concatenated, and a fixed-length (such as 256 bits) hash value is generated by a geometric feature hash algorithm. This hash value is the geometric feature check code of the entire response data. After the check code is generated, local verification is also performed. The check code is compared with the recalculated dataset hash value to confirm that the check code was generated correctly.

[0076] Finally, the header metadata, chunked data, and checksum information are concatenated in the following order to form complete response data. After concatenation, the response data undergoes overall byte count and structural checks to confirm that the total number of chunks in the header metadata matches the actual number of chunks in the chunked data, that the chunked data is arranged in a row-major order according to the grid coordinate system, and that the geometric checksum format of the checksum information is correct and passes verification. After passing the checks, the complete response data is stored in the response data cache of the target resource.

[0077] Step 34: Based on the response data containing the segmented execution results and timestamps, use the target resource's private key to perform a digital signature calculation using a digital signature algorithm to generate a digital signature for the target resource. Specifically, this includes:

[0078] The target resource first establishes a connection with the local hardware security module (a dedicated physical device for storing encryption keys, equipped with tamper-proof and mandatory access control functions). It then sends a key retrieval request to the hardware security module, containing the target resource's device identifier and the authorization token for this signing operation. The authorization token is generated in real-time by the target resource's security chip and includes the operation time and a unique device code. The hardware security module verifies the legitimacy of the device identifier and authorization token. After confirming the request originates from an authorized operation, it unlocks the encrypted partition storing the target resource's private key and transmits the private key to the target resource as an encrypted data stream. Hardware-level encryption is used during transmission to prevent key theft. Upon receiving the private key, the target resource temporarily decrypts and verifies its validity in memory: checking if the key format conforms to the preset asymmetric encryption standard and confirming that the key's expiration date is within the validity period. If everything is correct, the key is temporarily stored in an encrypted buffer in memory, avoiding persistent storage to prevent leakage.

[0079] Simultaneously, the target resource loads a digital signature algorithm that integrates geometric features (this algorithm consists of two parts: the basic part is an asymmetric signature algorithm that conforms to national cryptographic standards, used to implement traditional digital signature functions; the extended part is geometric feature fusion logic, used to embed spatial feature information into the signature process). Before loading, the integrity of the algorithm program is verified: the hash value of the algorithm program is compared with the preset benchmark value to confirm that the algorithm has not been tampered with; then the algorithm's running environment is initialized, and independent memory space and computing resources are allocated to prevent resource conflicts with other processes and ensure the independence and security of the signature calculation process.

[0080] In the hash processing stage, the target resource reads the complete response data from the response data buffer. The entire response data is converted into a continuous binary byte stream in the order of header metadata, block data, and verification information. At the same time, the total length of the byte stream and the starting offset of each part are recorded. Then, traditional hash calculation is performed: using a hash function that matches the basic part of the algorithm, the extracted byte stream is segmented according to the maximum processing unit specified by the algorithm (e.g., 64 bytes). Iterative hash operation is performed on each segment in turn to generate a fixed-length byte stream hash value (e.g., 256 bits). This hash value uniquely corresponds to the original content of the response data.

[0081] Then, the geometric feature fusion process is initiated. The geometric feature check code generated in step 33 is extracted from the check information part of the response data. The check code is converted into a binary sequence with the same length as the byte stream hash value. Through the preset fusion rules (performing logical operations bit by bit, performing XOR operations on the corresponding bits of the byte stream hash value and the geometric feature check code), a composite message digest containing data content and spatial features is generated. After the composite message digest is generated, its format is checked to see if it meets the algorithm requirements and whether there are any outliers, to ensure that the subsequent encryption process can proceed normally.

[0082] After generating the composite message digest, the encryption process begins: the target resource's private key is retrieved from the memory's encryption buffer, and the composite message digest is encrypted using the asymmetric encryption mechanism of the algorithm's foundation. During encryption, the composite message digest is first grouped according to the key length. Mathematical operations are performed on each group using the private key. During these operations, temporary random numbers generated by a random number generator are used (to enhance the signature's anti-forgery capabilities). After multiple rounds of computation, a continuous string of binary data is generated, forming the initial digital signature. Simultaneously, key parameters during the encryption process (including the random number and the number of computation rounds) are recorded for parameter matching during subsequent verification.

[0083] To ensure the validity of the signature, the target resource initiates geometric feature reverse verification: First, it extracts the public key from its own digital certificate (this public key and the previously used private key are an asymmetric key pair), uses the public key to decrypt the preliminary digital signature, and restores the original composite message digest by performing the inverse operation corresponding to the encryption process; then, it reverses the restored composite message digest according to the fusion rules to obtain the original byte stream hash value and geometric feature check code.

[0084] The two parts are checked separately: For the byte stream hash value, the response data is re-hash-calculated, and the newly generated hash value is compared with the split byte stream hash value to confirm that the two are completely consistent; for the geometric feature check code, the original geometric feature check code is extracted from the check information of the response data and compared with the split check code to confirm that the two are completely consistent; if both parts pass the check, the preliminary digital signature is determined to be valid; if any part is inconsistent, the signature is determined to be invalid, and the signature generation process needs to be restarted to check for anomalies in the hash calculation or encryption process (such as data transmission errors, key call anomalies, etc.).

[0085] After successful verification, the initial digital signature undergoes format conversion: the binary data is converted into an encoding format conforming to transmission standards (such as Base64 encoding), and signature identification information is added (including the signature algorithm version, generation time (consistent with the timestamp of the response data), and feature fusion identifier (used to indicate that the signature contains geometric feature information)). The final generated target resource digital signature is composed of the encoded signature data and identification information combined in a fixed structure to ensure that the recipient can correctly parse the signature content. This digital signature is stored in a signature cache and associated with the response data (achieving fast matching through the response data identifier), preparing for subsequent encapsulation operations.

[0086] Step 35: Based on the target resource's digital signature and the constructed response data, send the operation response, containing the target resource's digital certificate, digital signature, and response data, to the MCP server via a secure transmission protocol. The target resource's digital certificate contains the target resource's public key information and identity identifier, specifically including:

[0087] The target resource first undergoes a certificate retrieval operation, connecting to a local encrypted certificate repository (this repository is divided into different partitions according to resource type; the customer transaction database certificate corresponding to the target resource is stored in a dedicated database certificate partition, which is protected by a hardware dongle and requires multi-factor authentication for access). A certificate retrieval request is sent to the encrypted certificate repository, carrying the target resource's unique device code, the current session ID, and its own authorization certificate. The encrypted certificate repository verifies the request information: first, it checks if the unique device code matches the target resource code pre-stored in the repository; then, it verifies if the session ID is a valid current session (bound to the communication session with the MCP server); finally, it verifies the validity of the authorization certificate (whether it was issued by the system security center and is within its validity period). After successful verification, the encrypted certificate repository unlocks the database certificate partition, extracts the target resource's digital certificate, and transmits it to the target resource through an encrypted channel.

[0088] After receiving the digital certificate, the target resource performs integrity and legality verification on the certificate content: First, it checks whether the certificate format conforms to the X.509 standard, confirming that the certificate contains fields such as version number, serial number, signature algorithm identifier, issuing authority name, validity period, target resource subject name, subject public key information, and issuing authority signature; then, it verifies the issuing authority signature by retrieving the locally stored trusted issuing authority root certificate public key, decrypting the issuing authority signature, and comparing it with the hash value of the certificate subject information to confirm that the certificate has not been tampered with; next, it checks the certificate validity period by comparing the current time with the start and end times in the certificate to ensure that the certificate is valid; finally, it queries the certificate revocation list to confirm that the certificate has not been revoked by the issuing authority. After successful verification, it extracts key information from the certificate (including the target resource's identity identifier, i.e., the system unique ID of the customer transaction database, such as DB-CUST-TRADE-001, and the subject public key data conforming to the RSA 2048-bit encryption standard), and temporarily stores the complete certificate in the certificate cache area.

[0089] Subsequently, the target resource encapsulates the operation response according to the system's preset operation response message format template (the template defines the message as divided into three parts: message header, message middle, and message tail. Each part is divided into fixed byte lengths and includes field identifiers and length identifiers to facilitate parsing by the MCP server):

[0090] When encapsulating the message header, the target resource digital certificate is read from the certificate cache, and the certificate data is completely written into the certificate field of the message header. At the same time, a certificate length field (recording the total number of bytes of the certificate, such as 2048 bytes), a message version number field (the current version is V2.1), and a message type identifier field (identifying that the message is an operation response, with a type code of 0x02) are added to the header. The header fields are arranged in the order of version number, message type, certificate length, and certificate data, and the total length is fixed at 2080 bytes.

[0091] When encapsulating the middle part of the message, the digital signature of the target resource is read from the signature buffer, and the signature data (including the encoded signature content and identification information) is written into the signature field in the middle part of the message. At the same time, a signature length field (recording the number of bytes of the signature, such as 512 bytes) is added. Then, the complete response data is read from the response data buffer and written into the response data field in the middle part. A response data length field (recording the total number of bytes of the response data, such as 3200 bytes) is added. The middle fields are arranged in the order of signature length, signature data, response data length, and response data. The length is dynamically adjusted according to the actual number of bytes of the signature and response data. A 4-byte separator is added between the fields to avoid data splicing confusion.

[0092] When encapsulating the message trailer, transmission check information is generated based on the spatial grid segmentation algorithm: First, the sum of grid coordinates of each block is calculated. The grid coordinates of the five blocks in step 32 (row 1 column 1, row 2 column 1, row 2 column 2, row 2 column 3, row 3 column 1) are converted into numerical values ​​(11, 21, 22, 23, 31) according to the rule of row number × 10 + column number. The sum is obtained as 11 + 21 + 22 + 23 + 31 = 108, which is used as the grid coordinate sum field. Then, the expected receiving order field is determined and recorded in row priority order. Record the grid coordinate sequence of the block (row 1 column 1 - row 2 column 1 - row 2 column 2 - row 2 column 3 - row 3 column 1); finally, calculate the overall CRC32 check value of the message, perform CRC32 operation on all data in the message header and middle, and obtain a 4-byte check value; the tail field is arranged in the order of grid coordinate sum, expected receiving order, and overall CRC32 check value, with a fixed total length of 64 bytes (4 bytes of coordinate sum + 40 bytes of receiving order + 4 bytes of CRC32 check value + 16 bytes reserved).

[0093] After encapsulation, the target resource performs an integrity check on the entire operation response message: verifying whether the certificate length in the message header matches the actual number of bytes in the certificate, whether the signature length and response data length in the middle match the actual number of bytes in the corresponding data, and whether the sum of the grid coordinates at the end matches the calculated block coordinates. If the checks pass, the operation response message is stored in the transmission buffer.

[0094] Next, the target resource establishes an encrypted communication channel with the MCP server using the TLS secure transport protocol: First, it sends a TLS handshake request to the MCP server, which includes the TLS version supported by the target resource (TLS 1.3 is preferred), a list of cipher suites (supporting security suites such as ECDHE-ECDSA-AES256-GCM-SHA384), and a random number A; The MCP server returns a TLS handshake response, which includes the selected TLS version (TLS 1.3), the selected cipher suite (ECDHE-ECDSA-AES256-GCM-SHA384), a random number B, and the MCP server's digital certificate; The target resource verifies the MCP server certificate (by verifying the certificate signature using the trusted issuing authority's root certificate public key, checking the certificate's validity and revocation status, and after confirming the MCP server's legitimacy, extracting the MCP server's public key from the certificate).

[0095] Subsequently, the target resource uses the ECDHE algorithm to generate a temporary key pair, encrypts the public key portion using the MCP server's public key, and sends it to the MCP server. Upon receiving the public key, the MCP server decrypts it using its own private key to obtain the temporary public key. Both parties then calculate and generate a session key (used for subsequent encrypted data transmission) based on random number A, random number B, and the temporary key pair. The target resource and the MCP server exchange session key verification information. After confirming that the session keys generated by both parties are consistent, the encrypted communication channel is established, and all subsequent transmitted data is encrypted using the session key with AES256-GCM.

[0096] During transmission, the target resource adopts a block transmission mechanism, splitting the operation response message in the transmission buffer into blocks of 1024 bytes each, encrypting each block, and sending them to the designated receiving port of the MCP server (port number 8443, designed specifically for secure communication of the MCP protocol). After each block is transmitted, the MCP server returns block reception confirmation information (including the reception status of the block, such as success or failure, and the block sequence number). The target resource performs real-time verification simultaneously upon receiving confirmation: checking whether the block sequence number returned by the MCP server is consistent with the transmission order; if the corresponding block contains block data (response data blocks in the middle of the message), it further verifies whether the block grid coordinates corresponding to the block are within the preset 3x4 spatial grid range (e.g., if block 2 corresponds to row 2 and column 1, it needs to be confirmed that the row number ≤ 3 and the column number ≤ 4), and whether the coordinates are within the expected reception order. If the verification finds that the block sequence number is disordered or the grid coordinates are abnormal, the transmission is stopped immediately, and a retransmission request is sent to the MCP server to retransmit the abnormal block; if the abnormality is still found after 3 consecutive retransmissions, the transmission is terminated and the abnormality log is recorded, and an alarm message is sent to the system security center.

[0097] Once all blocks have been transmitted and received without error, the target resource sends a transmission completion notification to the MCP server (including the total number of blocks transmitted, the total number of bytes, and the overall CRC32 checksum at the end of the message). Upon receiving the notification, the MCP server reassembles all received blocks, calculates the CRC32 checksum of the reassembled message, compares it with the checksum sent by the target resource, and returns a transmission success response after confirming the message's integrity. After receiving the transmission success response, the target resource records the transmission log (including transmission time, MCP server address, message length, transmission time, and checksum result), clears temporary data in the transmission buffer, certificate buffer, and signature buffer, and completes the secure transmission of the response data.

[0098] In this embodiment of the invention, the operation instructions are executed based on the successful verification of the MCP server's identity and signature, ensuring that the target resource only responds to strictly authenticated and legitimate instructions. This safeguards the security and controllability of system resources during the execution phase, and the generated raw execution result data serves as the basis for subsequent responses. A data segmentation algorithm is used to divide the raw execution result data into multiple blocks, which facilitates subsequent data transmission and processing. A current timestamp is added to the segmented execution result data, giving the response data a time identifier. This timestamp, in conjunction with subsequent verification steps, allows the receiver to accurately determine the generation time of the response data, providing crucial evidence for verifying the timeliness of the response. The target resource is used... The private key is used to sign the response data, which includes the block execution results and timestamps. This tightly binds the identity of the target resource to the response data. The receiver can verify the signature using the corresponding public key to confirm that the response data does indeed come from the target resource and has not been tampered with during transmission, thus ensuring the authenticity, integrity, and reliability of the source of the response data. The target resource digital certificate, digital signature, and response data are integrated into an operation response and sent through a secure transmission protocol. The target resource digital certificate provides a public key and identity identifier for identity verification, while the secure transmission protocol ensures that the operation response is not tampered with during transmission. This provides protection from both identity verification and transmission security perspectives, enabling the MCP server to securely and accurately receive and process the response data.

[0099] In a preferred embodiment of the present invention, step 4 above includes:

[0100] Step 41: After receiving the operation response from the target resource, the MCP server parses the response content to obtain the target resource's digital certificate. It then verifies the legitimacy of the issuing authority of the digital certificate against the Certificate Authority Trust List and checks that the certificate's validity period is valid, thus obtaining the verified target resource digital certificate. Specifically, after receiving the operation response from the target resource, the MCP server starts a response parsing program to parse the response and extract the target resource's digital certificate. Next, the MCP server retrieves the locally stored Certificate Authority Trust List and compares the issuing authority information recorded in the target resource's digital certificate with the information in the trust list to verify whether the issuing authority is within the trusted scope. Simultaneously, the MCP server checks the start and end times of the validity period recorded in the target resource's digital certificate to determine if the current time is within that validity period. Through the above verification, the target resource's digital certificate is confirmed to be legitimate and valid, thus obtaining the verified target resource digital certificate.

[0101] Step 42: Based on the target resource digital certificate, extract the target resource public key information contained therein. Using this public key, decrypt and verify the target resource digital signature in the operation response using an asymmetric decryption algorithm to confirm the integrity and authenticity of the response data, thus obtaining a verified target resource digital signature. Specifically, after obtaining the verified target resource digital certificate, the MCP server extracts the target resource public key information from the certificate; then, the MCP server loads a preset asymmetric decryption algorithm and uses the extracted target resource public key to decrypt the target resource digital signature contained in the operation response, obtaining the corresponding message digest through decryption; simultaneously, the MCP server performs hash calculation on the response data to generate a new message digest, compares the two message digests, and if they match, it confirms that the response data has not been tampered with and originates from a legitimate target resource, thus confirming the integrity and authenticity of the response data, and thereby obtaining a verified target resource digital signature.

[0102] Step 43: Based on the verified target resource digital signature, the timestamp information in the response data is parsed, and the time window verification algorithm is used to verify the timeliness of the timestamp. This confirms that the response data is within the valid time range, thus obtaining the result that the target resource timestamp timeliness verification has passed. Specifically, based on the verified target resource digital signature, the MCP server parses the response data and extracts the included timestamp information. Then, the MCP server uses the time window verification algorithm. This algorithm first obtains the current system time of the MCP server, and then determines the start and end range of the time window based on a preset valid time threshold. The extracted timestamp is compared with the time window. If the timestamp is within the time window range, the response data is confirmed to be within the valid time, i.e., the timeliness of the response data is confirmed, thus obtaining the result that the target resource timestamp timeliness verification has passed.

[0103] Step 44: Based on the result of the target resource timestamp validity verification, combined with the pass status of the target resource digital certificate and target resource digital signature verification, the final processing result of successful target resource identity authentication and successful digital signature verification is confirmed. Specifically, after obtaining the result of the target resource timestamp validity verification, the MCP server will summarize and judge the three verification results by combining the previous pass status of the target resource digital certificate and the pass status of the target resource digital signature; when all three verification results are passed, the MCP server finally confirms that the target resource's identity is legitimate and its sent digital signature is valid, that is, the processing result of successful target resource identity authentication and successful digital signature verification is obtained.

[0104] In this embodiment of the invention, by verifying the legitimacy and validity of the issuing authority of the target resource digital certificate, it can be ensured that the operation response received by the MCP server comes from the target resource that has been certified by a trusted authority and is in a valid state. This filters out responses corresponding to certificates issued by illegal authorities or expired certificates from the source, preventing the MCP server from processing untrusted response data. Based on the verified target resource digital certificate, the public key is extracted, and the target resource digital signature is decrypted and verified. The correspondence between the public and private keys can confirm that the digital signature was indeed generated by the corresponding target resource. At the same time, by verifying the consistency between the signature and the response data, it is ensured that the response data has not been tampered with during transmission. The system is modified to ensure the integrity and authenticity of the response data; a time window verification algorithm is used to verify the timeliness of the timestamps in the response data. By setting a reasonable time window range, it can determine whether the response data was generated within the valid time, effectively resisting replay attacks targeting the response data; by combining the verification results of the target resource's digital certificate, digital signature, and timestamp, the system ultimately confirms the identity of the target resource and the validity of the signature. Through the superposition effect of multi-dimensional verification, a complete response verification closed loop is formed, ensuring that only fully verified legitimate response data can be recognized and forwarded by the MCP server, thereby improving the MCP server's overall security screening capability for response data.

[0105] In a preferred embodiment of the present invention, step 5 above includes:

[0106] Step 51: Based on the successful authentication of the target resource and the successful verification of the digital signature, the MCP server extracts the execution result data from the verified response data. Specifically, when the target resource is successfully authenticated and the digital signature is verified, the MCP server processes the verified response data, starts a data parsing program to break down the response data, and filters and extracts the execution result data that accurately reflects the execution of the operation instructions.

[0107] Step 52: Based on the execution result data, construct an agent response message containing the execution result and a forwarding timestamp. The forwarding timestamp is obtained from a trusted time source using a time synchronization protocol. Specifically, the MCP server activates the message construction module based on the extracted execution result data. This module constructs the message according to the pre-defined agent response message format in the system. First, the execution result data is filled into the corresponding fields in the message according to the format requirements. After this step, the MCP server establishes a communication connection with the trusted time source using the time synchronization protocol. The current standard time is obtained from the trusted time source through this connection and used as the forwarding timestamp. Then, this forwarding timestamp is added to the dedicated time field in the agent response message. Through this operation, a complete agent response message containing the execution result and the forwarding timestamp is formed.

[0108] Step 53: Based on the agent's response message, forward it to the agent through a secure transmission protocol to complete this authentication interaction process. Specifically, after generating the agent's response message, the MCP server will enable the system's preset secure transmission protocol and establish a secure communication link with the agent using this protocol. After the communication link is established, the MCP server will transmit the constructed agent's response message to the agent through the secure communication link. When the MCP server confirms that the agent has successfully received the response message, the complete authentication interaction process, from the agent initiating the request to the agent receiving the response, officially ends.

[0109] In this embodiment of the invention, execution result data is extracted based on the successful verification of the target resource's identity and signature. This ensures that the execution result forwarded by the MCP server to the agent comes from a strictly authenticated legitimate target resource, preventing the agent from making incorrect judgments due to the use of unverified or illegal result data, thus guaranteeing the reliability of the forwarded content from the data source. An agent response message containing the execution result and a forwarding timestamp is constructed, with the timestamp originating from a trusted time source, giving the response message a unified and authoritative time identifier. This design facilitates the agent's verification of the response's timeliness, preventing the receipt of expired or duplicate result data, and ensures the consistency of time information through a trusted time source, avoiding verification deviations caused by asynchronous times among entities, thereby improving the time reliability of the response message. The agent response message is forwarded to the agent through a secure transmission protocol. The encryption and protection mechanisms of the secure transmission protocol ensure that the response message is not tampered with or intercepted during transmission from the MCP server to the agent, guaranteeing the security and integrity of data transmission. Ultimately, this achieves secure interaction across the entire link from the target resource to the agent, completely closing the entire authentication process.

[0110] like Figure 2 As shown, embodiments of the present invention also provide a secure MCP protocol authentication system, comprising:

[0111] The sending module is used to parse the target resource identifier based on the processing result of successful agent identity authentication and digital signature verification. It constructs a resource access instruction containing agent identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends the access request containing the server's digital certificate, digital signature and resource access instruction to the target resource.

[0112] The verification module is used to receive access requests for the target resource, verify the legality of the MCP server's digital certificate, verify the digital signature using the server's public key, and verify the integrity and timeliness of the resource access instructions.

[0113] The response generation module is used to execute operation instructions on the target resource based on the processing result of successful identity authentication and digital signature verification on the MCP server, generate response data containing the execution result and timestamp, perform digital signature using the target resource's private key, and send the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server.

[0114] The verification module is used by the MCP server to receive operation responses, verify the legality of the target resource digital certificate based on the received response data, verify the digital signature using the target resource public key, and check the integrity and timeliness of the response data, so as to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed.

[0115] The forwarding module is used to forward the response data to the intelligent agent to complete the authentication process based on the successful authentication of the target resource identity and the successful verification of the digital signature.

[0116] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.

[0117] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0118] This invention aims to provide a technical-level security authentication solution, which is only used to standardize the interaction logic between intelligent agents, MCP servers and target resources. It does not involve specific privacy processing operations such as the collection, storage and use of user privacy data, nor does it assume any legal responsibility or risk caused by third parties illegally collecting or disclosing user privacy (such as customer transaction records).

[0119] The privacy-related examples such as "customer transaction records" and "customer identity identifiers" mentioned in this invention are merely technical parameters listed to illustrate the application scenarios of the technical solution, and do not represent that this invention has the function of acquiring and processing actual user privacy data. When actually applying the technology of this invention, the application party needs to establish a compliant privacy protection mechanism in accordance with relevant laws and regulations to ensure that the processing of user privacy data is legal, proper, and necessary.

[0120] Any user privacy leaks or data security incidents caused by failure to comply with relevant privacy protection laws and regulations, failure to establish a sound data security protection system, or by third-party attacks, system vulnerabilities, or other defects not related to the technology of this invention when using the technology of this invention are unrelated to the technical solution of this invention and the patent holder. The actual user shall bear the relevant responsibilities.

[0121] The above description represents the preferred embodiments 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.

Claims

1. A secure MCP protocol authentication method, characterized by, The method comprises: Step 1, based on the processing result of successful agent identity authentication and passed digital signature verification, the MCP server parses the target resource identifier, constructs a resource access instruction containing agent identity information, operation instruction and new timestamp, uses the server private key for digital signature, and sends an access request containing the server digital certificate, digital signature and resource access instruction to the target resource; Step 2, the target resource receives the access request, verifies the legality of the MCP server digital certificate, uses the server public key to verify the digital signature, and checks the integrity and timeliness of the resource access instruction; Step 3, based on the processing result of successful MCP server identity authentication and passed digital signature verification, the target resource executes the operation instruction, generates response data containing execution result and timestamp, uses the target resource private key for digital signature, and sends an operation response containing the target resource digital certificate, digital signature and response data to the MCP server, including: based on the processing result of successful MCP server identity authentication and passed digital signature verification, the target resource executes the operation instruction defined in the resource access instruction, generates original execution result data; based on the original execution result data, the data block algorithm is used for cutting processing to obtain the block execution result data; based on the block execution result data, the current timestamp information is added to construct the response data containing the block execution result and timestamp; based on the response data containing the block execution result and timestamp, the target resource private key is used to calculate the signature through the digital signature algorithm to generate the target resource digital signature; based on the target resource digital signature and the constructed response data, the operation response containing the target resource digital certificate, digital signature and response data is sent to the MCP server through the secure transmission protocol, wherein the target resource digital certificate contains the public key information and identity of the target resource; Step 4, the MCP server receives the operation response, based on the received response data, verifies the legality of the target resource digital certificate, uses the target resource public key to verify the digital signature, and checks the integrity and timeliness of the response data, and obtains the processing result of successful target resource identity authentication and passed digital signature verification; Step 5, based on the processing result of successful target resource identity authentication and passed digital signature verification, the MCP server forwards the response data to the agent to complete the authentication process.

2. The secure MCP protocol authentication method of claim 1, wherein, Before the agent identity authentication is successful and the digital signature verification is passed, it further comprises: The agent generates an MCP call request instruction containing a target resource identifier, an operation instruction and a timestamp, uses the private key of the agent to perform digital signature processing on the call request instruction by using an asymmetric encryption algorithm, generates an authentication request message containing an agent digital certificate, a digital signature and a call request instruction, and sends the authentication request message to the MCP server; After receiving the authentication request message, the MCP server acquires the digital certificate of the agent by analyzing the message content, verifies the legality and validity of the digital certificate according to the pre-configured access control strategy, decrypts and verifies the digital signature by using the public key of the agent and a cryptographic verification algorithm, and checks the data integrity and time stamp validity of the calling request instruction, to obtain a processing result that the agent identity authentication is successful and the digital signature verification is passed.

3. The secure MCP protocol authentication method of claim 2, wherein, Step 1 comprises: Based on the processing result that the agent identity authentication is successful and the digital signature verification is passed, the MCP server analyzes the target resource identifier contained in the calling request instruction, determines the network address and access interface of the target resource by using a resource identifier analysis algorithm; Based on the network address and access interface of the target resource, a resource access instruction containing the agent identity information, operation instruction and new time stamp is constructed, wherein the new time stamp is acquired from a trusted time source by using a time synchronization protocol; Based on the resource access instruction, a server digital signature is generated by signing the resource access instruction with a server private key by using a digital signature algorithm; Based on the server digital signature and the resource access instruction, an access request containing the server digital certificate, digital signature and resource access instruction is sent to the target resource by using a secure transmission protocol, wherein the server digital certificate contains the public key information and identity of the MCP server.

4. The secure MCP protocol authentication method of claim 3, wherein, Step 2 comprises: After receiving the access request sent by the MCP server, the target resource analyzes the request content to acquire the server digital certificate, verifies the legality of the certificate issuing authority of the digital certificate according to a certificate authority trust list, and checks that the certificate validity period is in a valid state, to obtain a server digital certificate that passes the verification; Based on the server digital certificate that passes the verification, the MCP server public key information contained in the server digital certificate is extracted, the server digital signature in the access request is decrypted and verified by using the public key through an asymmetric decryption algorithm, the integrity and authenticity of the resource access instruction are confirmed, and a server digital signature that passes the verification is obtained; Based on the server digital signature that passes the verification, the time stamp information in the resource access instruction is analyzed, the time stamp is checked for validity by using a time window verification algorithm, it is confirmed that the instruction is within the valid time range, and a result that the server time stamp validity verification is passed is obtained; Based on the result that the server time stamp validity verification is passed, the MCP server identity authentication is finally confirmed to be successful and the digital signature verification is passed, in combination with the passing state of the server digital certificate and the server digital signature verification.

5. The secure MCP protocol authentication method of claim 4, wherein, Step 4 comprises: After receiving the operation response sent by the target resource, the MCP server analyzes the response content to acquire the target resource digital certificate, verifies the legality of the certificate issuing authority of the digital certificate according to a certificate authority trust list, and checks that the certificate validity period is in a valid state, to obtain a target resource digital certificate that passes the verification; Based on the target resource digital certificate, the target resource public key information contained in the target resource digital certificate is extracted, the target resource digital signature in the operation response is decrypted and verified by using the public key through an asymmetric decryption algorithm, the integrity and authenticity of the response data are confirmed, and a target resource digital signature that passes the verification is obtained; Based on the target resource digital signature verification passed, the timestamp information in the response data is parsed, the time window verification algorithm is used to check the timeliness of the timestamp, it is confirmed that the response data is within the valid time range, and the result of the target resource timestamp timeliness verification passed is obtained; Based on the result of the target resource timestamp timeliness verification passed, combined with the passing state of the target resource digital certificate and the target resource digital signature verification, the processing result of the target resource identity authentication success and the digital signature verification passed is finally confirmed.

6. The secure MCP protocol authentication method of claim 5, wherein, Step 5, comprising: Based on the processing result of the target resource identity authentication success and the digital signature verification passed, the MCP server extracts the execution result data from the verified response data; Based on the execution result data, an agent response message containing the execution result and the forwarding timestamp is constructed, wherein the forwarding timestamp is obtained from a trusted time source by using the time synchronization protocol; Based on the agent response message, it is forwarded to the agent by using the secure transmission protocol, and the authentication interaction process is completed.

7. A secure MCP protocol authentication system implementing the method of any one of claims 1 to 6, characterized in that, Comprising: The sending module is used for the MCP server to parse the target resource identifier based on the processing result of the agent identity authentication success and the digital signature verification passed, to construct a resource access instruction containing the agent identity information, the operation instruction and the new timestamp, to use the server private key for digital signature, and to send the access request containing the server digital certificate, the digital signature and the resource access instruction to the target resource; The verification module is used for the MCP server to receive the operation response, to verify the legality of the target resource digital certificate based on the received response data, to use the target resource public key to verify the digital signature, and to check the integrity and timeliness of the response data, to obtain the processing result of the target resource identity authentication success and the digital signature verification passed; The response generation module is used for the target resource to execute the operation instruction based on the processing result of the MCP server identity authentication success and the digital signature verification passed, to generate response data containing the execution result and the timestamp, to use the target resource private key for digital signature, and to send the operation response containing the target resource digital certificate, the digital signature and the response data to the MCP server; The verification module is used for the MCP server to receive the operation response, to verify the legality of the target resource digital certificate based on the received response data, to use the target resource public key to verify the digital signature, and to check the integrity and timeliness of the response data, to obtain the processing result of the target resource identity authentication success and the digital signature verification passed; The forwarding module is used for the MCP server to forward the response data to the agent to complete the authentication process based on the processing result of the target resource identity authentication success and the digital signature verification passed.

8. A computing device, comprising: One or more processors; Storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the method of any one of claims 1 to 6. The computer readable storage medium stores a program, which is executed by the processor to implement the method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Apparatus and method for providing authentication, non-repudiation, governed access and twin resolution for data utilizing a data control signature

    CN113348455A

  • AI interactive data protection method and system based on security context protocol

    CN120200863A