Skip to main content
Glama

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

✅

Related MCP server: mcp-privacy-shield

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

Available Tools

11 tools
forget_sessionForget a sessionB

Delete a session's stored originals now. Its tokens can no longer be restored.

Inputs: session_id (required). Returns: object

gupt_statusGupt statusA
Read-onlyIdempotent

Server configuration and vault statistics (no sensitive values).

Inputs: no named parameters. Returns: object

list_entitiesList entity typesB
Read-onlyIdempotent

List the sensitive-data types Gupt detects, and the policy packs.

Inputs: region, category. Returns: object

redactRedact textA

Replace PII/PHI/secrets in text with tokens. Returns redacted_text and a session_id; the original values stay in the server vault.

Inputs: text (required), mode, policy, session_id. Returns: object

redact_fileRedact a fileA

Read a local file inside the server and return/write only its redacted version, so raw contents never enter the conversation. JSON, JSONL and CSV keep their structure; everything else is treated as text.

Inputs: path (required), mode, policy, overwrite, +3 more. Returns: object

redact_jsonRedact JSONA

Redact a JSON document while keeping its structure. Field names count as evidence: values under keys like 'name' or 'address' are redacted whole.

Inputs: data (required), mode, policy, session_id, +1 more. Returns: object

restoreRestore textA
Read-onlyIdempotent

Put the original values back into text. This reveals them in the conversation; prefer restore_file to write the result to disk.

Inputs: text (required), session_id (required). Returns: object

restore_fileRestore to a fileA

Restore real values and write the result to disk. The restored content is not returned, so the values never appear in the conversation.

Inputs: session_id (required), output_path (required), path, text, +1 more. Returns: object

restore_jsonRestore JSONB
Read-onlyIdempotent

Put original values back into a redacted JSON document.

Inputs: data (required), session_id (required). Returns: object

scanScan textA
Read-onlyIdempotent

Report the sensitive data found in text (type, position, confidence, masked preview) without changing it.

Inputs: text (required), policy. Returns: object

scan_filesScan files for sensitive dataA
Read-onlyIdempotent

Audit a file or folder: per-file counts of PII/PHI/secrets with masked samples and line numbers. Raw values are never returned.

Inputs: path (required), policy, exclude, include, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 11 tools

    Disambiguation4/5

    The tool set has clear format/scope distinctions: text vs JSON vs file vs folder auditing. The main possible confusion is between redact/redact_json/redact_file and restore/restore_json/restore_file, but the descriptions clarify input types and output behavior well enough.

    Naming Consistency4/5

    All names use consistent snake_case and generally follow a verb_noun or clear action pattern. A few bare verbs (redact, restore, scan) and the prefixed gupt_status are minor deviations but remain predictable.

    Tool Count5/5

    Eleven tools is well-scoped for a PII redaction/restoration server, covering redaction, scanning, restoration, file handling, session cleanup, and status/introspection without obvious filler.

    Completeness4/5

    The surface covers the core lifecycle: scan, redact, restore, file variants, session cleanup, and introspection. Minor gaps exist around session listing/management and policy configuration, but core workflows are well supported.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables sanitizing PII from text, classifying data into sovereignty zones, and monitoring compliance scores to keep sensitive information out of AI outputs.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables local, in-memory de-identification of PII, PHI, and credentials with deterministic reversible surrogate tokens before LLM transmission, then restores originals from volatile session mappings and audits for exposures without network egress or disk writes.
      5
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local, in-memory sanitization of sensitive text before LLM ingestion by replacing PII, PHI, and credentials with deterministic reversible tokens, then restoring the originals in responses. It also audits content for exposed secrets and PII and provides compliance receipts without external network egress or disk writes.
      10 npm
      1
      Apache 2.0