mcpField
T
trustboost Pii Sanitizer

trustboost Pii Sanitizer

リモート
github.com/teodorofodocrispin-cmykAI・エージェント2今日更新
リポジトリ

trustboost Pii Sanitizer について

TrustBoost Pii Sanitizerは、AIエージェントのパイプライン向けに複数言語の個人情報を検出・除去し、LLMへ送る前のテキストを処理します。MCPインターフェースを備え、検出とサーバー側のマスキングを分けています。

主な機能

  1. 01複数言語の個人情報と認証情報の検出
  2. 02該当箇所を[REDACTED]に置換
  3. 03エンティティ、リスク分類、安全スコアの返却
  4. 04解析失敗時の入力全体のマスキング
  5. 05sanitize_pii MCPツールの提供

活用シーン

  1. 01LLMへの送信前に個人情報を除去
  2. 02エージェントのワークフローでマスキングを実行
  3. 03マスキング対象とリスクスコアの監査
  4. 04モデル応答の形式不正への対応

MCP 対応

MCPサーバーとしてsanitize_piiツールを公開し、対応クライアントがLLMへの送信前に呼び出せます。

設定

リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。

エンドポイントhttps://api.trustboost.dev/mcp
インストールコマンドをコピー
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。

ツール

1
パラメーター型必須説明
textstringはいサニタイズ対象となる PII の可能性があるテキスト。
tx_hashstringいいえ有料アクセス用の Solana tx_hash。無料で 50 回サニタイズするには 'TRIAL' を使用してください。
wallet_addressstringいいえクォータ追跡用のエージェントまたはウォレット識別子。

詳細

TrustBoost PII サニタイザー

自律型 AI エージェントのパイプライン向けの高精度 PII マスキングレイヤーです。 英語、スペイン語(LATAM)、ポルトガル語(BR/PT)、ドイツ語、 日本語、フランス語、イタリア語、韓国語に対応し、LLM プロバイダーに 情報が届く前に個人を特定できる情報を検出してマスキングします。

  • エンドポイント: https://api.trustboost.dev/sanitize
  • スタック: FastAPI · OpenAI gpt-4o-mini(temperature 0)· Supabase · Helius 経由の Solana 決済

🛡️ ライブデモ — 登録不要

ブラウザーですぐに TrustBoost をお試しください: 👉 https://huggingface.co/spaces/TrustBoost/pii-sanitizer

10 秒でお試し — ウォレット不要

curl -X POST https://api.trustboost.dev/sanitize/preview \
  -H "Content-Type: application/json" \
  -d '{"text": "My name is John Doe, email [email protected], SSN 123-45-6789"}'
{
  "sanitized_content": "My name is [REDACTED], email [REDACTED], SSN [REDACTED]",
  "safety_score": 0.6,
  "risk_category": "PRIVATE",
  "demo": true,
  "requests_remaining": 2,
  "next": "https://github.com/teodorofodocrispin-cmyk/TrustBoost-PII-Sanitizer#trial"
}

IP ごとに無料プレビュー 3 回 · アカウント不要 · ウォレット不要 · セットアップ不要。 さらに利用する場合は、以下のトライアルモードをご覧ください。Solana ウォレットがあれば、無料で 50 回サニタイズできます。


従量課金 — /sanitize/quick(M2M エージェントに推奨)

自律型エージェント向けの最も軽量なエントリーポイントです。呼び出しごとに 0.01 USDC を支払います。 TRIAL、tx_hash、前払いバンドルは不要です。

curl -X POST https://api.trustboost.dev/sanitize/quick \
  -H "Content-Type: application/json" \
  -H "PAYMENT-SIGNATURE: <base64-encoded x402 v2 signature>" \
  -d '{"text": "Contact John at [email protected], SSN 123-45-6789"}'
  • ネットワーク:Base(eip155:8453、推奨)または Solana(solana:5eykt4...)— 自動検出
  • PayAI facilitator 経由で検証および決済
  • X-PAYMENT ヘッダーにも対応(x402 v1、レガシー)
  • テキストまたは支払いヘッダーがまだない場合は、支払い手順を含む標準的な x402 v2 の 402 を返します
  • 10,000 回以上の呼び出しでは、前払いバンドル(149 USDC)のほうが呼び出しあたりの料金がお得です

MCP サーバー — Claude、Cursor、Windsurf のネイティブ連携

TrustBoost は MCP(Model Context Protocol)サーバーとして利用できます。 1 行で、あらゆる MCP 対応エージェントに追加できます。

