A data desensitization method and system based on combination of MCP protocol and rule driving

By using a data anonymization method and system based on the MCP protocol and rules, the problems of rigid strategies, difficult intelligent decision-making and ecosystem integration in traditional systems are solved, realizing a flexible and intelligent data anonymization process and improving the system's adaptability and security.

CN121118117BActive Publication Date: 2026-05-19GUANGZHOU HUAZI SOFTWARE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511679373.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-05-19
Estimated Expiration
2045-11-17

AI Technical Summary

Technical Problem

Traditional data anonymization systems suffer from rigid strategies, lack of intelligent decision-making capabilities, difficulty in integrating with heterogeneous systems, and complex management and compliance verification when dealing with complex business scenarios and intelligent data environments. This results in insufficient flexibility, low automation levels, and high maintenance costs.

Method used

The approach combines the MCP protocol and rule-driven methods. It loads de-identification tools through the MCP Server, uses AI agents to parse user intent, dynamically calls standardized tools to form a de-identification task chain, and dynamically adjusts policies through business rules and context information. Combined with a probabilistic algorithm selection mechanism and TLS encrypted transmission, it achieves protocol-level security and auditing.

Benefits of technology

It improves the flexibility and intelligence of the data anonymization process, reduces system integration and maintenance costs, enhances security and compliance capabilities, and achieves adaptability to dynamic business scenarios and efficient, standardized ecosystem integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121118117B_ABST
    Figure CN121118117B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data security, in particular to a data desensitization method and system based on the combination of an MCP protocol and rule driving. The method comprises the following steps: loading a business rule through an MCP Server and registering a desensitization tool as a standardized tool; receiving a user query through an MCP Client and analyzing a user intention by an AI intelligent agent; dynamically calling the standardized tool to form a desensitization task chain according to the user intention and the business rule by the AI intelligent agent; and processing target data by executing the desensitization task chain, wherein the calling process comprises dynamic strategy adjustment based on context information. The system comprises an MCP service layer, a desensitization tool library module and an intelligent decision and integration layer. The application realizes dynamic weight distribution and probabilistic algorithm selection of a desensitization strategy through MCP protocol standardization integration, business rule driving and AI intelligent agent decision, effectively improves the flexibility, intelligent level and system integration efficiency of data desensitization, and simultaneously strengthens the safety and compliance guarantee capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data security technology, and more specifically to a data desensitization method and system based on a combination of MCP protocol and rule-driven approach. Background Technology

[0002] In current information systems, data anonymization is one of the core technical means to ensure data security and privacy compliance. However, traditional anonymization systems have revealed several technical bottlenecks that urgently need to be addressed when dealing with complex business scenarios and intelligent data environments, as described below.

[0003] 1. Desensitization strategies are rigid and static, lacking adaptability to different scenarios.

[0004] Existing systems typically employ predefined and hard-coded anonymization strategies, which are difficult to change once configured. This approach cannot flexibly adjust to specific business scenarios, real-time data sensitivity, or dynamically changing user contexts. For example, the same data should ideally employ different anonymization strategies in development / testing scenarios versus data analysis scenarios, but traditional systems struggle to achieve such fine-grained, dynamic strategy switching, rendering them inadequate in handling complex and ever-changing compliance requirements.

[0005] 2. The system lacks intelligent decision-making capabilities and has a low degree of automation.

[0006] Traditional data masking methods struggle to fully leverage the decision-making and reasoning capabilities of artificial intelligence (AI). Systems cannot automatically identify sensitive information in unstructured data, intelligently orchestrate complex masking processes, or autonomously select the optimal solution from a variety of available algorithms. This results in a high reliance on manual configuration and management, leading to inefficiency and difficulty in ensuring the accuracy and consistency of decisions when dealing with massive and ever-changing data.

[0007] 3. Difficult to integrate with heterogeneous systems, poor compatibility and reusability.

[0008] When providing de-identification services for different AI agents or external business systems, traditional architectures require developing a dedicated adaptation layer for each system. This point-to-point integration model is extremely labor-intensive and easily leads to bloated system architectures and poor compatibility. The fragmentation of the AI ​​ecosystem further exacerbates this problem, making it difficult for de-identification tools to be seamlessly reused as a standardized capability across different models and toolchains.

[0009] 4. Management, auditing, and compliance verification are complex.

[0010] Version control of data anonymization strategies, end-to-end tracking of strategy execution, and compliance verification of operational behaviors are often inadequate and lack intuitiveness in traditional systems. The lack of a complete audit chain makes it difficult to quickly locate problems and provide effective evidence in the event of a data security incident or compliance review, increasing operational and compliance risks.

[0011] In summary, existing technologies have failed to effectively address the comprehensive needs of data anonymization in terms of dynamic flexibility, intelligent decision-making, ecosystem integration, and auditability, and an innovative system architecture and methodology are urgently needed to address these challenges. Summary of the Invention

[0012] In view of this, the present invention provides a data anonymization method and system based on the combination of MCP protocol and rule-driven approach, aiming to solve the problems of insufficient flexibility, low automation level and high maintenance cost caused by rigid strategies, lack of intelligent decision-making and difficulty in ecosystem integration of traditional data anonymization systems. This improves the adaptability of the data anonymization process to dynamic business scenarios, enhances its intelligent decision-making and task orchestration level, and achieves efficient and standardized integration with heterogeneous AI agents and toolchains.

[0013] To achieve the above objectives, the present invention adopts the following technical solution:

[0014] In a first aspect, the present invention provides a data anonymization method based on a combination of MCP protocol and rule-driven approach, comprising the following steps:

[0015] Load and register at least one de-identification tool as a standardized tool through the MCP Server, and load the business rules at the same time;

[0016] User queries are received through the MCP Client, and the AI ​​agent interprets the user's intent.

[0017] The AI ​​agent dynamically invokes one or more of the standardized tools to form a de-identification task chain based on the user intent and the business rules;

