Detecting sensitive information is only the first step. The real engineering challenge is deciding what MCP Gateway should do when it finds that information, proving that the selected action actually changes the correct traffic, and checking where sensitive data can still appear.
This tutorial explores PII (personally identifiable information) detection in the Oracle Integration MCP Gateway through a fictional procurement-support assistant. You will examine blocking, masking, replacement, and removal; configure detection scope and payload-field selection; evaluate detector accuracy; and investigate possible exposure in logs, errors, and downstream systems.
The practical outcome is a repeatable, synthetic-data test plan that records the intended action, expected business behavior, evidence to collect, and exposure that remains. The examples use a nonproduction environment. They do not assume that a live gateway has been configured or tested.
Analogy: A security checkpoint with a defined inspection area
Imagine a workplace mailroom that checks selected fields on incoming forms and outgoing letters. It can stop a form, cover part of a value, replace that value, or remove it. It does not automatically search every filing cabinet, email archive, or database where another copy might exist. An MCP Gateway PII policy works on configured traffic and fields; other storage and logging locations need separate controls.
📑 In This Post
- 01. Understand detection scope and enforcement
- 02. Configure a PII Detection policy
- 03. Choose Block, Mask, Replace, or Remove
- 04. Walk through a synthetic procurement example
- 05. Measure detector accuracy and business impact
- 06. Investigate logs, errors, and downstream exposure
- 07. Plan an enterprise rollout
- 08. Common mistakes
- 09. Frequently asked questions
- 10. References and further reading
- 11. Summary and learning checkpoint
01
Understand Where PII Detection Acts
An MCP client uses the Model Context Protocol (MCP) to discover and invoke tools exposed by a server. A host is the application environment managing the model and client. In this tutorial, a procurement assistant asks an MCP client to call a tool exposed through OIC MCP Gateway. The gateway applies its configured policies before forwarding requests and, where response enforcement is configured, before returning responses.
A PII Detection security policy is a data-handling control. It determines what information is inspected, where the inspection applies, which traffic direction is covered, and what action occurs when supported sensitive information is detected. It is not a guarantee that every sensitive value in every connected system will be found.
Tricky concept: Scope and direction answer different questions
Scope asks, “Where does this policy apply?” Direction asks, “When does it inspect traffic?” Selecting the correct tool does not automatically mean both its input and output are covered. Selecting both directions does not automatically mean every field is inspected.
Oracle documents three PII enforcement scopes and three direction choices.
| Setting | Meaning | Procurement example |
|---|---|---|
| MCP gateway | Broadest scope: traffic covered by the selected gateway policy. | Apply a common rule across covered procurement-server traffic. |
| MCP server | Traffic associated with one selected MCP server. | Apply the policy to a procurement server without applying it to every other server grouped under the gateway. |
| MCP tool | Traffic associated with one selected tool. | Apply a field-handling rule specifically to a draft-request tool. |
| Request only | Inspect the request before it is sent to the MCP server. | Prevent or transform a sensitive email address supplied to a tool. |
| Response only | Inspect the response before it is returned to the MCP client. | Mask a synthetic supplier contact returned by a read tool. |
| Both | Apply enforcement to both request and response traffic. | Protect both submitted and returned values, subject to the configured fields and selected action. |
The field-selection rule is especially important: Oracle's PII policy guide states that only selected payload fields are inspected. Oracle describes the Inclusion List for the tool-targeted option. Do not assume identical selection controls for other scopes, or treat an enabled policy as proof that unselected fields, nested fields, or unrelated data stores are covered.
A request-side action protects the downstream boundary. A response-side action protects what is returned to the caller. They are not interchangeable.
For example, blocking a response containing a supplier contact can stop that response from reaching the client, but it does not undo a purchase-request draft that the tool already created. If the requirement is to prevent processing when a request contains sensitive data, test the request-side enforcement and prove that the tool was not invoked.
Safety Check
Risk: A sensitive value travels to the downstream server even though the team believes its gateway policy protects all traffic.
Control: Select the correct scope, direction, and payload fields; test one request and one response independently.
Remaining risk: Detection gaps, unselected fields, routes that bypass the gateway, and data already held by downstream systems require separate assessment.
You need to decide whether a rule belongs at gateway, server, or tool scope, or whether it should inspect incoming requests, outgoing responses, or both.
02
Configure a PII Detection Policy
This section uses the documented OIC console flow for an existing project containing an MCP Gateway. The gateway's target MCP server must already be registered, and the required connection to that server must already exist. The procedure configures PII protection; it does not create a new gateway, register a new server, or provision extra compute infrastructure.
Prerequisite gate: Confirm the environment before creating a policy
Product: Oracle Integration 3 console.
Starting context: An existing project with an MCP Gateway, a registered MCP server, and a known tool suitable for nonproduction testing.
PII detector dependency: Identify a compartment in which the OCI Language service is available to the relevant configuration. Check OCI Language region support independently; gateway availability alone does not prove that every dependent service is available in the same environment.
Stop condition: If the gateway or PII Detection option is not available, or the correct OCI Language compartment cannot be selected, stop and resolve availability and permissions rather than inventing a replacement configuration.
Milestone A — Create the PII Detection policy
Start here: The correct OIC project is available, the MCP server connection exists, and you have permission to manage MCP Gateway policies.
Navigation: Navigation pane Projects > selected project > left toolbar MCP Gateway > Security policies.
Steps
- Open Projects in the navigation pane.
- Select the project that contains the gateway you intend to govern.
- Select MCP Gateway in the project's left toolbar. Confirm that the page belongs to the intended project.
- In the Security policies section, select Add.
- In the Add security policy panel, select PII Detection.
- Enter the policy's name and description. Record the generated identifier. The reviewed procedure does not establish that it is freely editable.
- Select Add. The policy details page should appear, with the Detection, Enforcement, and Action configuration areas described by the Oracle guide.
| Field | Purpose and status | Synthetic example |
|---|---|---|
| Name | Required descriptive name for the policy. | PII-LAB-EMAIL-BLOCK |
| Identifier | Generated by OIC from the name; verify what the console displays. | Use the generated value, not a made-up identifier. |
| Description | Required explanatory text for policy governance. | Synthetic request PII detection test using block enforcement. |
Expected result: The policy details page is available. This confirms object creation in the console, not runtime enforcement.
If this fails: Confirm the selected project, feature entitlement, and your policy-management permissions. Do not continue to the detector configuration on a different project by mistake.
Milestone B — Configure detectors in the Detection tab
Start here: The PII Detection policy details page was opened in Milestone A.
Navigation: PII Detection policy details > Detection tab.
Steps
- Open the Detection tab.
- Select the compartment OCID where OCI Language is available. Use the actual compartment from your authorized environment; do not copy an invented OCID from an example.
- Choose the relevant built-in detectors from those offered by the current policy editor. For the synthetic example, begin with an email detector. Add a telephone/fax detector where the supported list and business requirement justify it.
- Review the detector selection before proceeding. A detector not selected in the policy must not be assumed to be enabled.
- If an organization-specific sensitive format is required, evaluate Add Pattern as described below. A custom-pattern test is not complete until a positive and a negative example have been tested.
Detector selection guide
| Candidate data | Test requirement | Important limit |
|---|---|---|
| Email address | Choose the applicable email detector and test a synthetic email. | A matching value in an excluded field may not be inspected. |
| Telephone/fax | Test a representative synthetic value for a supported country format. | Oracle lists US telephone/fax examples; do not assume global coverage. |
| Organization-specific identifier | Use Add Pattern only with syntax confirmed in the editor. | A format match is neither identity validation nor proof of issuer authenticity. |
Expected result: detector selections and the actual Language compartment are recorded. If this fails: resolve service availability or runtime access with the platform owner; do not grant broad tenancy access or substitute an arbitrary OCID.
OCI Language lists English for its pretrained PII identification/de-identification model. Its broader multilingual models are not proof of multilingual PII coverage. Also distinguish Language API capabilities from the detectors and options actually exposed by OIC. A custom rule may improve recognition of an agreed format, but its OIC editor syntax, context handling, and match boundaries require verification.
Milestone C — Configure enforcement and handling
- Open Enforcement; choose gateway, server, or tool scope. Select the actual server/tool where required, then request, response, or both.
- For the tool-targeted option, use the displayed Inclusion List to choose actual fields. Record omissions and test nested/array shapes.
- Open Action; choose Block or Redact. For Redact, select Mask, Replace, or Remove and complete the applicable settings.
- Review the detector, scope, direction, fields, and action together, then select Save.
A policy definition must also be assigned. Open the intended gateway in the same project, confirm its selected server, choose the applicable policy under Policies, review evaluation order, and save. Preserve unrelated controls. Check the effective runtime state and follow the deployed release's lifecycle requirements; these instructions do not establish universal hot-update behavior for active gateways.
Use Actions > Run on the gateway to obtain its client-facing URL. A direct source-server URL tests a different route. Keep the client's existing valid authorization for this PII exercise, and use a clean synthetic read as the baseline before deliberately introducing a detector match.
03
Choose Block, Mask, Replace, or Remove
| Choice | Policy setting | Acceptance question |
|---|---|---|
| Block | Primary Action: Block. | Did a detected match stop the covered request or response at the intended boundary? |
| Mask | Redact → Mask; masking character, FROM_START/FROM_END, and characters left unmasked. | Which original characters remain, including for very short values? |
| Replace | Redact → Replace; supply replacement text. | Is the original matched value absent, and can the consumer still use the result? |
| Remove | Redact → Remove; no extra settings documented. | What remains in the actual value and structure after removal? |
Do not equate Remove with deletion of an entire JSON property: the console procedure does not establish that transformation. Inspect whether the result is empty, altered, or otherwise incompatible with the contract. Similarly, a replacement can invalidate an email-format field even though it protects the original address. Test consumer handling rather than assuming transformed data remains schema-valid.
Verify mask direction empirically using a known synthetic value. The UI labels and visible-character count must produce the privacy requirement you intended. Include zero-visible-character and short-value tests where supported. Partial masking is not proof of irreversible anonymization, and the matched entity may be only part of a larger string.
For a request, redaction can also change what the backend processes. If the tool needs the exact original value to perform its authorized task, blocking, minimizing the tool contract, or redesigning the flow may be safer than silently transforming a required business key. Keep authoritative authorization and transaction validation in the integration/target.
04
Walk Through a Synthetic Procurement Example
Start with a harmless status tool and a nonproduction record. This extends the procurement scenario in the supplied excerpt; the following data and expected outputs are newly written teaching examples. They are not captured OIC results. Introduce a draft-creation tool only in a separate controlled write test when side-effect behavior must be established.
Assume discovery and the backend contract confirm purchaseOrderNumber as required and requesterEmail as an optional input. A clean baseline supplies only the synthetic order key. For an email-detection test, the argument fragment could be:
{
"purchaseOrderNumber": "PO-LAB-2048",
"requesterEmail": "buyer.test@example.com"
}
This is tool-argument data, not a complete MCP request. Postman or another compatible client must send the correct protocol exchange. The example-domain address is a test candidate; confirm recognition by the actual detector. Do not declare the policy passed merely because an invented sample looked like an email.
| Lab pass | Configuration change under test | Evidence sought |
|---|---|---|
| Baseline | Valid client, known read tool, clean input. | Expected synthetic status and the current policy/route record. |
| Request Block | Inspect the actual requester-email field; choose Block. | PII-policy rejection before tool execution, corroborated by available gateway and downstream evidence. |
| Response Replace | Use clean input; the seeded response contains a contact email in a selected result field. | Status remains useful; the original matched email is absent from the complete client result. |
| Mask / Remove | Test each separately with the same synthetic record and unchanged permissions. | Exact transformed content, permitted visible characters, and consumer/schema behavior. |
Worked interpretation
For a response Replace test, [PII_REDACTED] is an illustrative configured replacement, not an Oracle constant. A desired result might retain purchaseOrderNumber and status while transforming the contact value. Verify the whole result, including any repeated contact value in free text or an error. A clean request must be used to reach this response test; an earlier request Block would test a different boundary.
Keep the request and response handling intentions separate. If they require different actions, prepare separate policy definitions where supported and verify their attachment, order, and combined behavior. First isolate each action; then run the combined configuration. A different policy that rejects first must not be credited as a successful PII test.
05
Measure Detector Accuracy and Business Impact
Prepare labeled synthetic cases before running the detector. Identify the intended sensitive span, type, field, direction, and expected handling. Use separate cases for clean values, detectable values, near-matches, omitted fields, nested data, and unsupported or mixed-language formats. Ground-truth labels must come from your test design, not from the detector's own output.
| Classification | Meaning in the labeled test set |
|---|---|
| True positive (TP) | A labeled sensitive occurrence is detected. |
| False negative (FN) | A labeled sensitive occurrence is missed. |
| False positive (FP) | A labeled non-sensitive candidate is flagged. |
| True negative (TN) | A labeled non-sensitive candidate is left unflagged. |
Keep the counting unit consistent. The invented example below uses 40 preselected candidate spans: 20 sensitive and 20 non-sensitive. Entity counts, request counts, and field counts are different measures and must not be mixed.
Illustrative counts: TP = 18, FN = 2, FP = 3, TN = 17
Precision = TP / (TP + FP) = 18 / 21 = 85.7%
Recall = TP / (TP + FN) = 18 / 20 = 90.0%
Accuracy = (TP + TN) / 40 = 35 / 40 = 87.5%
These are arithmetic teaching examples, not Oracle performance claims or measured results. If a denominator is zero, report the metric as undefined for that sample. Review missed values by category and field; one aggregate percentage can hide an unacceptable miss in a critical identifier type.
Detection quality and action correctness are separate. For each detected match, verify the configured block or transformation. Also record whether legitimate requests succeed, whether required information remains usable, additional response time, service errors, and any duplicate side effects caused by retries. A detector can recognize an email correctly while the chosen response replacement still breaks the consumer.
06
Investigate Logs, Errors, and Downstream Exposure
Trace a synthetic marker through the permitted request path: client/host → gateway → MCP server/integration → target, then back to the client. Establish where the marker should be blocked or changed and where an original copy can legitimately exist. A gateway rule cannot undo disclosure to a model or host that occurred before the MCP request reached OIC.
| Location | Review question |
|---|---|
| Client and model context | Was the original value already present in a prompt, saved request, chat history, or console? |
| Gateway activity | Which tracing setting is active, who may read evidence, and does the selected trace capture payloads? |
| MCP server / integration | Was original data received or logged before response handling? |
| Target and audit store | Did the operation execute, and which records or audit entries contain the value? |
| Errors and alternative outputs | Does an exception or repeated message disclose the original value elsewhere? |
| Direct route | Can an authorized or overprivileged caller avoid the intended gateway policy path? |
Oracle documents Production gateway tracing without request/response payload capture and Audit tracing with payload capture; Audit is not recommended for production. These settings do not establish the contents of client, integration, OCI service, or target logs. Inspect those separately using synthetic data and approved access.
A response Block does not roll back an already completed write. Correlate available request/integration identifiers and timestamps before deciding whether a retry is appropriate. Absence of a monitoring row is not conclusive evidence that no work occurred. Inspect JSON-RPC errors, any tool-result error indication, and business content; HTTP success alone is insufficient.
Test the detection-service failure path
With the responsible owner, use a disposable nonproduction configuration to assess an authorization error, service unavailability/timeout, and representative larger payloads. Do not revoke shared permissions to manufacture a failure. Record whether the actual gateway blocks, returns an error, or proceeds. The cited OIC policy procedure does not establish a universal fail-closed, retry, truncation, or payload-limit contract. Do not copy standalone Language API limits into an OIC guarantee.
07
Plan an Enterprise Rollout
- Approve a field/direction/action matrix with the data owner and integration owner. Use only the tool fields actually exposed by the configured selector.
- Have the OCI administrator confirm the Language compartment, service availability, real runtime identity, and required access. A console user's permissions alone do not establish the gateway runtime's access.
- Identify every gateway using a shared policy before editing it. Retain the previous selections and assignments and an approved recovery plan.
- Run clean, match, near-match, unselected-field, response, and service-failure tests. Mark each Passed, Failed, or Not executed; record the actual decision layer.
- Review policy order, business effects, tracing, evidence retention/access, and direct-route permissions. Resolve material gaps before wider use.
- Repeat the tests after detector, field, schema, gateway-lifecycle, or provider changes. Restoring policy settings does not undo prior processing or disclosure.
Keep evidence minimal: nonsecret policy/server/tool identifiers, direction, configuration version/date, synthetic case ID, expected and observed result, correlation reference, and accountable owner. Store no real customer payload, token, password, client secret, or signing material in the test report.
08
Common Mistakes and Targeted Corrections
| Mistake | Correction |
|---|---|
| Treating a save as protection | Confirm attachment and effective runtime state, then test the actual gateway URL. |
| Testing request and response together first | Isolate each direction/action before testing the combined route. |
| Using the wrong field or stale schema | Compare the inclusion selector with current request and observed response shapes. |
| Assuming Remove deletes a property | Observe transformed values and validate the entire consumer contract. |
| Counting a token/schema error as a PII denial | Keep authorization and arguments valid; identify the policy that handled the case. |
| Equating masking with complete privacy | Check exposed characters, duplicated values, logs, and alternate paths. |
| Assuming a blocked response means no write | Use backend execution evidence and safe retry/idempotency controls. |
09
Frequently Asked Questions
Are Mask, Replace, and Remove separate primary actions?
Oracle documents Block and Redact as primary actions. Mask, Replace, and Remove are modes under Redact.
Does Remove necessarily delete the JSON field?
Do not assume that. Oracle's console procedure does not establish whole-property deletion. Inspect the transformed value and validate the actual result contract.
Does a response Block undo the tool operation?
No. Response enforcement occurs on returned traffic and is not a transaction rollback. Verify backend effects before retrying a consequential operation.
How do I know which fields are inspected?
For tool-targeted enforcement, inspect the actual Inclusion List and test each selected field and response shape. Document unselected fields and do not infer coverage for nested or duplicated values.
Does a high accuracy score prove production readiness?
No. Inspect false negatives, false positives, action correctness, field coverage, service-failure behavior, and business impact. A small synthetic test set demonstrates only its tested cases.
10
References and Further Reading
Oracle procedures are references for the configured product, not evidence that these example tests ran. Language documentation describes the underlying service; it does not prove identical OIC editor controls or runtime limits.
- Create Security Policies for MCP Servers
- Business and Security Policies for MCP Gateway
- Create and Configure an MCP Gateway
- Activate an MCP Gateway
- Get the URL for the MCP Gateway
- September 2026 release notes (26.10)
- AI Feature Availability
- OCI Language PII entities and custom-rule model
- OCI Language pretrained models and supported languages
- OCI Language policies and API permissions
11
Summary and Learning Checkpoint
Define the field and direction first, choose the action second, attach the policy, and prove the result with a clean baseline and controlled synthetic matches. Measure detection separately from transformation, and inspect backend effects and evidence outside the gateway.
Checkpoint: name one selected field, its detector, request/response direction, action, expected output, and residual exposure. Explain what evidence distinguishes a PII-policy rejection from a token error, and why a response failure cannot establish that a backend write did not occur.

Comments
Post a Comment