{
  "mcpServers": {
    "trustboost": {
      "url": "https://api.trustboost.dev/mcp"
    }
  }
}

接続すると、エージェントはテキストを LLM に送信する前に sanitize_pii を自動的に呼び出せます。

# Manifest
curl https://api.trustboost.dev/mcp

# Execute
curl -X POST https://api.trustboost.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"tool": "sanitize_pii", "input": {"text": "My email is [email protected]"}}'

対応製品:Claude Code · Cursor · Windsurf · あらゆる MCP 対応エージェント


クイックスタート

curl -X POST https://api.trustboost.dev/sanitize \
  -H 'Content-Type: application/json' \
  -d '{
    "text": "My email is [email protected] and my AWS key is AKIAIOSFODNN7EXAMPLE",
    "tx_hash": "TRIAL",
    "wallet_address": "your-agent-id"
  }'

トライアルモード(tx_hash="TRIAL")では、wallet_address ごとに無料で 50 回サニタイズできます。 有料モードでは、設定済みの支払いウォレット宛てに Solana で 149 USDC を支払う必要があります。これにより、トランザクション署名ごとに 10,000 回サニタイズできます。

レスポンススキーマ(v2.6.0)

{
  "status": "success",
  "request_id": "TRIAL",
  "data": {
    "message": "Content successfully sanitized and logged.",
    "sanitized_content": "My email is [REDACTED] and my AWS key is [REDACTED]",
    "safety_score": 0.6,
    "risk_category": "CRITICAL",
    "entities_removed": true,
    "entities": [
      { "type": "email",          "category": "PRIVATE",  "redacted_text": "[email protected]" },
      { "type": "aws_access_key", "category": "CRITICAL", "redacted_text": "AKIAIOSFODNN7EXAMPLE" }
    ],
    "redaction_source": "server",
    "timestamp": "2026-05-03T23:48:14.500705+00:00",
    "usage_metrics": { "quota_remaining": 48, "quota_limit": 50 }
  },
  "billing": { "license_type": "TRIAL", "status": "active" }
}
フィールドガイド
フィールド型説明
sanitized_contentstring入力と同じ言語および構造で、PII が [REDACTED] に置き換えられています。
entitiesEntity[][REDACTED] タグごとに 1 要素。安定しており、機械処理に適しています。
safety_scorefloat 0.0 – 1.0サーバー側で決定論的に算出。 モデルではなく、entities に基づいて計算されます。
risk_categoryCRITICAL/PRIVATE/SENSITIVE/CLEANentities に含まれる最も高いレベル。
entities_removedbool便利な項目:entities が空でない場合に限り true です。
redaction_source"model" | "server" | "fallback_full_redaction"テレメトリー:実際にマスキングを実行したもの(以下を参照)。
unmatched_entitiesEntity[] (optional)モデルが報告したものの、redacted_text が入力内に完全一致で見つからなかったエンティティです。空の場合は省略されます。
リスクの重み

safety_score はエンティティごとの重みの合計で、上限は 1.0 です。

  • CRITICAL → 0.40(API キー、秘密鍵、シードフレーズ、認証情報、カード番号など)
  • PRIVATE → 0.20(メールアドレス、電話番号、国民 ID、住所、氏名など)
  • SENSITIVE→ 0.05(ハンドル名、一部の識別子、生年月日など)

risk_category はエンティティが 1 つ以上存在する最も重大度の高いレベルです。 entities が空の場合は "CLEAN" です。

Server-side redaction enforcement (v2.6.0)

The model returns two things that have to agree: cleaned_text and entities. In practice they sometimes disagree — the model can correctly identify an entity in entities but fail to actually replace it in cleaned_text. That produces a sanitized_content that still leaks PII while the audit trail says everything is fine, which is worse than no audit trail.

v2.2 fixes this structurally. The model is now treated purely as a detector: it returns the entity list. The server is the redactor: for every entity whose redacted_text is a non-empty substring of the original input, the server replaces all occurrences with [REDACTED]. Long entities are processed before short ones to avoid partial overlap.

Conservative redaction by design: if the same value (e.g. 田中太郎) appears twice in the input, both occurrences are scrubbed.

The redaction_source field tells you what happened:

  • "model" — the model's cleaned_text already matched the entity list, so server-side enforcement was a no-op (the model did its job).
  • "server" — the server-side enforcer replaced one or more entities the model failed to remove. Track this metric over time as a model-reliability signal: a rising server rate means the prompt or model is drifting.
  • "fallback_full_redaction" — the model returned malformed JSON; the failsafe parser triggered and the entire input was redacted as a single CRITICAL entity. Should be near-zero in steady state.

