Skip to main content
Glama
opami-protect-mcp

opami-protect-mcp

Official
by opamiai

opami-protect-mcp

An MCP server that lets Claude Code, Cursor, Codex and other MCP clients use Opami Protect to hide private and sensitive data in text and local text files. It runs locally over stdio.

Before you start

Related MCP server: CloakLLM MCP Server

Add it to your client

Claude Code

claude mcp add opami-protect -e OPAMI_API_KEY=YOUR_OPAMI_API_KEY -- npx -y opami-protect-mcp

Run it in the project folder; add --scope user (before --) to use it in every project.

Cursor

Put this in .cursor/mcp.json:

{
  "mcpServers": {
    "opami-protect": {
      "command": "npx",
      "args": ["-y", "opami-protect-mcp"],
      "env": { "OPAMI_API_KEY": "YOUR_OPAMI_API_KEY" }
    }
  }
}

Put the same block in ~/.cursor/mcp.json to use it in every project, and never commit a file that holds your key.

Codex

Put this in ~/.codex/config.toml:

[mcp_servers.opami-protect]
command = "npx"
args = ["-y", "opami-protect-mcp"]
env = { OPAMI_API_KEY = "YOUR_OPAMI_API_KEY" }

After adding it, the client lists four tools: protect_text, protect_file, detect_pii, restore_text.

Tools

  • protect_text: inputs text, optional exclude (at most 50), output ("placeholders" by default, or "replace") and return_map. Returns the text with placeholders such as [PERSON_1] and a map_id. output: "replace" puts fake data in instead. It works in 7 languages, costs twice as much and cannot be restored.

  • protect_file: inputs path and optional exclude. Reads a UTF-8 text file of up to 1 MB inside the workspace folders the client shares. Paths outside them are refused, including through symlinks. PDF, DOCX and other binary files are refused. The file's content never enters the model's context. If the client shares no workspace folders, every path is refused, so use protect_text.

  • detect_pii: inputs text and optional exclude. Returns each detection's text, type, start, end (UTF-16 indices) and entity_id, plus usage. The detections include the real values.

  • restore_text: inputs text and map_id. Puts the real values back from the map the server kept. Runs locally, with no network call.

Privacy

  • Text (and file text) is sent to the Opami Protect API, which keeps nothing.

  • Placeholders are pseudonymisation, not anonymisation: they can be reversed.

  • The placeholder map (the real values) stays in the server's memory for the session and is never written to disk. It is returned to the agent only when return_map is true. A restart drops every map.

  • The server logs no text, detections, placeholders or keys, and sends no telemetry.

Errors

Failures come back as tool errors with the API error code, message, request id and, when there is one, the time to wait before retrying.

Available Tools

4 tools
detect_piiA

Finds private and sensitive data (names, emails, phone numbers and similar) in a text and returns each one with its type and position, without changing the text. The text is sent to the Opami Protect API, which keeps nothing. Each detection includes the real value, so the result shows the private data to you; use protect_text instead to avoid seeing it. start and end are UTF-16 code units, as JavaScript string indices, so text.slice(start, end) gives the value. exclude takes at most 50 entries.

Inputs: text (required), exclude. Returns: usage, detections, request_id

protect_fileA

Hides private and sensitive data (names, emails, phone numbers and similar) in a local UTF-8 text file without putting the file's content in your context. Pass the file's path inside the workspace folders your client shares. The server reads the file itself and sends its text to the Opami Protect API, which keeps nothing. It returns the text with placeholders such as [PERSON_1] and a short map_id. This is pseudonymisation, and it can be reversed: the server keeps the placeholder map in its own memory for this session, and restore_text with that map_id puts the real values back. The real values stay in the server: protect_file has no return_map, so they and the map are never in the result. Text files of up to 1 MB only; PDF, DOCX and other binary files are refused. Files outside the workspace folders are refused, including through symlinks.

Inputs: path (required), exclude. Returns: usage, map_id, request_id, placeholder_text, +1 more

protect_textA

Hides private and sensitive data (names, emails, phone numbers and similar) in a text by replacing them with placeholders such as [PERSON_1]. The text is sent to the Opami Protect API, which keeps nothing. This is pseudonymisation, and it can be reversed: the server keeps the placeholder map in its own memory for this session and returns a short map_id, and restore_text with that map_id puts the real values back. The real values stay in the server and out of the result unless return_map is true. output: "replace" swaps in fake data instead; it works in 7 languages, costs twice as much and cannot be restored.

Inputs: text (required), output, exclude, return_map. Returns: usage, map_id, output, request_id, +4 more

restore_textA
Read-onlyIdempotent

Puts the real details back into a text that holds placeholders, using the placeholder map the server kept for a map_id from protect_text or protect_file. It runs locally: no network call and no API key. The result contains the real private and sensitive data, so call it only when you need them. Placeholders that are not in this map (for example from another map_id, or edited) stay as written. The result gives restored_count and not_found_count, so check not_found_count before you use the text. The maps live only in this server's memory: after a restart the map is gone, so protect the text again.

Inputs: text (required), map_id (required). Returns: restored_text, restored_count, not_found_count

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct action: protect_text and protect_file differ only by input source and the descriptions make that boundary explicit, while restore_text and detect_pii are unambiguous opposites (reverse vs. read-only inspection). No two tools could be mistaken for one another.

    Naming Consistency5/5

    All four names follow the same snake_case verb_noun pattern (protect_text, protect_file, restore_text, detect_pii) with verbs that accurately reflect the action. Consistent throughout.

    Tool Count5/5

    Four tools form a tight, complete little surface for a pseudonymisation server: detect, protect (text and file variants), and restore. Every tool earns its place and nothing looks like filler.

    Completeness4/5

    The core lifecycle (detect, pseudonymise, restore) is fully covered, including a file variant and an irreversible fake-data mode. Minor gaps remain: no way to list or discard live map_ids, no batch/multi-file operation, and protect_file is limited to UTF-8 text, but agents can work around these.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables anonymization and deanonymization of sensitive data in text using Microsoft Presidio. Supports session-based storage to reversibly replace sensitive information like passwords and secrets with placeholder tokens.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Wraps CloakLLM's Python SDK to provide tools for PII detection, cloaking, and restoration within MCP-compatible clients. It enables users to sanitize sensitive data before sending it to an LLM and restore original values using unique token map IDs.
      56 PyPI
      MIT