obscate-mcp
An MCP server that gives any AI agent reversible PII redaction. Your agent redacts personal data before a payload leaves (for another model, a tool or a third-party API), then restores the real values in the reply.
It is a thin wrapper over the Obscate HTTP API. Full docs: obscate.com/docs/mcp. Detection runs in the hosted API (a self-hosted edition is in pilot). This package only forwards calls.
| tool | what it does | API units |
|---|---|---|
redact |
redact a text; default fpe keeps formats and needs no map to restore |
1 per 100 KB |
restore |
put the original values back | free |
detect |
classify what PII a text contains (labels, offsets, counts) without changing it | 1 per 100 KB |
redact_json |
redact values inside a JSON object/array; keys and shape are unchanged | 1 per 100 KB |
restore_json |
restore any JSON reply | free |
list_entities |
supported labels and strategies | free, no key |
What to expect from detection: structured IDs (email, phone, cards, Aadhaar, PAN, GSTIN, IBAN, SSN, IPs, AWS keys) are near-perfect because they are regex- and checksum-based. Names and places come from an NER model and are best-effort. Check the output if recall on those matters to you. (Detectors and accuracy, benchmark methodology.)
Known limitation: partial values come back wrong
If the model quotes only part of a redacted value ("your card ending in
7588", "the email starting with…"), restore can't fix it: it matches whole
tokens, and a fragment isn't one. With fpe this fails silently and
plausibly. The fake card looks like a real card, so its last four digits
look like real digits, and your user sees a confident, wrong statement about
their own data. Assistants paraphrase values like this all the time, so expect
it in normal use.
What we measured: 1,800 replies from Claude Haiku 5.5, Sonnet 5.5 and Opus 5.5 (5 synthetic support scenarios, 20 runs per condition, 2026-11-19):
| setup | replies stating wrong-but-real-looking digits after restore |
|---|---|
fpe, plain prompt |
204 of 300 (68%) |
synthetic, plain prompt |
173 of 300 (58%) |
tokenize, plain prompt |
0 of 300 |
synthetic has a second variant: models greet the customer by the stand-in's
first name, which can't be restored (241 of 300 plain-prompt replies).
For output a person will read:
- Use
strategy="tokenize": models treat[CREDIT_CARD_1]as a unit and don't split it, and restore only touches tokens in its map. - Don't rely on a "repeat values exactly and in full" system-prompt line. It cut wrong digits to about 1%, but about two-thirds of replies then printed the full card or Aadhaar number to the customer.
- Better still (not yet measured): ask the model not to restate identifiers, and render any masked form ("ending in 4242") in your own code from the original value after restore.
Method, per-model results and limitations: We measured how often LLMs quote part of a redacted value.
Partial references are a boundary of any reversible-redaction approach, not only ours: once the model only sees a stand-in, a fragment of the stand-in can never map back to a fragment of the original.
Quickstart (about 3 minutes)
- Get a free API key at obscate.com (quickstart). It is free for 1,000 requests a month at 60 a minute, with no card. The key is shown once.
- Install with one of these:
uvx obscate-mcp --version # no install, runs from PyPI pip install obscate-mcp # or install into an environment
- Add it to your MCP client (below), with the key in the
envblock. - Ask your agent: "Redact this before you send it to the CRM: Ravi Kumar, ravi@example.com, +91 98765 43210".
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or
%APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"obscate": {
"command": "uvx",
"args": ["obscate-mcp"],
"env": { "OBSCATE_API_KEY": "ob_..." }
}
}
}
Claude Code
claude mcp add obscate --env OBSCATE_API_KEY=ob_... -- uvx obscate-mcp
Cursor
~/.cursor/mcp.json (global) or .cursor/mcp.json (per project). Use the
same JSON block as Claude Desktop.
Configuration
| env var | default | |
|---|---|---|
OBSCATE_API_KEY |
none | required for every tool except list_entities |
OBSCATE_BASE_URL |
https://api.obscate.com |
point at a self-hosted Obscate (the self-hosted edition is in pilot; ask contact@obscate.com) |
Do not commit config files that contain the key. If your client supports env files or secret references, use them.
obscate-mcp --transport streamable-http serves over HTTP instead of stdio.
Proxy mode: redact another MCP server's results
New in 0.2.0.
obscate-mcp proxy puts Obscate between the model and any other MCP
server. The model never has to remember to call redact:
model ──tools/call──▶ obscate-mcp proxy ──restored args──▶ upstream MCP server
model ◀─redacted result── obscate-mcp proxy ◀──raw result── upstream MCP server
(Obscate API: /v1/redact-json)
- It launches the upstream over stdio (
-- <command>), or connects to a streamable-HTTP one (--upstream-url). It re-exposes the upstream's tools under the same names, descriptions and input schemas. - Every result goes through one
/v1/redact-jsoncall before the model sees it: text blocks, JSON inside text blocks,structuredContent, embedded text resources, and error results. That is 1 API unit per tool call up to 100 KB. - Placeholders in the model's tool arguments are put back before the call is forwarded, so the upstream gets real values. This is a local substitution and costs no API call.
- The six Obscate tools stay available alongside (
--no-obscate-toolshides them).
Cost: every proxied tool result is 1 API unit (per 100 KB), whether or
not it contains any PII. The free tier is 1,000 units a month at 60 a minute.
An agent that loops over a tool (paging through files, polling a ticket
queue) can use that up in minutes, and once it does, results are withheld
with a quota error until the month resets. Use --passthrough for tools whose
output never holds personal data, so they cost nothing.
Try it in under 5 minutes
uvx obscate-mcp proxy --help # check it runs; no install needed
git clone https://github.com/AstracoreAI/obscate-integrations && cd obscate-integrations/obscate-mcp
uv venv && uv pip install -e . # or: python -m venv .venv && .venv/bin/pip install -e .
export OBSCATE_API_KEY=ob_... # free key at https://obscate.com
.venv/bin/python examples/proxy_demo.py # about 2 API units
The demo script lives in the repository, not the package, so it needs the
clone. It runs obscate-mcp proxy -- python examples/crm_server.py exactly as
an MCP client would, then plays the model. It prints what the model sees
([PERSON_1], [EMAIL_1], [PHONE_1], card [CREDIT_CARD_1]), calls
send_email(to="[EMAIL_1]", ...), and shows that the toy CRM received the
real address.
Claude Desktop
Wrap any stdio server by putting its command after --. Here it wraps the
reference filesystem server, so file contents are redacted before Claude
reads them:
{
"mcpServers": {
"notes-redacted": {
"command": "uvx",
"args": ["obscate-mcp", "proxy", "--",
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/Users/you/notes"],
"env": { "OBSCATE_API_KEY": "ob_..." }
}
}
}
Environment variables you set in env reach the upstream too, except every OBSCATE_* variable: a third-party
server never sees your Obscate key.
Options
Each option is a flag or an environment variable. Flags win.
| flag | env var | default | |
|---|---|---|---|
--strategy |
OBSCATE_PROXY_STRATEGY |
tokenize |
tokenize or fpe (restorable), mask or hash (one-way, nothing is restored) |
--labels |
OBSCATE_PROXY_LABELS |
all | comma-separated, e.g. EMAIL,PHONE,CREDIT_CARD |
--min-confidence |
OBSCATE_PROXY_MIN_CONFIDENCE |
0.0 |
see the caveat below before raising it |
--passthrough |
OBSCATE_PROXY_PASSTHROUGH |
none | comma-separated upstream tool names left untouched: no redaction, no restore |
--resources |
OBSCATE_PROXY_RESOURCES=1 |
off | also proxy upstream resources (text contents redacted) |
--allow-binary |
OBSCATE_PROXY_ALLOW_BINARY=1 |
off | pass images, audio and blobs through. By default they are replaced with a "withheld" note because they can't be redacted |
--max-tokens |
OBSCATE_PROXY_MAX_TOKENS |
10000 |
cap on placeholders remembered for restore |
--upstream-stderr |
OBSCATE_PROXY_UPSTREAM_STDERR |
inherit |
discard drops a launched upstream's stderr (see Privacy) |
--no-obscate-tools |
OBSCATE_PROXY_NO_OBSCATE_TOOLS=1 |
off | expose only the upstream's tools |
--upstream-url URL |
streamable-HTTP upstream instead of -- <command> |
Confidence caveat. In a live check on 2026-11-29, a real name ("Ravi
Kumar") was detected as PERSON at 0.6, the same score as the known
false positive on a sentence-initial "Email". So --min-confidence 0.7
silences that false positive but also lets real names through. To cut noise,
prefer --labels.
Why tokenize is the default here
The plain redact tool defaults to fpe. The proxy defaults to tokenize
because it restores every tool call the model makes, automatically, with
no person checking:
- A placeholder like
[EMAIL_3]is plainly not a real value. Models copy it verbatim, and in our measurements they never split it (see the partial-values table above). - An
fpevalue looks real. Under a map-free fpe restore, an email address the model invents would be decrypted into a different, real-looking address and sent upstream.
So in both restorable strategies the proxy restores from a session map of
values it issued on the way in. It never decrypts whatever the model wrote.
With --strategy fpe that map is built from the redact response, so an
invented value is forwarded unchanged. The API numbers tokenize placeholders
per request (every response starts at [EMAIL_1]). The proxy renumbers them
per session, so [EMAIL_2] in the third result still means the same person
as [EMAIL_2] in the first.
Limits (read before relying on it)
- Detection limits apply. Structured IDs are near-perfect. Names and places are best-effort, so an NER miss reaches the model unredacted.
- Only tool results (and, with
--resources, resource contents) are redacted. The upstream's tool names, descriptions, server instructions and resource names and URIs pass through as they are. outputSchemais dropped from re-exposed tools. Redaction can change a value's type or format (a numeric phone number becomes"[PHONE_1]"), and a client validating against the original schema would reject the result.- If the Obscate API is unreachable or over quota, the result is withheld and the model gets an error. It never gets the raw output. Upstream protocol errors are passed through with their message redacted.
- A placeholder evicted by
--max-tokens(least recently used first) is forwarded as literal text. Placeholders are never reused for a different value. - A JSON text block is re-serialized after redaction, so whitespace may change. Integers that fpe kept numeric are restored only if they have 6 or more digits.
- No list-changed notifications are forwarded. Tool and resource lists are re-fetched on every list request.
- The partial-values limitation above still applies to anything the model writes for a person to read.
Example agent flow
The agent has a customer record and must create a ticket in a third-party helpdesk tool, which should never see the raw PII.
user: File a ticket: Ravi Kumar (ravi@example.com, +91 98765 43210) was double-charged on card 4242 4242 4242 4242.
agent → redact_json({"json": {"customer": "Ravi Kumar", "email": "ravi@example.com",
"phone": "+91 98765 43210", "issue": "double-charged on card 4242 4242 4242 4242"}})
← {"redacted": {"customer": "[PERSON:…]", "email": "<email-shaped value>", "phone": "<phone-shaped value>",
"issue": "double-charged on card <valid-looking card number>"},
"type_changes": [], "keys_redacted": false, …}
agent → helpdesk.create_ticket(<the redacted object>) # the tool only sees redacted values
← {"ticket": 812, "summary": "Refund for [PERSON:…], reply to <email-shaped value>"}
agent → restore_json({"json": <the tool's reply>, "type_changes": []})
← {"json": {"ticket": 812, "summary": "Refund for Ravi Kumar, reply to ravi@example.com"}}
With strategy: "tokenize" the redacted values look like [EMAIL_1], and
you pass the returned token_map to restore / restore_json. With fpe
(the default) no map exists. Restore needs only your key, plus the
key_version that redact returned. Pass it back to restore or
restore_json. It names the version of your account's key that made the
tokens, so restore keeps working if Obscate rotates keys in between. If it is
left out, the current version is used.
If you store redacted text to restore later, store key_version with it.
fpe caveat: an email, phone number or ID that a model invents, which
was never redacted, is indistinguishable from an fpe token. restore will
decrypt it into a different value. Restore only text whose structured values
came from your own redaction. If that matters, use tokenize, which only
replaces tokens that appear in the map. See strategies.
Privacy
- The server never logs, prints or stores the text, the detected values or
the token map. Errors carry the HTTP status and the API's fixed message
only. This is enforced by
tests/test_server.py::test_privacy_*. - Proxy mode has the same rule. The session map of placeholders lives in
memory only, is bounded, is hidden from
repr(), and is gone when the process exits. Canary values are checked against logs, stdout, stderr and the working directory bytests/test_proxy.py::test_privacy_*, and bytests/test_proxy_e2e.pyagainst the real CLI's stderr. - What the proxy can't control: a launched upstream writes its own stderr,
and by default that goes to the same place as ours (in Claude Desktop, the
MCP log file). Some servers log the data they handle, and the reference
Python SDK logs a failing tool's error message.
--upstream-stderr discarddrops it. The upstream also sees the real values it was always going to see. The proxy protects the model's context, not the upstream. redactanddetectdo not echo the original values back into the model's context (detectcan withinclude_values: true).- The Obscate API has the same contract on its side: it does not log or store payloads. The hosted API runs in DigitalOcean Bangalore. Traffic passes through DigitalOcean's Cloudflare edge. See security & limits.
Develop
pip install -e '.[test]' && pytest -q # unit tests (fake API, fake upstream) + proxy e2e over real stdio
OBSCATE_API_KEY=ob_... python ../scripts/live_e2e.py mcp # real end-to-end against the live API
License: MIT.
Metadata
Release files for obscate-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| obscate_mcp-0.2.0.tar.gz | 34.1 kB | With provenance | Details for obscate_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| obscate_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for obscate_mcp-0.2.0-py3-none-any.whl |
Total release size: 60.0 kB
Release files / obscate_mcp-0.2.0.tar.gz
| Download URL | obscate_mcp-0.2.0.tar.gz |
|---|---|
| Size | 34.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28601dc20f909e91a60791a7fdad69e876c8e78280d5620d453651b38c1f451c
|
|
BLAKE2b-256 checksum How to use checksums |
89bb97df63cae6dc055a1e4ff7d7e6f780ecfef30376f817f8d163102986d92a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / obscate_mcp-0.2.0-py3-none-any.whl
| Download URL | obscate_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb7eeeb5d82463e0a359f93ba879396be5990861dfd0800fc4dd5df31a6565a5
|
|
BLAKE2b-256 checksum How to use checksums |
694e1cc0e110969430bd92b8b96a193912a22abd9eba9847e899616c79781e53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for obscate-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for obscate_mcp-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.