When the model's redacted_text does not appear verbatim in the input (paraphrasing, normalization, or hallucination), the entity is preserved in entities (and counts toward safety_score) but is also returned in unmatched_entities so callers can audit it.

Failure mode: fail-safe, not fail-open

If the upstream model returns malformed JSON, the response degrades to a single CRITICAL entity covering the entire input rather than risking a silent leak. Over-redaction is always preferred over under-redaction.

Languages and patterns

The system prompt covers, among others:

  • English (global): emails, phones, SSN, credit cards, IBAN, IPs, addresses, and provider-specific API keys (OpenAI, Anthropic, GitHub, AWS, Google, Slack, HuggingFace, Stripe), private keys, crypto wallets, seed phrases.
  • Spanish (LATAM): RFC, CURP, CUIT/CUIL, RUT, DNI, RUC, NIT, Cédula, country phones.
  • Portuguese (BR/PT): CPF, CNPJ, RG, NIF, NUS, CEP, country phones.
  • German (DE/AT/CH): Personalausweis, Steuer-IDs, Sozialversicherungsnummer, IBAN DE, addresses.
  • Japanese: マイナンバー, 法人番号, 運転免許証, パスポート, 健康保険証, 電話番号, 住所, and 氏名 (full names in kanji, mixed scripts, katakana, or hiragana).
  • French (FR/BE/CH/CA): NIR (Numéro de Sécurité Sociale), SIRET, SIREN, Carte Vitale, IBAN FR, Numéro fiscal, country phones +33/+32/+41.
  • Italian (IT): Codice Fiscale, Partita IVA, Carta d'Identità (CIE), Tessera Sanitaria, IBAN IT, Patente di Guida, country phone +39.
  • Korean (KR): 주민등록번호 (RRN), 사업자등록번호, 여권번호, 운전면허번호, 건강보험번호, 외국인등록번호, country phone +82.

Running locally

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

cp .env.example .env  # then fill in real keys
uvicorn main:app --reload

Required environment variables:

  • OPENAI_API_KEY
  • SUPABASE_URL, SUPABASE_KEY
  • HELIUS_API_KEY, PAYMENT_WALLET
  • Optional: TRIAL_QUOTA (default 50), PAID_QUOTA (default 10000), REQUIRED_PAYMENT_USDC (default 149)

Tests

pip install pytest
python -m pytest tests/test_sanitize.py -v          # unit tests, no creds needed
TRUSTBOOST_LIVE=1 python -m pytest tests/test_live.py -v   # hits real /sanitize

The live tests consume TRIAL quota; set TRUSTBOOST_WALLET to a CI-specific identifier so they don't share quota with developer wallets.

バージョン管理

  • 2.6 — Helius による Solana 上のサニタイズ証明。有料のサニタイズはすべてオンチェーンに記録されます。/verify/{anchor_tx} で検証できます。x402 ネイティブ対応 — 自律決済の指示を含む HTTP 402。ブラウザーエージェント向けの CORS。Circle Agent Stack による検出用の agent-card.json。
  • 2.5 — コンテキスト対応のサニタイズ、エージェントごとのプライバシー予算、TrustBoost スコアによる M2M。
  • 2.2 — サーバーサイドの墨消し強制機能、redaction_source テレメトリー、unmatched_entities 監査フィールド。
  • 2.3 — コンテキスト対応のサニタイズ:/sanitize の context フィールド(legal/financial/medical/code/general)。コンテキストの種類に応じてサニタイズの深度を調整します。レスポンスに context_applied を追加します。
  • 2.4 — エージェントごとのプライバシー予算:Supabase に agent_budgets テーブルを追加。運用者が日次上限を一度設定すれば、エージェントはその範囲内で自律的に動作します。
  • 2.5 — TrustBoost スコア:/score/{wallet} エンドポイント。信頼ティア(TRUSTED/VERIFIED/ACTIVE/NEW)による M2M 信頼検証。audit_log から集計します。
  • 2.6 — Solana 上のサニタイズ証明:有料のサニタイズはすべて Helius Memo トランザクションを介してオンチェーンに記録されます。誰でも /verify/{anchor_tx} で検証できます。Solscan へのリンクを含む proof_of_sanitization オブジェクトを返します。
  • 2.1 — 構造化された entities 配列、サーバーサイドの決定論的スコアリング、強化された JSON 解析、日本語の氏名検出の改善。
  • 2.0 — 多言語対応のプロンプトへの書き換え。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。