[0018] Execute the aforementioned desensitization task chain to perform desensitization processing on the target data;

[0019] The process of dynamically invoking the standardized tools includes dynamic strategy adjustments based on context information.

[0020] In one specific implementation, the dynamic strategy adjustment includes employing a business scenario-aware dynamic weight allocation mechanism to assign priorities to different standardized tools.

[0021] In one specific implementation scheme, the dynamic strategy adjustment further includes employing a probabilistic algorithm selection mechanism to generate selection probabilities for candidate de-identification algorithms based on the business rules.

[0022] In one specific implementation, the probabilistic algorithm selection mechanism is implemented using Monte Carlo simulation.

[0023] In one specific implementation, the use of Monte Carlo simulation includes: using the Monte Carlo simulation to evaluate the utility loss index of candidate de-identification algorithms, and / or simulating data correlation to ensure that the de-identified data maintains business logic consistency.

[0024] In one specific implementation, the business rules are configured in YAML or JSON format.

[0025] In one specific implementation, the context information includes user session history and permission change information, and the dynamic policy adjustment adjusts the desensitization strength in real time based on the context information.

[0026] In one specific implementation, the context information also includes records of invoked toolchains and system operation logs; the dynamic policy adjustment is optimized based on the toolchain records and operation logs.

[0027] In one specific implementation, the method further includes protocol-level security and auditing steps, including: using TLS to encrypt transmitted data and recording the complete operation chain for auditing through access control of the MCP protocol.

[0028] Secondly, this invention provides a data anonymization system based on a combination of MCP protocol and rule-driven approach, applied to the aforementioned data anonymization method, comprising:

[0029] The MCP service layer is used to communicate with AI agents, manage context states, and register and schedule de-identification tools.

[0030] The desensitization tool library module, connected to the MCP service layer, is used to provide at least one of the following desensitization capabilities: static desensitization, dynamic desensitization, and intelligent identification.

[0031] The intelligent decision-making and integration layer, connected to the MCP service layer and the de-identification tool library module, is used to analyze intents and orchestrate tasks through AI agents, and integrate de-identification services into the external ecosystem.

[0032] In one specific implementation, the MCP service layer encapsulates messages using the JSON-RPC 2.0 standard and maintains a context object containing raw data, records of invoked tools, and operation logs.

[0033] In one specific implementation, the MCP service layer is further configured to: execute the steps of registering the de-identification tool and synchronously load the business rules when the MCP Server starts.

[0034] In one specific implementation, the dynamic desensitization in the desensitization toolkit module includes a conditional policy engine and differential privacy technology, and the intelligent identification uses localized LLM to analyze text semantics to identify sensitive content in unstructured data.

[0035] Compared with existing technologies, the data anonymization method and system based on the MCP protocol and rule-driven approach described in this invention are used to build an intelligent, scenario-based, and ecological data security protection system. By deeply integrating the standardized interaction capabilities of the MCP protocol, the decision-making capabilities of AI agents, and the dynamic configuration capabilities of business rule engines, the system achieves context awareness, dynamic weight allocation, and probabilistic algorithm selection for data anonymization strategies. This effectively improves the flexibility, intelligence level, and system integration efficiency of the data anonymization process, and has the following beneficial effects:

[0036] 1. Enhance flexibility and scenario adaptability: By introducing a business rule-driven mechanism and context-aware dynamic policy adjustment capabilities, the de-identification system can automatically adjust the de-identification intensity and policy according to real-time business scenarios, user identities, and session history, solving the problems of rigid policies and inability to dynamically respond to complex compliance requirements in traditional systems.

[0037] 2. Enhance intelligent decision-making and automation: Utilize AI agents for intent parsing and task orchestration, and combine them with probabilistic algorithm selection mechanisms to transform the desensitization process from static pre-configuration to dynamic intelligent decision-making, reducing human intervention and improving the accuracy and efficiency of desensitization decisions.

[0038] 3. Reduce system integration and maintenance costs: By encapsulating and registering various de-identification tools as standardized tools through the MCP protocol, the de-identification service can be developed once and reused in multiple places, which greatly reduces the integration complexity with heterogeneous AI agents and external toolchains, and improves the scalability and maintainability of the system.

[0039] 4. Enhanced security and compliance capabilities: Relying on the TLS encrypted transmission, fine-grained access control, and complete operation chain records built into the MCP protocol, a protocol-level zero-trust security sandbox and visual audit tracing capabilities have been constructed, providing a higher level of security protection and compliance verification support for the data anonymization process. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0041] Figure 1 This is an overall flowchart of a data anonymization method based on the combination of MCP protocol and rule-driven approach as described in this invention.

[0042] Figure 2 This is a schematic diagram of data interaction in a data desensitization system based on the combination of MCP protocol and rule-driven approach as described in this invention.

[0043] Figure 3 This is a schematic diagram of the three-layer architecture of a data desensitization system based on the combination of MCP protocol and rule-driven approach as described in this invention. Detailed Implementation

[0044] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] In its implementation, this invention first constructs a data anonymization method based on a combination of the MCP protocol and rule-driven approaches, whereby the rules refer to business rules. For example... Figure 1 As shown, the complete execution flow of the method begins in the system initialization phase. During startup, the MCP Server loads business rules defined in YAML or JSON format and registers various data masking tools as standardized tools. In the user query parsing phase, upon receiving a user query, the system transmits the query to the AI ​​agent via the MCP Client for deep semantic parsing, ensuring the system accurately understands the user's data masking requirements. In the core decision-making phase, based on the AI ​​agent's parsing results and pre-loaded business rules, the AI ​​agent dynamically selects and orchestrates standardized tools to form a data masking task chain. A dynamic strategy adjustment mechanism based on contextual information is introduced during the selection and orchestration of standardized tools. Specifically, the AI ​​agent uses a rule engine to infer and generate a "rule engine strategy" containing a specific tool call sequence, execution parameters, and dynamic weights. This strategy serves as the direct basis for the tool scheduling engine to execute the data masking task chain in the next stage. Finally, the system executes the data masking task chain and returns the processing results, completing the end-to-end data masking process.

