safe-data
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@safe-data how many users signed up last month?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
claude-pii-guard
Keep raw personal data out of the Anthropic API while keeping Claude Code's Auto mode hands-off. Instead of detecting and masking on the wire, this repo (1) denies Claude Code access to where personal data lives, and (2) runs the work that needs that data locally through a compute-to-data MCP server (safe-data) that returns only aggregates, schemas, and pseudonymized results. Docs are in Japanese; the code and config are generic.
Claude Code の Auto モードをそのままに、生の個人情報が Anthropic API に届かない構成を作るためのツール群。骨格は「検出して消す」ではなく「Claude が到達できる場所に生データを置かない」+「個人情報が要る処理は手元で実行して結果だけ返す」。
全体像: https://keigo-taguchi.github.io/claude-pii-guard/plan.html (ソース: docs/plan.html)
設計書(根拠 URL・未確認事項つき): docs/design.md
構成
層 | 成果物 | 強制力 |
届く経路を限定する / 読ませない(P0) |
| あり(deny / sandbox) |
見せずに処理する(P1) |
| あり(唯一の口) |
ソース側で断つ(P1) |
| あり |
使い方を教える |
| なし(体験のため) |
最後の網(P2a・実装済み) |
| あり(fail-closed) |
Phase 2b/2c(未実装) | NER、 | — |
Related MCP server: Argos-MCP
safe-data のツール
ツール | 返すもの | 返さないもの |
|
| 実データ |
|
| 値、ファイル名 |
| 1 文の SELECT の結果(行数上限・n<11 抑止) |
|
| ネットワーク無しコンテナで実行した結果 JSON(8KB) | 保護対象の値を含む結果、print 出力 |
| ビュー/ファイルと同じ形の合成行 | — |
| inbox のテキストを pii-guard で擬似化した先頭 N 行 | デーモン停止時は何も返さない |
pii-guard(Mod + デーモン)
# 辞書: 自社の顧客 CSV か DB から(氏名・かな・メール・電話・ID の列を指定)
uv run pii-guard-dict --from-csv ~/PII/exports/customers.csv --id user_id --name name --kana kana --email mail --phone tel
# デーモンを LaunchAgent として常駐
scripts/pii-guard-launchd.sh install
# Mod を読み込んで起動(常用するなら ~/.claude/settings.json の env に CLAUDE_CODE_PLUGIN_DIRS を置く)
claude --plugin-dir ~/work/claude-pii-guard/mods/pii-guardイベント | すること | 失敗時 |
| 打ち込んだ本文と context を |
|
| 保存される全行(ツール結果・失敗結果・添付)を | 行の本文を伏せ字に差し替え |
| CLAUDE.md・メモリ・git 状態を | context を空にする |
| 引数に辞書一致・患者 ID があれば |
|
| 汚染中はモデルを呼ばない | — |
| 画面に描くときだけ札を実値に戻す(モデル・転記は札のまま) | 札のまま表示 |
| status / untaint / reload / off / on | — |
vault は Fernet で暗号化(鍵は ~/.config/safe-data/vault.key、0600)。pii-guard-scan が毎晩 3:15 に転記・メモリ・tool-results を走査し、保護対象の値が残っていれば種類と件数を ~/.config/safe-data/scan.log に出す(値は出さない)。検出は辞書(自社 DB 由来、異体字・かな・ローマ字の揺れを吸収)→ 規則(メール・電話・〒・文脈付きマイナンバー・文脈付き生年月日・住所・患者 ID)。site で強さを変える(コード行は辞書と ID のみ)。claude plugin test(17 件)と pytest(49 件)で検証。GitHub Actions が push ごとに両方を回す。
セットアップ
scripts/install.sh # uv sync、鍵生成、inbox 作成、claude mcp add、Skill リンク、runner イメージ
scripts/day0.sh # 環境の記録とカナリア作成
python3 settings/merge_settings.py # dry run
python3 settings/merge_settings.py --apply # ~/.claude/settings.json に合流(バックアップあり)その後 scripts/phase0_acceptance.md を通し、DB は db/README.md。
元に戻すときは scripts/uninstall.sh(launchd・MCP 登録・Skill リンク・settings.json のバックアップ復元・~/.config/safe-data・Docker イメージを確認しながら外す。~/PII の中身・DB・claude.ai のコネクタは触らず、手順を表示する)。
開発
uv sync
uv run pytest -q
uv run safe-data-mcp --check # 実効設定自分の環境に合わせる
settings/phase0.settings.jsonの deny には Claude Desktop 内蔵ツール(mcp__computer-use、mcp__Claude_Browser__*、mcp__ccd_*)や GitKraken / AWS プラグインのツール名が入っている。存在しないツールへの deny は何にも一致しないだけで害はない。自分の環境の名前は/mcpで確認し、settings/connectors.local.jsonに写す。src/safe_data/config.pyの PII 列パターンは日本語のサポート業務向け。自分のスキーマに合わせてconfig.tomlのpii_columns.patternsで上書きする。db/03_views.sqlは例。列名を自分のテーブルに合わせる。docs/design.mdは筆者環境を前提にした設計記録(Skill 名・ドメインは例)。
注意(colima / Docker Desktop)
py_run はホストのファイルをコンテナに bind mount する。VM 型の Docker(colima)はホームディレクトリしか VM に共有していないので、pii_inbox と analysis_dir は $HOME 配下に置く(/tmp 配下は空ディレクトリとしてマウントされ、スクリプトが読めない)。safe-data は --mount type=bind を使うので、共有されていないパスは明示的なエラーになる。
設計上の約束
ツールはエラーを
isErrorではなく{ok:false, error}で返す(失敗出力が文脈に流れない)戻り値は 40,000 字未満(Claude Code の 50,000 字ディスク退避を発生させない)
理由文に値を書かない(種類と件数だけ)
hook は fail-open なので主役にしない。この層(deny / sandbox / MCP / DB)が主役
Available Tools
5 toolsfiles_describeA
PII inbox(Claude が直接読めない場所)にあるファイルの一覧と推定スキーマを返す。値は返さない。 ファイルは id で参照する(py_run の inputs に渡す)。
Inputs: no named parameters. Returns: object
fixture_makeA
ビュー名またはファイル id と同じ形の合成データ(Faker)を n 行返す。テストやスクリプト開発用。
Args:
source: claude スキーマのビュー名、または files_describe の id。
n: 行数(最大 50)。
Inputs: source (required), n. Returns: object
py_runA
analysis/ 配下のスクリプトを、ネットワーク無しのコンテナで inbox ファイルに対して実行し、小さな JSON 結果だけ返す。
スクリプト内では `import sd` して `df = sd.load("<file id>")` で読み、`sd.result({...})` で結果を返す。
print 出力は返らない。結果に保護対象の値(PII 列の値)が含まれると拒否される。
Args:
script: analysis ディレクトリからの相対パス(例: retention.py)。
inputs: files_describe で得た id のリスト。
Inputs: script (required), inputs. Returns: object
schema_describeA
PII を除いたビュー(claude スキーマ)の列定義と、Faker で作ったダミー行を返す。実データは返さない。
Args:
view: 特定のビュー名。省略時は全ビュー。
Inputs: view. Returns: object
sql_runA
claude スキーマの PII 無しビューに対して SELECT を1本実行する(読み取り専用・行数上限・少数セル抑止)。
Args:
sql: SELECT または WITH で始まる1文。SELECT * は不可。
max_rows: 返す最大行数(上限は設定値)。
Inputs: sql (required), max_rows. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct resource or operation (views, SQL, inbox files, synthetic fixtures, sandbox scripts). The main overlap is schema_describe and fixture_make, which both produce Faker dummy rows, though schema_describe is for schema inspection and fixture_make for generating test data.
All names use consistent snake_case with a clear object_action pattern: schema_describe, sql_run, files_describe, fixture_make, py_run. Minor abbreviations (sql, py) are readable and do not break the convention.
Five tools is well-scoped for a privacy-safe data access server. Each tool has a clear role in the workflow: schema discovery, querying, file cataloging, fixture generation, and sandbox execution.
The surface covers the core read-only analysis lifecycle: discover schemas, query safe views, inspect PII inbox metadata, generate synthetic data, and run sandboxed scripts. A minor gap is the lack of a tool to list available analysis scripts or otherwise help discover script paths for py_run.
Related MCP Connectors
Your AI agent is smart enough to code all day. Local firewall & zero-loss runtime.
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
No-data MCP handoff for local Claude Code to Codex harness moves. $49 lifetime.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude to read, analyze, and write directly to local Power BI semantic models and Excel workbooks without exporting to the cloud.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to securely interact with PostgreSQL, MySQL, SQLite, and SQL Server databases, featuring read-only mode, query validation, SSH tunneling, and field redaction for production-safe data access.4MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to hand off bulk, mechanical, read-heavy tasks to a local model, including agentic loops that can read, write, and run commands sandboxed at zero cloud token cost.MIT
- AlicenseAqualityCmaintenanceEnables read-only analytical access to local CSV, Parquet, JSON files or a DuckDB database through MCP, with table discovery, column profiling, guarded SQL querying, and explain plans for safe use with Claude Desktop and Claude Code.81MIT