@maskera/mcp reference
One npm package that masks what your AI agent sends and reads, locally on your machine. It runs as a proxy, an MCP server, or a hook.
Streamable HTTP (/mcp) and stdio
Running maskera-mcp proxy serves both the LLM proxy and a Streamable HTTP MCP endpoint at http://127.0.0.1:8787/mcp. Connected clients share the warm AI model, the local in-memory session vault, and the live inspector at /_maskera. Clients that only support stdio can launch npx -y @maskera/mcp with no background daemon.
# Warm local service: LLM proxy + Streamable HTTP MCP + live inspectornpx -y @maskera/mcp proxy --root /path/to/workspace# Tighten policy per MCP connection via query parameters# http://127.0.0.1:8787/mcp?no_raw_restore=1# http://127.0.0.1:8787/mcp?read_only=1&no_raw_restore=1# http://127.0.0.1:8787/mcp?approval_mode=browserMCP tools
| Tool | Purpose | Policy / boundary |
|---|---|---|
| maskera_list_files | List regular files inside allowed --root directories without reading contents. | Confined to --root; external symlinks are skipped. |
| maskera_search_files | Search local text, PDF, DOCX, and XLSX files and redact every matching line before returning. Supports searching by placeholders such as [NAMN_1]. | No raw personal data reaches the chat. |
| maskera_read_file | Read a local text, PDF, DOCX, or XLSX file and return redacted text + session_id. | Originals stay in local RAM only. |
| maskera_redact_file | Write a redacted copy of a local PDF, DOCX, XLSX, or text file on disk. PDF pages with matches are re-rendered as images and metadata is stripped. | Hidden in --read-only; blocks scanned PDF pages without a text layer. |
| maskera_write_file | Restore placeholders from session_id and write directly to the file without showing the personal data in chat. | Hidden in --read-only; requires overwrite: true to replace existing files. |
| maskera_redact | Redact text locally with auto (AI + rules) or rules, profile, and custom_terms. | include_map: true is blocked by --no-raw-restore and gated by approval mode. |
| maskera_restore | Restore placeholders in text from session_id or an explicit map. | Hidden by --no-raw-restore; paused in browser/native approval mode. |
| maskera_list_sessions | List active sessions and entity counts by label. | Never returns raw values. |
| maskera_clear_session | Erase a session restore map from RAM immediately. | Hidden in --read-only. |
| maskera_status | Report model status, cache stats, active sessions, allowed roots, and policy. | Read-only status check. |
| maskera_resume | Complete a paused approval request after deciding in /_maskera. | Exposed only in --approval-mode browser. |
Scoped policies and approval modes
URL query parameters on /mcp can only tighten server defaults, never weaken them.
| Flag / query param | Effect | Recommended for |
|---|---|---|
| --no-raw-restore / ?no_raw_restore=1 | Hides and blocks maskera_restore and include_map: true. Agents can still restore files directly to disk with maskera_write_file. | Default for agents working on sensitive files. |
| --read-only / ?read_only=1 | Hides and blocks maskera_write_file and maskera_clear_session. | Read-only analysis agents. |
| --approval-mode browser / ?approval_mode=browser | Pauses maskera_restore and include_map: true and shows Approve / Decline controls in http://127.0.0.1:8787/_maskera. | Human confirmation before any raw PII enters chat. |
| --approval-mode native | Asks the user in the client through MCP elicitation. Fails closed if the client does not support it. | Clients with native MCP elicitation support. |
Built-in prompts, resources, and skill
The MCP server ships Maskera workflow guidance directly over the protocol so clients need no separate skill install.
- Resource maskera://skills/maskera/SKILL.md serves the complete operating guide as text/markdown.
- Resource maskera://status returns live engine, policy, and session status as JSON.
- Prompt maskera-workflow accepts optional profile (general or clinical) and custom_terms.
- Prompt maskera-redact-file guides a safe read, draft, and local restore file roundtrip.
Wrap, service, guard, install, and doctor
The background service uses launchd on macOS and systemd on Linux.
| Environment variable | Default | Purpose |
|---|---|---|
| MASKERA_MCP_ROOTS | Current directory | Path-delimited allowed directories for file tools. |
| MASKERA_MCP_MODE | auto | auto (AI + rules) or rules (deterministic rules only). |
| MASKERA_MCP_NO_RAW_RESTORE | 0 | Set to 1 to block raw PII export into model context. |
| MASKERA_MCP_READ_ONLY | 0 | Set to 1 to disable file writes and session clears. |
| MASKERA_MCP_APPROVAL_MODE | automatic | automatic, browser, or native. |
| MASKERA_MODEL_PATH + MASKERA_ALLOW_REMOTE_MODELS=0 | Hugging Face cache | Load a local ONNX model directory completely offline. |
# Start local proxy + verify + launch agent in one terminalnpx -y @maskera/mcp wrap --open -- claude# Install or check a persistent local background service (127.0.0.1:8787)npx -y @maskera/mcp service install --root . --no-raw-restorenpx -y @maskera/mcp service status# Configure client + guard hook + save zero-PII receipt (maskera-setup-receipt/v1)npx -y @maskera/mcp install claude-code --root . --no-raw-restore \ --apply --with-hook --receipt ./maskera-receipt.json# Redact a PDF, Word, Excel, or text file locally on disknpx -y @maskera/mcp redact journal.pdf -o journal.masked.pdfnpx -y @maskera/mcp guard --file journal.pdf# Block PII in hooks (exits 2 on match, prints counts only)echo '{"prompt":"Ring 070-174 06 58"}' | npx -y @maskera/mcp guard# Self-test local engine, roots, proxy, and live /mcpnpx -y @maskera/mcp doctor --root . --json