@maskera/mcp 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -11
- package/dist/cli.js +3474 -2160
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +198 -4
- package/dist/index.js +3205 -2149
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Local Swedish PII redaction for any AI agent or LLM client:
|
|
4
4
|
|
|
5
|
-
1. **
|
|
6
|
-
2. **
|
|
7
|
-
3. **
|
|
8
|
-
4. **
|
|
5
|
+
1. **One-command proxy wrapper (`maskera-mcp wrap -- <cmd>`)**: starts a local loopback proxy on a free port, verifies zero leaks automatically, injects `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`, `MASKERA_PROXY_URL`, and `MASKERA_MCP_URL` into your CLI (`claude`, `codex`, `opencode`, scripts), and prints a session receipt when the command exits.
|
|
6
|
+
2. **Local LLM proxy + Streamable HTTP MCP (`maskera-mcp proxy` / `maskera-mcp service install`)**: sits between any client that accepts a custom API URL (Claude Code, Codex with an API key, Cursor, OpenCode, Claude Desktop via third-party inference, Python/JS SDKs) and Anthropic/OpenAI, redacts outgoing prompts and tool results locally on-device, and transparently restores placeholders in both JSON and SSE streaming responses. The same warm process also exposes Streamable HTTP MCP at `http://127.0.0.1:8787/mcp` and a live inspector with a built-in self-test button at `/_maskera`. Install it as a persistent local background service (`launchd` on macOS, `systemd --user` on Linux) with `maskera-mcp service install`.
|
|
7
|
+
3. **MCP stdio server (`maskera-mcp`)**: exposes `maskera_read_file`, `maskera_write_file`, `maskera_list_files`, `maskera_search_files`, `maskera_redact`, `maskera_restore`, `maskera_list_sessions`, `maskera_clear_session`, `maskera_status` (plus `maskera_resume` in browser approval mode), along with built-in MCP `prompts` and `resources` (`maskera://skills/maskera/SKILL.md`) over JSON-RPC 2.0 stdio or Streamable HTTP.
|
|
8
|
+
4. **Hook / pipe guard (`maskera-mcp guard`)**: blocks PII in Claude Code / Cursor hooks or Unix pipelines (`exit 2`, never echoes raw PII) or redacts streams via `--redact`.
|
|
9
|
+
5. **Client installer and diagnostics (`maskera-mcp install` / `maskera-mcp doctor`)**: auto-detects or configures clients (`--apply`, `--project`, `--with-hook`), runs an automatic Swedish PII self-test + live `/mcp` probe, and prints (or saves via `--receipt <file.json>`) a zero-PII setup receipt (`maskera-setup-receipt/v1`).
|
|
9
10
|
|
|
10
11
|
All redaction runs 100% locally using `maskera` (deterministic Swedish rules + the 43 MB open Swedish ONNX NER model `joelhagvall/maskera-sv-ner`).
|
|
11
12
|
|
|
@@ -14,7 +15,17 @@ All redaction runs 100% locally using `maskera` (deterministic Swedish rules + t
|
|
|
14
15
|
Start the proxy on loopback (`127.0.0.1:8787`):
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
+
# Fastest single-terminal launch (starts proxy, verifies 0 leaks, sets env vars, prints session summary on exit)
|
|
19
|
+
npx -y @maskera/mcp wrap -- claude
|
|
20
|
+
npx -y @maskera/mcp wrap --open -- codex
|
|
21
|
+
|
|
22
|
+
# Or keep one persistent local proxy + warm /mcp running in the foreground (or open /_maskera automatically)
|
|
23
|
+
npx -y @maskera/mcp proxy --root /path/to/workspace --open
|
|
24
|
+
|
|
25
|
+
# Or install as a background service (launchd on macOS, systemd --user on Linux)
|
|
26
|
+
npx -y @maskera/mcp service install --root /path/to/workspace --no-raw-restore
|
|
27
|
+
npx -y @maskera/mcp service status
|
|
28
|
+
npx -y @maskera/mcp service uninstall
|
|
18
29
|
```
|
|
19
30
|
|
|
20
31
|
Point any client that accepts a custom API URL at it, or connect an MCP client to `/mcp` on the same warm process:
|
|
@@ -75,12 +86,16 @@ To go back to your Claude account, choose the Anthropic sign-in option on the si
|
|
|
75
86
|
Generate or write the configuration for your client directly:
|
|
76
87
|
|
|
77
88
|
```bash
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
npx -y @maskera/mcp install
|
|
81
|
-
npx -y @maskera/mcp
|
|
89
|
+
# Auto-detect installed clients, or target one (claude-code, claude-desktop, codex, cursor, opencode, t3-code, or all)
|
|
90
|
+
# install runs a synthetic Swedish PII roundtrip automatically and prints a setup receipt
|
|
91
|
+
npx -y @maskera/mcp install
|
|
92
|
+
npx -y @maskera/mcp install cursor --root /path/to/workspace --no-raw-restore --with-hook
|
|
93
|
+
npx -y @maskera/mcp install claude-code --transport http --no-raw-restore --apply --with-hook --receipt ./maskera-receipt.json
|
|
94
|
+
npx -y @maskera/mcp doctor --receipt ./maskera-receipt.json
|
|
82
95
|
```
|
|
83
96
|
|
|
97
|
+
Pass `--apply` to execute `claude mcp add` / `codex mcp add` directly, `--project` to write project-local `.mcp.json` for Claude Code, `--with-hook` to add a `maskera-mcp guard` prompt hook, or `--no-verify` to skip the verification receipt. When a local proxy is running, both `install` and `doctor` also execute a live JSON-RPC `maskera_redact` probe against `/mcp` and verify zero leaked PII.
|
|
98
|
+
|
|
84
99
|
Or configure stdio manually:
|
|
85
100
|
|
|
86
101
|
```json
|
|
@@ -116,10 +131,11 @@ Scoped policies (CLI flags or `/mcp` query parameters):
|
|
|
116
131
|
## 3. Harness-agnostic guard / hook
|
|
117
132
|
|
|
118
133
|
```bash
|
|
119
|
-
# Block prompts or hook JSON containing PII (exits 2 on match, 0 if clean)
|
|
134
|
+
# Block prompts or hook JSON containing PII (exits 2 on match, 0 if clean).
|
|
135
|
+
# Automatically reuses a running local proxy's warm ONNX model on 127.0.0.1:8787 when available.
|
|
120
136
|
echo '{"prompt":"Ring 070-174 06 58"}' | npx -y @maskera/mcp guard
|
|
121
137
|
|
|
122
|
-
# Redact any pipe locally
|
|
138
|
+
# Redact any pipe locally (pass --no-proxy to force in-process execution)
|
|
123
139
|
cat klient.txt | npx -y @maskera/mcp guard --redact
|
|
124
140
|
```
|
|
125
141
|
|