
opami-protect-mcp
io.github.opamiai/opami-protect-mcp
Hide private and sensitive data in text and local text files with Opami Protect pseudonymisation.
Documentation
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
- Node.js 22 or newer.
- An API key from the console: https://console.opami.ai
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: inputstext, optionalexclude(at most 50),output("placeholders"by default, or"replace") andreturn_map. Returns the text with placeholders such as[PERSON_1]and amap_id.output: "replace"puts fake data in instead. It works in 7 languages, costs twice as much and cannot be restored.protect_file: inputspathand optionalexclude. 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 useprotect_text.detect_pii: inputstextand optionalexclude. Returns each detection'stext,type,start,end(UTF-16 indices) andentity_id, plus usage. The detections include the real values.restore_text: inputstextandmap_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_mapis 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.
Links and licence
- Docs: https://console.opami.ai/docs
- MIT, see
LICENSE.
opami-protect-mcpnpm install opami-protect-mcp