Skip to main content

Gupt · गुप्त

A privacy firewall for AI. Gupt is an MCP server and CLI that finds personal data (PII), health data (PHI) and secrets, replaces them before they reach a language model, and puts the real values back afterwards. It runs entirely on your machine and makes zero network calls.

PyPI Python License: MIT

"Patient: Rahul Verma, Aadhaar 2341 2341 2346, PAN ABCPE1234F, +91 98765 43210, rahul@okaxis"

placeholder → Patient: <<PERSON_1>>, Aadhaar <<IN_AADHAAR_1>>, PAN <<IN_PAN_1>>, <<IN_PHONE_1>>, <<IN_UPI_ID_1>>
synthetic   → Patient: Rohan Khan, Aadhaar 7884 7999 3022, PAN WGNPA3172J, +91 91751 06834, noah479@okaxis
mask        → Patient: R**** *****, Aadhaar XXXX XXXX 2346, PAN A*********, +** ***** *3210, r****@******

Why Gupt

Most redaction MCP servers return the token map (the real values) as the tool result. In MCP the caller is the model, so that hands the model exactly what you meant to hide. Gupt is designed around that problem:

Typical redaction server Gupt
Original values kept out of the model's context ❌ token map returned to the model ✅ server-side vault, model sees only a session_id
Redact files without the model ever reading them ❌ ✅ redact_file, restore_file, scan_files
Consistent tokens across many calls ❌ ✅ sessions: same value → same token
Entity types ~20 125+ across 35+ countries
India (Aadhaar/Verhoeff, PAN, GSTIN, UPI, ABHA, DL, vehicle…) ❌ ✅ checksum-validated
API keys & secrets (OpenAI, Anthropic, AWS, GitHub, Stripe, Razorpay…) ❌ ✅ 25 secret types
Redaction modes 1 5: placeholder, synthetic, hash, mask, label
Compliance policy packs ❌ ✅ HIPAA, GDPR, DPDP (India), PCI, secrets…
JSON / CSV aware (field names count as evidence) ❌ ✅ "name": "Meera" is caught without NER
CI / pre-commit leak scanner ❌ ✅ gupt scan --fail
Current MCP SDK (2.x) often pinned to 1.x ✅

Install

pip install gupt-mcp          # or: uvx gupt-mcp

Only dependency: the official MCP SDK. Optional statistical NER for free-text names and places:

pip install "gupt-mcp[ner]" && python -m spacy download en_core_web_sm
# then set GUPT_ENGINE=auto (or ner)

For better name/place accuracy (especially Indian names) use the larger model: python -m spacy download en_core_web_lg and set GUPT_SPACY_MODEL=en_core_web_lg.

Connect it to your AI client

Claude Code

claude mcp add gupt -e GUPT_ALLOWED_DIRS="$PWD" -- uvx gupt-mcp

Claude Desktop / Cursor / Windsurf / VS Code (mcpServers block):

{
  "mcpServers": {
    "gupt": {
      "command": "uvx",
      "args": ["gupt-mcp"],
      "env": { "GUPT_ALLOWED_DIRS": "/path/to/your/data" }
    }
  }
}

More ready-to-paste configs in examples/.

Tools

Tool What it does
redact Replace sensitive data in text. Returns redacted_text + session_id.
restore Put originals back into text (reveals them in the chat; can be disabled).
scan Report findings (type, position, confidence, masked preview) without changing text.
redact_json / restore_json Structure-preserving redaction; field names like name, aadhaar, password are evidence.
redact_file Read a local file inside the server; only the redacted version reaches the model. JSON, JSONL, CSV keep their structure.
restore_file Write the restored result to disk. Content is never returned to the model.
scan_files Audit a folder: counts per file, line numbers, masked samples.
forget_session Delete a session's originals immediately.
list_entities, gupt_status Catalog, policies, configuration.

Also exposes resources gupt://entities, gupt://policies and two prompts: safe_file_workflow and privacy_audit.

The zero-exposure workflow

Ask your assistant to "summarise complaints in tickets.csv and draft replies to replies.csv" with Gupt connected:

  1. The model calls redact_file("tickets.csv"). Gupt reads it locally and returns only <<PERSON_3>>, <<IN_PHONE_7>>… plus a session_id.
  2. The model writes replies using the tokens.
  3. The model calls restore_file(session_id, text=…, output_path="replies.csv"). Real names and numbers are filled in on disk.

The model completed the task without ever seeing a single real identifier.

For agent pipelines (send text to an external API, a translation service, another agent), use redact → forward redacted_text → restore with the same session_id.

Redaction modes