[0046] It should be specifically noted that the de-identification tools described in this invention refer to the smallest executable unit in the system capable of independently completing a specific de-identification task. After being registered with the MCP Server, they become fundamental elements that can be dynamically invoked by the AI ​​agent. For example, de-identification tools include, but are not limited to:

[0047] A tool for completely replacing ID card numbers based on regular expression pattern matching;

[0048] A name-preserving initial mask tool that performs specific formatting operations;

[0049] A dynamic address obfuscation tool integrating a conditional policy engine;

[0050] A differential privacy noise-adding tool that achieves strict privacy protection;

[0051] A tool for identifying and replacing sensitive information in unstructured text using localized LLM semantic analysis.

[0052] Based on user intent and business rules, the AI ​​agent constructs a de-identification task chain that adapts to complex scenarios by calling and combining these de-identification tools.

[0053] and Figure 1 Corresponding to the method shown, Figure 2 and Figure 3 The system architecture design for implementing this method is demonstrated. The system adopts a clear three-layer architecture: the MCP service layer serves as the infrastructure, responsible for protocol communication and tool scheduling; the de-identification tool library module acts as the capability center, providing diverse (static, dynamic, and intelligent recognition) de-identification tools; and the intelligent decision-making and integration layer serves as the control center, achieving intent parsing and ecosystem integration through AI agents. These three layers collaborate closely through standardized interfaces (MCP standardized interfaces), forming a complete system architecture where each layer performs its specific function while also cooperating with each other.

[0054] In the three-layer architecture described above, the de-identification tool library module and the de-identification tools constitute a static relationship between the container and the content. Specifically, the de-identification tool library module, as the capability provider, is responsible for encapsulating and implementing the core de-identification algorithms and technologies into a series of specific de-identification tools; while the de-identification tools are the core operational units output by the de-identification tool library module, which can be standardized, scheduled, and executed. Together, they provide services to the outside world through the MCP protocol.

[0055] Based on the above methodology and overall system architecture design framework, the specific implementation details of each component of the system will be elaborated below.

[0056] The implementation of the MCP service layer adopts a standardized protocol communication scheme. In actual deployment, this layer strictly uses the JSON-RPC 2.0 standard network communication protocol to encapsulate all communication messages, ensuring compatibility with various AI agents and external systems. This layer clearly defines the data structures of the service request DesensitizationRequest and the service response DesensitizationResponse, used to standardize the encapsulation of input parameters and output results for the desensitization task. The DesensitizationRequest includes key fields such as context_id (session identifier), sensitive_fields (list of fields to be desensitized), and policy_id (policy ID), providing a standardized data interaction format for the system. Regarding state management, the context object maintained by this layer continuously tracks complete state information such as raw_data, tool_chain (records of invoked tools), and audit_log (operation log), and supports multi-client session synchronization through the Context Token mechanism, ensuring the continuity and consistency of the system state. The tool scheduling engine registers various de-identification tools as standardized tools using the `register_tool()` method. When it receives a de-identification request in the format `{"method":"desensitize","params":{"text":"Patient ID:12345","policy":"XXX"}}` (where `method` is the tool method identifier, `params` are service parameters including the de-identification strategy, and `XXX` is the specific de-identification tool information), it automatically distributes the request to the corresponding de-identification tool for execution based on the dynamic policy issued by the intelligent decision-making layer. As a core component of the MCP service layer, the tool scheduling engine is responsible for receiving rule engine policies generated by the rule engine and, based on the description of the policy, precisely invoking one or more de-identification tools to execute the task. It registers all available de-identification tools into the system using the `register_tool()` method, maintaining the mapping relationship between tools and policies.

[0057] In the architecture of this invention, the general term "service request / response" is used to define the standardized data interaction structure of the MCP service layer, because the MCP service layer is positioned as a general data service interface. In a specific embodiment of this invention, this service interface is specifically used to carry and transmit desensitization tasks; therefore, its specific data structure (DesensitizationRequest / Response) encapsulates the parameters and results related to desensitization. It is understood that, based on the same service interface, other types of data processing services can be supported by extending its data structure, demonstrating the system's excellent scalability.

[0058] The Context Token mechanism, in a distributed environment, includes the following synchronization mechanism and data consistency guarantee strategy:

[0059] In a distributed environment, this mechanism ensures state synchronization among multiple service instances through the generation and management strategy of tokens (which serve as global identifiers for session contexts). The MCP CLIENT embeds this token in the header of each request, sending it to the server along with tool calls or resource requests. This token allows the server to accurately locate and restore the previous session context, thereby enabling cross-request data processing and synchronization logic.

[0060] The specific implementation of the Context Token mechanism is as follows:

[0061] Context Token Generation and Transmission: The MCP Server generates a unique Context Token for each client session or specific task, serving as a global identifier for that session's context. This token typically includes a session ID, a generation timestamp, and a permission-based digital signature, and is encapsulated using an cryptographic algorithm (such as JWT) to ensure its security and immutability. During communication, the MCP CLIENT embeds this token in the header of each request and sends it to the server along with tool calls or resource requests. Upon receiving the request, the server first parses and verifies the token's validity, then associates it with the corresponding context (such as BrowserContext or data session state) stored on the server, thereby achieving operational and state isolation between different sessions.

