# @maskera/mcp reference

> Reference for @maskera/mcp: local LLM proxy, MCP tools for PDF/Word/Excel, Streamable HTTP /mcp, policy flags, guard hooks, install, and doctor.
>
> Canonical: https://maskera.dev/en/docs/mcp (en) · sv: https://maskera.dev/docs/mcp · Markdown: https://maskera.dev/en/docs/mcp.md · Overview for agents: https://maskera.dev/llms.txt

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.

[Overview](https://maskera.dev/en/docs) · [@maskera/mcp](https://maskera.dev/en/docs/mcp) · [Client guides](https://maskera.dev/en/docs/clients) · [SDK & operations](https://maskera.dev/en/docs/sdk) · [Troubleshooting](https://maskera.dev/en/docs/troubleshooting)

You know it worked when

Ask your agent to call maskera\_status. The reply lists your allowed folders and the active policy.

## 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](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.

Terminal

```
# Warm local service: LLM proxy + Streamable HTTP MCP + live inspector
npx -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=browser
```

## MCP 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](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. |

Terminal

```
# Start local proxy + verify + launch agent in one terminal
npx -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-restore
npx -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 disk
npx -y @maskera/mcp redact journal.pdf -o journal.masked.pdf
npx -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 /mcp
npx -y @maskera/mcp doctor --root . --json
```

## Read next

- [Overview →Pick a mode and check that masking works.](https://maskera.dev/en/docs)
- [Client guides →Ready-made steps for Claude, Codex, Cursor and more.](https://maskera.dev/en/docs/clients)
- [SDK & operations →Masking in your own TypeScript and JavaScript code.](https://maskera.dev/en/docs/sdk)
- [Troubleshooting →Common issues and what local masking does not cover.](https://maskera.dev/en/docs/troubleshooting)

- [Agent setup prompt (setup-prompt.md)](https://maskera.dev/setup-prompt.md)
- [Machine-readable index (llms.txt)](https://maskera.dev/llms.txt)
- [@maskera/mcp on npm](https://www.npmjs.com/package/@maskera/mcp)
- [maskera on npm](https://www.npmjs.com/package/maskera)
- [Source code on GitHub](https://github.com/joelhagvall/maskera)
- [Model on Hugging Face](https://huggingface.co/joelhagvall/maskera-sv-ner)

Product

- [Products](https://maskera.dev/en/services)
- [Documentation](https://maskera.dev/en/docs)
- [Industries](https://maskera.dev/en/industries)
- [Accuracy](https://maskera.dev/en/accuracy)
- [Customer portal](https://app.maskera.dev/en/login?utm_source=maskera_dev&utm_medium=referral&utm_content=footer_portal)

Trust

- [Security](https://maskera.dev/en/security)
- [Privacy & transparency](https://maskera.dev/en/privacy)
- [FAQ](https://maskera.dev/en/faq)
- [Privacy policy](https://maskera.dev/en/privacy-policy)
- [Test data](https://maskera.dev/en/test-data)

Project

- [Open source](https://github.com/joelhagvall/maskera)
- [Custom-trained Swedish AI model](https://huggingface.co/joelhagvall/maskera-sv-ner)
- [White paper (PDF)](https://maskera.dev/whitepaper.pdf)
- [About & contact](https://maskera.dev/en/about)

A product of [Hägvall Labs AB](https://hagvall-labs.com).