Mode Example (rahul@gmail.com) Reversible Use when
placeholder (default) <<EMAIL_ADDRESS_1>> ✅ Clear, typed, numbered tokens the model can reason about
synthetic arjun.patel33@example.com ✅ The model should read natural text. Fakes keep the format and valid checksums (Aadhaar/Verhoeff, cards/Luhn, GSTIN, NPI)
hash <<EMAIL_ADDRESS#7524bb59>> ✅ Stable pseudonyms across runs (set GUPT_SECRET_KEY) for joins and analytics
mask r***@g****.com, XXXX XXXX 2346 ❌ Human-readable partial masking (UIDAI-style for Aadhaar)
label <<EMAIL_ADDRESS>> ❌ Irreversible redaction

Per-type overrides: "entity_modes": {"CREDIT_CARD": "mask"}.

Policy packs

all (default) · pii · hipaa / phi (18 Safe-Harbor identifiers) · gdpr · dpdp (India DPDP Act 2023) · pci · financial · secrets · india · government_ids · contact

Combine and subtract: policy="dpdp,secrets", policy="all,-URL,-IP_ADDRESS".

What it detects (125+ types)

Every identifier that has a check digit is validated, so look-alikes are discarded instead of redacted. Format-less identifiers are context-anchored (they need a nearby word like "passport" or "NHS"). Known false-positive contexts (e.g. "order id", "invoice", "txn") veto a match.

  • India: Aadhaar (Verhoeff), Aadhaar VID, PAN, GSTIN (mod-36), UPI ID (80+ PSP handles), mobile (+91 / 10-digit), passport, voter ID (EPIC), driving licence, vehicle registration (incl. BH series), UAN, ration card, IFSC, ABHA number & address. Hindi context words (आधार, मोबाइल, जन्म तिथि…).
  • Healthcare: NPI, DEA, MRN / UHID / IP-OP numbers, Medicare MBI & HICN, CLIA, health-plan member IDs, medical licence, ICD-10 codes, admission/discharge dates, NHS number, Australian Medicare, ABHA.
  • Personal & contact: names (honorifics like Dr./Mr./Shri/Smt., labelled fields, JSON/CSV keys, or NER), street addresses (US/UK/India), postal codes, DOB, ages over 89, GPS coordinates, usernames, email, phone (NANP + international), URL, IPv4/IPv6, MAC.
  • Financial & crypto: cards (Luhn), IBAN (mod-97), SWIFT/BIC, bank accounts, ABA routing, Bitcoin (Base58Check/bech32 verified), Ethereum.
  • Government IDs, 35+ countries: US (SSN, ITIN, EIN, passport, DL), Canada SIN, Brazil CPF/CNPJ, Mexico CURP/RFC, UK NINO, Spain DNI/NIE, Italy codice fiscale, France NIR, Germany Steuer-ID, Netherlands BSN, Poland PESEL, Sweden personnummer, Finland HETU, Portugal NIF, Belgium NRN, Ireland PPSN, Turkey TCKN, Australia TFN/ABN, NZ IRD, Singapore NRIC, Hong Kong ID, China resident ID, Japan My Number, Korea RRN, Thailand, Malaysia, Indonesia, Philippines, Pakistan CNIC, Bangladesh, Sri Lanka, Nepal, Israel, UAE Emirates ID, Saudi ID, South Africa, Nigeria NIN/BVN, Kenya.
  • Devices & vehicles: VIN (check digit), IMEI, device / implant serials.
  • Secrets: AWS, GitHub, GitLab, OpenAI, Anthropic, Google, Hugging Face, Groq/Replicate/Perplexity/xAI, Stripe, Razorpay, Slack, Discord & Slack webhooks, Telegram, Twilio, SendGrid, npm, PyPI, Shopify, DigitalOcean, Azure storage, JWTs, PEM private keys, passwords in connection strings, password=/api_key= assignments (placeholders like ${VAR} ignored).

Run gupt entities (or gupt entities --region IN) for the full list.

CLI

gupt redact notes.txt -o notes.safe.txt --map notes.map.json   # token map stays on your disk
gupt restore llm_reply.txt --map notes.map.json
cat data.json | gupt redact --json --mode synthetic
gupt scan src/ config/ --policy secrets --fail                  # exit 1 if anything leaks
gupt scan . --format json > privacy-report.json
gupt serve --http --port 8765                                   # streamable HTTP transport

Block leaks in CI / pre-commit

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/parthagni22/gupt-mcp
    rev: v0.1.0
    hooks:
      - id: gupt-scan
# GitHub Actions
- run: pip install gupt-mcp && gupt scan . --policy secrets,government_ids --fail

Python library

from gupt_mcp import Gupt

g = Gupt()
out = g.redact("Mail rahul@example.com, PAN ABCPE1234F", policy="dpdp")
print(out["redacted_text"])        # Mail <<EMAIL_ADDRESS_1>>, PAN <<IN_PAN_1>>
reply = call_your_llm(out["redacted_text"])
print(g.restore(reply, session_id=out["session_id"])["text"])

Configuration

Zero config works. Everything is set through the client's env block or a JSON/TOML file at GUPT_CONFIG; environment variables win.