[0062] Data processing and synchronization logic: The server can quickly index pre-loaded or cached context data (such as DOM snapshots and API response caches) through Context Tokens, thereby avoiding redundant calculations and improving response efficiency. For example, when an AI agent requests text extraction, the server can directly return the cached page content associated with that Token without re-rendering the entire page. For real-time data streams (such as server-sent Event Sequences (SSEs), the system adopts an incremental update strategy. The server only pushes data changes related to the context associated with the current Context Token to the client, effectively reducing network bandwidth consumption and ensuring data consistency.

[0063] Synchronization mechanism architecture design:

[0064] The distributed environment ensures context consistency through metadata version control and block synchronization mechanisms. Metadata storage employs a transactional key-value engine, implementing atomic operations via the IReadWriteTransaction interface. Each metadata change increments the version number, providing a baseline for subsequent synchronization. The synchronization process uses a "write-ahead-acknowledge" model: the master node initiates a synchronization request via syncStart, slave nodes execute the synchronization operation and return a status, and the master node acknowledges synchronization completion via syncDone.

[0065] For AI agents, distributed agents ensure sequential consistency by coordinating task execution and adopt a system architecture that dynamically integrates multi-source information, including developer-preset instructions, real-time user input, historical interaction records, and results from external tool calls.

[0066] The implementation of the desensitization tool library module involves the technical integration of static desensitization, dynamic desensitization, and intelligent recognition (desensitization). In terms of static desensitization, the module identifies sensitive data based on a complete regular expression pattern library, including preset patterns such as / \d{15,18} / (ID card number), / \d{11} / (mobile phone number), etc., and supports formatting replacement operations such as retaining the first character of the name (e.g., "Zhang San" is desensitized to "Zhang *") and retaining the last four digits of the bank card number, providing basic and reliable desensitization capabilities for structured data. In terms of dynamic desensitization, the module executes business rules such as "IF field = address THEN fuzzify to district level" through a conditional policy engine. At the same time, to meet higher-level privacy protection requirements (for example, against background knowledge attacks in data analysis and sharing scenarios), the system encapsulates the well-known strict privacy protection technology of "differential privacy (Laplace mechanism)" into a standardized desensitization tool, which can be dynamically called by the probabilistic algorithm selection mechanism or directly triggered by the business rule engine according to the sensitivity label of the data field (e.g., IF sensitivity_level = 'high' THEN apply_differential_privacy), adding Laplace noise to numerical data. This design巧妙地 strikes a balance between data utility and privacy protection. In terms of intelligent recognition, the module uses a localized large language model LLM (such as Deepseek-R1) to analyze text semantics, and can particularly optimize the recognition results in combination with the interaction history. This feature enables the system to exhibit the ability of continuous learning when processing unstructured data. For example, when continuously processing medical reports, the recognition accuracy of rare disease terms is improved as the context accumulates.

[0067] The implementation of the intelligent decision-making and integration layer demonstrates the intelligent features of the system. This layer achieves deep intent parsing through AI agents, capable of understanding the real desensitization needs behind users' natural language queries, which is a key prerequisite for the system to achieve intelligence. Based on the parsing results and pre-loaded business rules, the AI agents enter a complex task orchestration stage, dynamically determining which desensitization tools to call and their execution order to form an optimal desensitization task chain. At the system integration level, this layer provides a / query interface through the SQLite MCP Server, automatically desensitizing the query results of SELECT * FROM patients into forms such as {"name":"Zhang","id":"**"}; at the same time, it provides a VS Code extension, connecting to the desensitization service through the MCP protocol to process test data in the development environment in real time. These implementation details fully reflect the good ecological adaptability of the system.

[0068] The implementation of the rule engine strategy forms the core of the system's dynamic decision-making. By separating business logic from application code, the rule engine achieves dynamic and flexible policy management. Its reasoning process follows standardized steps: first, initial data (i.e., facts related to the de-identification context) is input into the working memory; then, the pattern matcher compares the conditional parts in the rule base with the facts in the working memory; successfully matched rules are activated; if multiple rules are activated simultaneously, causing a conflict, the conflict resolution phase begins, where rules are ranked according to the aforementioned specificity scoring and priority mechanisms; finally, the action parts of the activated rules are executed in sequence. This architecture effectively separates business logic from system code, enabling security administrators to adjust de-identification strategies by updating rule files without modifying and redeploying application code.

[0069] In terms of implementation, mature industry-standard rule engine frameworks can be adopted. For example, within the ecosystem, powerful business rule engines such as Drools can be used, defining complex anonymized business logic through their dedicated rule language files. Rules typically consist of a condition part (`when`, corresponding to IF) and an action part (`then`, corresponding to THEN). The rule engine performs reasoning and decision-making on the input business data objects. Through the dynamic loading and hot-updating capabilities provided by such engines, the system's business rules can be flexibly adjusted at runtime, responding in real-time to changing compliance requirements without restarting the application or modifying core code, thus effectively solving the technical bottleneck of rigid anonymization strategies in traditional systems.

[0070] The following focuses on the specific implementation of the core innovative technology of this invention.

[0071] The implementation of the rule engine strategy is based on the rule engine technology component. The rule engine uses an IF-THEN structure to formalize business logic rules, separating decision logic from application code, thereby improving system maintainability and responsiveness. The rule engine strategy uses a predefined set of rules to match and reason based on input facts. In the data anonymization scenario of this invention, its basic structure and operation are as follows:

[0072] I. Basic Structure

[0073] The rule consists of two parts: a condition (IF) and an action (THEN), and its design is closely related to the elements of data anonymization.

[0074] Conditions (IF): These are based on facts related to de-identification, such as user roles, data categories, sensitivity levels, and access contexts. For example: "IF User Role = Test Engineer AND Data Category = Personally Identifiable Information".

[0075] Action (THEN): An operation directly related to de-identification that is triggered when the condition is met. For example: "THEN Call the tool 'Regular Expression Replacement' and set the parameter 'Mask Format' to full mask", or "THEN Assign high priority to the tool 'Differential Privacy'".

[0076] Rules are typically expressed in the form of "IF <condition> THEN <action>".

[0077] II. Operational Process

[0078] The rule engine performs reasoning and execution through the following steps:

[0079] 1. Fact Input: Data related to the anonymized request (such as user intent parsed by the AI ​​agent, characteristics of data fields to be processed, user session history, and risk level of access source detected by the system) are used as the fact input rule engine.

[0080] 2. Rule Matching and Conflict Resolution: The rule engine matches all eligible business rules. When multiple rules are activated simultaneously and their actions potentially conflict (e.g., one rule requires "retaining geographic information for analysis," while another requires "fuzzing all location information"), the system uses multi-layered decision-making logic, such as specificity scoring and priority ranking, to resolve the conflict.

[0081] 3. Strategy Generation and Action Execution: Triggered actions are no longer isolated, but rather work collaboratively to form the final "desensitization task chain." For example:

[0082] The matching result dynamically generates a task sequence: [call the intelligent recognition tool] → [call the conditional policy engine (process address)] → [call the differential privacy tool (process age)]. This process deeply integrates dynamic weight allocation and probabilistic algorithm selection mechanisms to ensure that the task chain is optimal.

[0083] The efficiency of the rule engine is based on algorithms such as Rete, which cache matching results by building a rule network, reducing redundant calculations and thus enabling fast reasoning under a large number of rules.

[0084] In the method and system described in this invention, the rule engine strategy is transformed from a static business logic executor into an "intelligent decision center" that dynamically generates and optimizes the data anonymization task chain. It applies general rule reasoning capabilities to solve the technical problem of rigid strategies and lack of scenario awareness in the field of data anonymization.

[0085] The implementation of the business rule-driven mechanism establishes the intelligent foundation for system decision-making. This mechanism defines business rules in a structured format (YAML / JSON) and loads them into the business rule engine upon MCP Server startup. These business rules form the basis of system decision-making, clearly defining key parameters such as the anonymization strength and algorithm selection priority for different data categories, directly guiding the dynamic decision-making logic of the AI ​​agent. This design enables the system to transform business knowledge into executable anonymization strategies, achieving an organic unity between business requirements and technical implementation.

[0086] The syntax specification for business rules is defined as follows:

[0087] Basic elements: Business rules consist of elements such as variables, constants, operators, and relational operators, and must conform to specific syntax structures (such as conditional expressions and action execution blocks).

[0088] Syntax checking: Syntax parsing is performed before pattern matching of business rules using the Rete (mesh matching) algorithm. The business rule engine needs to have a built-in syntax verification mechanism to avoid execution exceptions due to format errors.

[0089] The conflict detection and resolution strategies for business rules are as follows:

[0090] Conflict types include:

[0091] Business rule conflicts: Multiple business rules meet the conditions at the same time but the results are contradictory (such as overlapping logical conflicts).

[0092] Data conflict, abnormal or missing factual data entered (such as incomplete health information during underwriting).

[0093] Solutions include:

[0094] Priority / weight: Set priority or weight values ​​for business rules. Higher priority business rules override lower priority business rules.

[0095] Business rule merging involves combining conflicting business rule logic into a single business rule (e.g., merging coupon usage conditions in e-commerce scenarios).

[0096] The Rete algorithm is optimized to avoid repeated execution of conflicting business rules by instantiating historical records and using the principle of refraction.

[0097] The following uses specificity ranking as an example to explain its decision-making mechanism in detail:

[0098] Priority sorting based on business rule characteristics

[0099] When multiple business rule conditions are met simultaneously, the system prioritizes them based on their specificity. Business rules with more specialized conditions have higher priority. This mechanism ensures that more precise business rules in specific situations are executed first. Specificity ordering is one of the core strategies for resolving business rule conflicts; its core idea is that the more specific the business rule conditions, the higher the priority. The following are the specific implementation steps and solutions:

[0100] 1. Business rule condition parsing

[0101] Atomic condition extraction: Decompose the premise of the business rule into atomic conditions (such as "temperature > 38℃" or "position = goal line"), and mark the attribute type of each condition (numerical, enumerated, etc.).

[0102] Conditional granularity quantification: Assign specific weights to each condition, for example:

[0103] Numerical range conditions (such as "30 yards < distance < 50 yards") have a higher weight than Boolean conditions (such as "whether the ball is in hand").

[0104] The weight of a composite condition (such as "A AND B") is the product of the weights of the sub-conditions or the maximum value.

[0105] 2. Dynamic priority calculation

[0106] Exclusivity scoring formula: Business rule priority = Σ(condition weight) + penalty item (such as the number of condition conflicts)

[0107] Among them, the conditional weights can be preset through domain knowledge (such as the weight of the combination of "symptoms + test results" being higher than that of a single symptom in medical diagnosis).

[0108] 3. Conflict resolution process

[0109] Business rule matching: Traverse the business rule library and filter out all business rules that meet the prerequisites.

[0110] Priority sorting: Business rules are sorted in descending order of specificity score. If the scores are the same, the nearest business rule is used for sorting (the most recently used business rule takes priority).

[0111] Execution verification: Select the highest priority business rule to execute, and verify logical consistency through causal programming (such as avoiding "shipping before payment" conflicts).

[0112] In practical applications, this system comprehensively utilizes multiple strategies and follows the hierarchical decision-making logic described below to resolve business rule conflicts:

[0113] Specificity Score: The system first calculates the specificity score of the business rule, and the formula is defined as follows:

[0114] S(R) = Σ (Ci / Cmax) * Wi;

[0115] Where Ci represents the number of constraints on the i-th condition in the business rule (e.g., the fineness of the attribute value range), Cmax represents the maximum number of constraints on the corresponding condition among all conflicting business rules, and Wi represents the weight of the condition (which can be predetermined through expert scoring or analytic hierarchy process). This score quantifies the strictness of the business rule conditions; the higher the S(R) value, the more specific and specialized the business rule.

[0116] Hierarchical decision-making framework: When multiple business rules are triggered simultaneously and their conclusions conflict, the system executes the following hierarchical decision-making process:

[0117] First layer: Specialization filtering. The system will discard business rules with a specialization score S(R) below a set threshold (e.g., 0.7) and retain business rules with a higher degree of specialization.

[0118] The second layer: Business priority. Among the business rules filtered by the first layer, the default explicit business priority values ​​in the business rule metadata are compared. Business rules with higher priorities are retained; if the priorities are the same, the comparison proceeds to the next layer.

[0119] The third layer: dynamic context. At this layer, the system will combine real-time context information (such as user roles, system load, and real-time risk level) with the dynamic weights of business rules (see dynamic weight allocation mechanism) to select the optimal business rule that best suits the current scenario for execution.

[0120] The implementation of the dynamic strategy adjustment technology demonstrates the system's intelligent evolutionary capabilities. This technology innovatively combines two intelligent mechanisms: a business scenario-aware dynamic weight allocation mechanism that automatically adjusts tool priorities based on the data type and business scenario being processed, such as increasing the weight of the intelligent recognition module in a medical data scenario; and a probabilistic algorithm selection mechanism that evaluates the utility loss index of candidate de-identification algorithms through Monte Carlo simulation, generating scientific selection probabilities for each algorithm based on the weights of various indicators defined by business rules. The synergistic work of these two mechanisms achieves a fundamental transformation of the system from hard-coded to intelligent decision-making.

[0121] The specific implementation of the business scenario-aware dynamic weight allocation mechanism is as follows:

[0122] Input parameter system: The decision-making of this mechanism relies on three core input parameters. The first is business rule characteristic parameters, including historical trigger frequency and execution success rate; the second is business value parameters, which cover the criticality of the business process associated with the business rule and the potential cost of business rule execution errors; and the third is system performance parameters, which involve the time taken to execute the business rule and the system resource utilization rate.

[0123] The architecture for weight calculation employs a two-stage optimization model. First, a locally optimal weight is calculated for each business rule based on a pre-defined ideal relevance. Then, a quadratic programming model is used for global reconciliation, with the objective function being:

[0124] min Σ(wi - wi_ideal)²;

[0125] Where wi represents the final weight of the i-th business rule, and wi_ideal is its ideal weight, thus obtaining an optimal weight allocation under the condition of satisfying global constraints.

[0126] Priority allocation strategy: The calculated weight values ​​are directly mapped to the priority sequence of the business rule execution queue. Business rules with higher weights will be processed first in the Rete algorithm's matching network and will receive priority matching rights in the working memory. The system dynamically adjusts the activation order of business rules based on this weight through the business rule engine controller, ensuring that high-weight business rules are triggered first. This weight also serves as a key criterion for resolving business rule conflicts, prioritizing the actions defined by business rules with higher weights.

[0127] The probabilistic algorithm selection mechanism employs Monte Carlo simulation. Monte Carlo simulation, as a numerical computation method based on random sampling, can simulate the uncertainties in the data anonymization process by constructing a probabilistic model. Its core steps not only include general steps but also involve deep integration with the business rule engine, as detailed below:

[0128] Sensitive data identification and modeling: Locate sensitive fields through pattern matching or machine learning algorithms, and establish a probability distribution model for the dataset to be de-identified;

[0129] Probabilistic algorithm selection: Based on the data type (such as time series data, relational data), select de-identification techniques such as replacement, perturbation or encryption. Among them, the Monte Carlo method is used to evaluate the utility loss index of different algorithms.

[0130] Dynamic data masking execution and consistency assurance: For real-time data streams, the Markov Chain Monte Carlo (MCMC) method is used to simulate the relationship between data records to ensure that the business logic remains consistent after data masking;

[0131] Effectiveness verification: The distribution differences between the original data and the desensitized data are compared through statistical hypothesis testing to verify the effectiveness of desensitization.

[0132] The probabilistic algorithm selection step specifically includes the following steps:

[0133] Business rule modeling and transfer equation construction: First, business rules are transformed into computable mathematical expressions or transfer equations. For example, a business rule like "IF Data type = Medical AND Sensitivity = High THEN Applicable algorithm set = {A1, A2}" is modeled as a decision logic chain. The business rule base supports open design, allowing dynamic addition and deletion of business rule bodies. Simultaneously, the probability distribution type (e.g., normal distribution, triangular distribution) of uncertain parameters involved in the business rules (such as the volatility of data features, correction values ​​for algorithm effects) is labeled.

[0134] Parameter randomization and sample generation: Next, for each uncertain parameter labeled with a probability distribution, a large number of random samples (usually more than 100,000) are generated using numerical computing libraries (such as Python's NumPy) to simulate the randomness of the real environment. For joint distribution parameters that business rules depend on (such as multiple risk factors), parameter estimation is required based on historical data to construct an accurate joint probability model.

[0135] Business rule execution and scenario simulation: Then, for each set of randomly generated parameter samples, the reasoning process of the business rule engine is executed, and its output results (such as the utility loss index of different de-identification algorithms) are recorded. During this process, the conditions and actions of the business rules are extracted through the syntax parsing layer to form abstract syntax tree (AST) nodes, and Monte Carlo simulation is used to verify the execution path and stability of the business rules under various boundary conditions. For complex nested business rule chains, a hierarchical computation method is used to process intermediate results. Finally, by statistically analyzing the output of all simulated scenarios, a scientific selection probability is generated for each candidate de-identification algorithm.

[0136] In the dynamic data masking and consistency assurance steps, data relationships are simulated using the MCMC method to ensure business logic consistency. The specific implementation includes the following steps:

[0137] Dynamic Algorithm Selection: The system dynamically adjusts the selection of desensitization algorithms based on the data distribution characteristics of the MCMC simulation output (such as the variance and confidence interval of each field). For example, for high-variance fields, a reversible encryption algorithm (such as AES) is used to preserve the statistical volatility of the original data; for low-variance fields, methods such as fixed-value replacement or mean filling are used to avoid revealing their stable statistical characteristics due to desensitization.

[0138] Business rule engine integration: This binds the data correlations and distribution patterns revealed by MCMC simulations to predefined business rules. For example, through the de-identification strategy configuration tool, constraints such as "the age of de-identified patients must fall within a reasonable age range for their respective clinical groups" can be generated. This ensures that the de-identification process not only considers data security but is also strictly limited by the validity of business logic.

[0139] Iterative Testing and Feedback: The system continuously tests business logic using the imputed dataset generated by MCMC. A real-time feedback loop is established by monitoring key business metrics (such as whether the total order amount in the anonymized dataset is within a reasonable range, and whether the accuracy of user segmentation has significantly decreased). Based on the deviation of these metrics, the system dynamically adjusts the parameters of the MCMC simulation or the strength of the anonymization strategy, thereby continuously optimizing through iteration to ensure the usability and consistency of the anonymized data in business applications.

[0140] The implementation of the context-aware anonymization mechanism ensures the system's environmental adaptability. This mechanism achieves dynamic adjustments by continuously tracking multi-dimensional contextual information, including user session history, permission change information, records of invoked toolchains, and system operation logs. This contextual information is shared across sessions through a Context Token mechanism. For example, in a banking risk control scenario, the system optimizes current risk decisions based on historical anonymization records, ensuring the continuity and accuracy of the anonymization strategy. This design enables the system to perceive environmental changes and make corresponding adjustments, exhibiting a human-like contextual awareness.

[0141] In summary, the system achieves intelligent de-identification through the collaborative efforts of three distinct "engines":

[0142] Rule Engine: Located in the intelligent decision-making layer, it is responsible for parsing business rules, resolving conflicts, and making global decisions.

[0143] Conditional Policy Engine: Located in the de-identification tool library module, it is a core dynamic de-identification tool specifically responsible for executing "IF-THEN" type conditional de-identification policies.

[0144] Tool scheduling engine: Located in the MCP service layer, it is responsible for the registration, discovery, and invocation routing of all standardized de-identification tools.

[0145] The definition of the data structure and the lifecycle management strategy for AI context information are core components in building efficient intelligent systems, and their design must balance technical implementation with business requirements. The following are key points:

[0146] I. Data Structure Definition

[0147] Multimodal fusion architecture

[0148] Context information needs to support structured storage of time-series data, and a layered design should be adopted:

[0149] Metadata layer: Records attributes such as data source, timestamp, and confidence level.

[0150] Feature layer: Transforms raw data into computable features through techniques such as vectorization and graph embedding.

[0151] Association layer: Establishes semantic relationships between cross-modal data (such as entity links and event graphs).

[0152] II. Lifecycle Management Strategy

[0153] Phase division

[0154] Data Acquisition Phase: Raw data is obtained through sensors, APIs, or user interaction, and data quality needs to be verified in real time.

[0155] Storage phase: A tiered storage strategy is adopted, with hot data stored in an in-memory database and cold data archived to object storage.

[0156] Update phase: Dynamically refresh the context based on a time decay function or event triggering mechanism.

[0157] Destruction Phase: Set up an automatic expiration and deletion policy according to privacy compliance requirements.

[0158] To more clearly illustrate the practical application effects of the present invention, the specific operation process of the system is shown below in conjunction with two typical scenarios.

[0159] In the context of medical data anonymization, this example demonstrates how the core mechanisms of this invention work together to handle complex compliance requirements.

[0160] When a query containing a patient’s ID number, name, address, and detailed medical records is received, the AI ​​agent first interprets the user’s intent as “for internal clinical research” and invokes pre-loaded HIPAA compliance business rules.

[0161] In the core decision-making stage of dynamically constructing the desensitization task chain, the AI ​​agent does not directly determine the process, but instead initiates the probabilistic algorithm selection mechanism and dynamic weight allocation mechanism described above:

[0162] 1. Probabilistic Algorithm Selection: For the "ID Number" field, the system uses Monte Carlo simulation to evaluate the utility loss (e.g., impact on the relevance of subsequent data analysis) of candidate algorithms such as "full regular expression replacement" and "tokenization". Simulation results show that "full regular expression replacement" has the least impact on the research relevance while satisfying security requirements, and therefore is assigned the highest selection probability.

[0163] 2. Dynamic Weight Allocation: Simultaneously, the system calculates the weights of each standardized tool based on the current business scenario (clinical research) and data type (a mixture of structured IDs, addresses, and unstructured text medical records). "Intelligent Recognition (LLM)" is given a higher weight due to its handling of complex medical record text, followed by the "Conditional Policy Engine" for handling address ambiguity rules, and the "Regular Expression Tool" has the lowest weight. This determines the order in which the task chain is arranged, prioritizing the processing of complex tasks.

[0164] 3. Context-Aware Adjustment: The system detected in real time that the request originated from a new IP address (a high-risk access source). This context information triggered a recalculation of the dynamic weight allocation mechanism, resulting in an increase in the "security strength" sub-weight for all tools. The direct impact is that when the "regular expression tool" is subsequently called to process the "name" field, the tool automatically selects the "full mask" algorithm with higher desensitization strength from its algorithm library based on the increased weight, instead of the default "preserve first character".

[0165] Ultimately, based on the aforementioned dynamic decision-making, the AI ​​agent constructed and executed the following task chain: First, a high-weighted intelligent recognition (LLM) tool accurately located and replaced sensitive diagnostic terms in the medical record text; then, the conditional policy engine performed a "fuzzification to the district level" operation on the address information according to business rules; finally, a regular expression tool completely replaced the ID number and performed an upgraded full masking process on the name. The entire process clearly demonstrates how dynamic policy adjustments respond to contextual changes and ensures that the final result both meets compliance requirements and adapts to the specific risk environment.

[0166] In addition to achieving the core functions, this invention also constructs a comprehensive security system, specifically including:

[0167] The system employs comprehensive data security protection from transmission to storage. All data transmitted via the MCP protocol utilizes industry-standard TLS encryption to ensure confidentiality and integrity during data transmission. A zero-trust access model is implemented using the fine-grained access control built into the MCP protocol, strictly limiting the operational permissions of each entity to prevent unauthorized access. For auditing, the system records the complete operation chain, including data fragments before and after anonymization, operator identity, timestamps, execution toolchains, and other critical information. This detailed audit logging aims to meet relevant compliance requirements. For high-risk operations such as batch exporting anonymized data, the system initiates a manual review process through the MCP Human Approval interface, sending an approval request in the format {"action":"EXPORT","risk_level":"HIGH","preview":"1000 records"}. This design ensures that high-risk operations remain under control at all times.

[0168] By combining the above embodiments, the present invention achieves significant improvements in technical performance across four dimensions:

[0169] In terms of flexibility, through business rule-driven and context-aware mechanisms, the system completely overcomes the rigidity of traditional data masking strategies, intelligently responding to complex compliance requirements and achieving a shift from "one-size-fits-all" to "on-demand data masking." Regarding intelligence, leveraging the deep decision-making and probabilistic algorithm selection of AI agents, the data masking process is transformed from static pre-configuration to dynamic intelligent decision-making, significantly improving automation and decision accuracy while effectively reducing manual intervention costs. In terms of integration efficiency, standardized tool encapsulation based on the MCP protocol achieves the design goal of "develop once, reuse everywhere," greatly reducing the integration complexity with heterogeneous AI agents and external toolchains, and improving the system's scalability and maintainability. In terms of security, by constructing a defense-in-depth system from TLS transmission encryption and fine-grained access control to end-to-end auditing, enterprise-level security capabilities are provided for data masking, ensuring reliable system operation in various application scenarios.

[0170] In summary, this invention, through innovative architectural design and technological combination, successfully solves the core challenges faced by traditional data anonymization systems in terms of flexibility, intelligence, integration, and security, providing a complete and reliable technical solution for modern data security protection. Those skilled in the art, based on an understanding of the principles of this invention, can make appropriate changes and modifications to the above embodiments without departing from the core concept of this invention; such changes and modifications should all be considered to fall within the protection scope of this invention.

[0171] The various embodiments described in this specification are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data anonymization method based on a combination of MCP protocol and rule-driven approach, characterized in that, Includes the following steps: Load and register at least one de-identification tool as a standardized tool through the MCP Server, and load the business rules at the same time; The rule consists of two parts: condition IF and action THEN. The condition IF is used to make a judgment based on facts related to de-identification, such as user role, data category, sensitivity level, and access context. The action THEN is the operation directly related to de-identification that is triggered when the condition is met. When multiple business rules are triggered simultaneously and their conclusions conflict, the system executes the following hierarchical decision-making process: First layer: Specialization filtering; the system will eliminate business rules with a specialization score S(R) lower than the set threshold and retain business rules with a higher degree of specialization; The second layer: business priority; among the business rules that have passed the first layer of filtering, the preset explicit business priority values ​​in the business rule metadata are compared, and the business rules with higher priorities are retained. If the priorities are the same, the comparison proceeds to the next layer. The third layer: dynamic context; The system will combine real-time context information and the dynamic weights of business rules to select the optimal business rule that best suits the current scenario for execution. User queries are received through the MCP Client, and the AI ​​agent interprets the user's intent. The AI ​​agent dynamically invokes one or more of the standardized tools to form a de-identification task chain based on the user intent and the business rules; Execute the aforementioned desensitization task chain to perform desensitization processing on the target data; The process of dynamically invoking the standardized tools includes dynamic strategy adjustment based on context information; The context information includes user session history, permission change information, records of invoked toolchains, and system operation logs; the dynamic policy adjustment adjusts the desensitization strength in real time based on the context information. MCP Server generates a unique Context Token for each client session or specific task, which serves as a global identifier for the session context, enabling cross-session state sharing; The dynamic strategy adjustment includes adopting a business scenario-aware dynamic weight allocation mechanism to assign priorities to different standardized tools; The dynamic strategy adjustment also includes a probabilistic algorithm selection mechanism, which generates selection probabilities for candidate de-identification algorithms based on the business rules; The probabilistic algorithm selection mechanism evaluates the utility loss index of candidate desensitization algorithms through Monte Carlo simulation.

2. The data anonymization method based on the combination of MCP protocol and rule-driven approach according to claim 1, characterized in that, The business rules are configured in YAML or JSON format.

3. The data anonymization method based on the combination of MCP protocol and rule-driven approach according to claim 1, characterized in that, The method also includes protocol-level security and auditing steps, including: using TLS to encrypt data transmission and recording the complete operation chain for auditing through access control of the MCP protocol.

4. A data anonymization system based on a combination of MCP protocol and rule-driven approach, used to implement the data anonymization method based on a combination of MCP protocol and rule-driven approach as described in any one of claims 1-3, characterized in that, include: The MCP service layer is used to communicate with AI agents, manage context states, and register and schedule de-identification tools. The desensitization tool library module, connected to the MCP service layer, is used to provide at least one of the following desensitization capabilities: static desensitization, dynamic desensitization, and intelligent identification. The intelligent decision-making and integration layer, connected to the MCP service layer and the de-identification tool library module, is used to analyze intents and orchestrate tasks through AI agents, and to integrate de-identification services into the external ecosystem.

5. A data anonymization system based on a combination of MCP protocol and rule-driven approach according to claim 4, characterized in that, The MCP service layer uses the JSON-RPC 2.0 standard to encapsulate messages and maintains a context object containing raw data, records of invoked tools, and operation logs.

6. A data anonymization system based on a combination of MCP protocol and rule-driven approach according to claim 4, characterized in that, The dynamic desensitization in the desensitization toolkit module includes a conditional policy engine and differential privacy technology. The intelligent identification uses localized LLM to analyze text semantics to identify sensitive content in unstructured data.