Variable Default Meaning
GUPT_ALLOWED_DIRS server's working dir Folders the file tools may read/write (os.pathsep-separated). A filesystem root is refused.
GUPT_POLICY all Default policy pack(s)
GUPT_MODE placeholder Default replacement mode
GUPT_ON_UNCERTAIN redact Low-confidence finding: redact it anyway, or block the whole call
GUPT_TRUST_THRESHOLD 0.5 Below this a finding is "uncertain"
GUPT_NOISE_FLOOR 0.3 Below this a finding is ignored
GUPT_ENGINE pattern pattern, ner (requires spaCy) or auto
GUPT_SPACY_MODEL en_core_web_sm spaCy model for the NER engine
GUPT_SECRET_KEY random per process Key for hash/synthetic determinism across restarts
GUPT_EXPOSE_TOKEN_MAP false Return the token map from redact tools (only for non-LLM clients)
GUPT_ALLOW_RESTORE_TEXT true Set false for zero-exposure mode: only restore_file can restore
GUPT_VAULT_TTL_MINUTES 240 Idle sessions expire after this
GUPT_DENY_LIST / GUPT_ALLOW_LIST – Comma-separated terms always / never redacted
GUPT_AUDIT_LOG / GUPT_AUDIT_FILE off Audit records: types and counts only, never values

Config file (see examples/gupt.config.json):

{
  "policy": "dpdp,secrets",
  "entity_modes": { "CREDIT_CARD": "mask" },
  "entity_thresholds": { "URL": 0.9 },
  "deny_list": ["Project Falcon", "Acme Hospital"],
  "allow_list": ["support@yourcompany.com"],
  "rules": [
    { "entity": "EMPLOYEE_ID", "pattern": "\\bEMP-\\d{5}\\b", "score": 0.9, "context": ["employee"] }
  ],
  "field_hints": { "emp_code": "EMPLOYEE_ID" }
}

Custom rules may borrow any built-in check digit by name ("check": "verhoeff", "luhn", "iban"…). Config supplies data, never code. A malformed config stops startup instead of silently weakening protection.

Security model, honestly

  • Fail-safe: a detection-engine error blocks the call. A low-confidence finding is redacted anyway (or blocks, with on_uncertain=block). Overlapping findings are merged into their union, so no flagged byte leaks.
  • Exact restore: tokens are unique and collision-checked against the input, and restore is single-pass, so restore(redact(x)) == x. This is property-tested with Hypothesis across all reversible modes.
  • Local only: no network calls, no telemetry. The vault lives in memory and is never written to disk.
  • Limits: no detector catches everything, and regexes cannot find a bare name in free prose (enable the NER engine, use field hints, or a deny-list). Text the user already pasted into the chat has already reached the model; Gupt protects files, downstream tools, logs and APIs. Gupt is one technical control, not a compliance certification (HIPAA, GDPR, DPDP compliance concern your whole system and organisation).

See docs/ARCHITECTURE.md and SECURITY.md.

Development

git clone https://github.com/parthagni22/gupt-mcp && cd gupt-mcp
pip install -e ".[dev]"
pytest && ruff check src tests

Adding an identifier is a great first contribution: one Rule(...) in src/gupt_mcp/recognizers/, an optional validator in checksums.py, a catalog entry in entities.py, and a test row in tests/test_detection.py. Use synthetic data only.

License

MIT © parthagni22

Metadata

Release files for gupt-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gupt-mcp 0.1.0
File Size Uploaded Provenance Actions
gupt_mcp-0.1.0.tar.gz 72.2 kB With provenance Details for gupt_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gupt-mcp 0.1.0
File Interpreter ABI Platform Actions
gupt_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for gupt_mcp-0.1.0-py3-none-any.whl

Total release size: 143.9 kB

Release files / gupt_mcp-0.1.0.tar.gz

Download URL gupt_mcp-0.1.0.tar.gz
Size 72.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5427afc807d059b8e46cfe61a617737e406bdac41aca620c02dfee2706b025e7
BLAKE2b-256 checksum
How to use checksums
0b52244fb5aa7dd2fb4195f95e305620f2024b40d45f51a6b21e5253c907b0cd
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 Dec 3, 2026.

Transparency log

Release files / gupt_mcp-0.1.0-py3-none-any.whl

Download URL gupt_mcp-0.1.0-py3-none-any.whl
Size 71.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be01ea46007185e2203538bff1c69cf3c8359268e7b5f4c47de27434098b3dfe
BLAKE2b-256 checksum
How to use checksums
8ee628dff1ae5b57b0e968968911dec111ab75d86be5e49c7a96c40706cf9eb6
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 Dec 3, 2026.

Transparency log

Security for gupt-mcp 0.1.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.

Select from 2 files

Attestation for gupt_mcp-0.1.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 Dec 3, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page