{"id":44707117,"url":"https://github.com/interactive-inc/open-mcp-guardrails","last_synced_at":"2026-02-19T15:00:39.105Z","repository":{"id":338195881,"uuid":"1156961661","full_name":"interactive-inc/open-mcp-guardrails","owner":"interactive-inc","description":"Policy-based guardrails proxy that protects MCP servers from PII leaks, secret   exposure, and prompt injection","archived":false,"fork":false,"pushed_at":"2026-02-13T10:58:52.000Z","size":5038,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-16T18:55:25.507Z","etag":null,"topics":["claude","llm","mcp","npm","security","typescript"],"latest_commit_sha":null,"homepage":"https://interactive-inc.github.io/open-mcp-guardrails/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interactive-inc.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-13T09:03:40.000Z","updated_at":"2026-02-13T10:58:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/interactive-inc/open-mcp-guardrails","commit_stats":null,"previous_names":["interactive-inc/open-mcp-guardrails"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/interactive-inc/open-mcp-guardrails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactive-inc%2Fopen-mcp-guardrails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactive-inc%2Fopen-mcp-guardrails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactive-inc%2Fopen-mcp-guardrails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactive-inc%2Fopen-mcp-guardrails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interactive-inc","download_url":"https://codeload.github.com/interactive-inc/open-mcp-guardrails/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactive-inc%2Fopen-mcp-guardrails/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29545294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude","llm","mcp","npm","security","typescript"],"created_at":"2026-02-15T11:06:26.927Z","updated_at":"2026-02-17T13:00:59.648Z","avatar_url":"https://github.com/interactive-inc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/public/banner.png\" alt=\"open-mcp-guardrails\" /\u003e\n\u003c/p\u003e\n\n![GitHub Stars](https://img.shields.io/github/stars/interactive-inc/open-mcp-guardrails?style=flat-square) ![GitHub Forks](https://img.shields.io/github/forks/interactive-inc/open-mcp-guardrails?style=flat-square) ![License](https://img.shields.io/github/license/interactive-inc/open-mcp-guardrails?style=flat-square) ![Top Language](https://img.shields.io/github/languages/top/interactive-inc/open-mcp-guardrails?style=flat-square) ![Last Commit](https://img.shields.io/github/last-commit/interactive-inc/open-mcp-guardrails?style=flat-square) ![Issues](https://img.shields.io/github/issues/interactive-inc/open-mcp-guardrails?style=flat-square)\n\n[English](./README.md)\n\n任意の MCP サーバーの前段にポリシーベースのガードレールを挟むプロキシ。\n\n既存の MCP サーバーコマンドの前に `open-mcp-guardrails` を付けるだけで、PII 漏洩・シークレット流出・プロンプトインジェクションからアプリを守れます。\n\n## 要件\n\n- [Node.js](https://nodejs.org/) \u003e= 23.6.0\n\n`guardrails.config.ts` を Node.js のネイティブ [Type Stripping](https://nodejs.org/en/learn/typescript/run-natively) で直接読み込むため、Node.js 23.6 以上が必要です。コンパイルは不要です。\n\n## インストール\n\n```bash\nnpm install open-mcp-guardrails\n```\n\n## クイックスタート\n\n### 1. 設定ファイルを作成\n\n```bash\nnpx open-mcp-guardrails init\n```\n\n対話式プロンプトで TypeScript と JSON を選択できます:\n\n```\n  Select config format:\n    1) TypeScript  (guardrails.config.ts)\n    2) JSON        (guardrails.json)\n\n  Choice [1]:\n```\n\n`--json` でプロンプトをスキップして JSON を直接生成できます。\n\n#### TypeScript\n\n```ts\n// guardrails.config.ts\nimport { defineConfig, pii, secrets } from \"open-mcp-guardrails\";\n\nexport default defineConfig({\n  rules: [\n    pii().block(),\n    secrets().block(),\n  ],\n});\n```\n\n引数なしの `defineConfig()` で PII + シークレット保護がデフォルトで有効になります。\n\n#### JSON\n\n```json\n{\n  \"$schema\": \"https://unpkg.com/@interactive-inc/open-mcp-guardrails@latest/dist/guardrails.schema.json\",\n  \"rules\": [\n    { \"type\": \"pii\", \"action\": \"block\" },\n    { \"type\": \"secrets\", \"action\": \"block\" }\n  ]\n}\n```\n\nJSON で約 90% のユースケースをカバーできます。`custom()` ルールや複雑な `tool().check()` が必要な場合は TypeScript を使用してください。\n\n### 2. MCP クライアントに登録\n\n**Claude Code** — プロジェクトルートに `.mcp.json` を作成:\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"open-mcp-guardrails\",\n        \"--\",\n        \"npx\", \"@modelcontextprotocol/server-filesystem\", \"/tmp\"\n      ]\n    }\n  }\n}\n```\n\nカレントディレクトリの `guardrails.config.ts` が自動検出されるため、`-c` フラグは不要です。\n\n**Claude Desktop** — `~/.config/open-mcp-guardrails/guardrails.config.ts` に設定を配置し、`claude_desktop_config.json` に追加:\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"open-mcp-guardrails\",\n        \"--\",\n        \"npx\", \"@modelcontextprotocol/server-filesystem\", \"/tmp\"\n      ]\n    }\n  }\n}\n```\n\n`--` の前がガードレールの設定、後ろが元々の MCP サーバーコマンドです。\n\n### 設定ファイルの検索順序\n\n`-c` が指定されていない場合、以下の順序で自動検出されます:\n\n1. `./guardrails.config.ts`（カレントディレクトリ）\n2. `./guardrails.json`（カレントディレクトリ）\n3. `~/.config/open-mcp-guardrails/guardrails.config.ts`（XDG ユーザー設定）\n4. `~/.config/open-mcp-guardrails/guardrails.json`（XDG ユーザー設定）\n\n`-c \u003cpath\u003e` で明示的に指定することもできます。\n\n## ルール\n\n### プリセット\n\n最もシンプルな方法 — `protect` でプリセットを選択:\n\n```ts\nexport default defineConfig({\n  protect: [\"pii\", \"secrets\", \"prompt-injection\"],\n});\n```\n\n| プリセット | 説明 |\n|---|---|\n| `\"pii\"` | メール、電話番号、クレジットカード番号、SSN 等をブロック |\n| `\"secrets\"` | API キー、トークン、秘密鍵等をブロック |\n| `\"prompt-injection\"` | プロンプトインジェクション攻撃をブロック |\n\nJSON の場合:\n\n```json\n{\n  \"protect\": [\"pii\", \"secrets\", \"prompt-injection\"]\n}\n```\n\n### Fluent Builder API\n\n完全な制御にはビルダー API を使用:\n\n```ts\nimport {\n  defineConfig, pii, secrets, promptInjection,\n  contentFilter, flow, tool, custom,\n} from \"open-mcp-guardrails\";\n\nexport default defineConfig({\n  rules: [\n    // 検出ルール — scope で特定ツールに限定\n    pii().scope(\"filesystem__read_file\").block(),\n    secrets().exclude(\"generic_secret\").warn(),\n    promptInjection().threshold(0.5).block(),\n    contentFilter([\"機密\", /confidential/i]).block(),\n\n    // フロー制御\n    flow(\"get_website\").to(\"send_email\").block(),\n\n    // ツール引数バリデーション\n    tool(\"send_email\")\n      .check(args =\u003e !(args.to as string)?.endsWith(\"@company.com\"))\n      .block(\"社内アドレスのみ\"),\n\n    // カスタムロジック\n    custom(\"rate-limit\")\n      .phase(\"pre\")\n      .evaluate(ctx =\u003e {\n        if (ctx.trace.toolCalls.length \u003e 100) {\n          return [{\n            ruleName: \"rate-limit\",\n            message: \"ツールコール上限超過\",\n            severity: \"error\",\n          }];\n        }\n        return [];\n      })\n      .block(),\n  ],\n});\n```\n\n全てのビルダーは `.block()` / `.warn()` / `.log()` のターミナルメソッドで終了します。\n\n### scope — 検出を特定ツールに限定\n\n検出ルール（`pii`, `secrets`, `promptInjection`, `contentFilter`）はデフォルトで全ツールに適用されます。`.scope()` で特定のツールに制限できます:\n\n```ts\npii().scope(\"filesystem__read_file\").block();\nsecrets().scope(/^filesystem__/).block();\n```\n\nツール名は `{server}__{tool}` 形式です（例: `filesystem__read_file`, `github__create_issue`）。\n\nJSON の場合:\n\n```json\n{ \"type\": \"pii\", \"action\": \"block\", \"scope\": [\"filesystem__read_file\"] }\n{ \"type\": \"secrets\", \"action\": \"block\", \"scope\": [\"/^filesystem__/\"] }\n```\n\n## CLI\n\n```bash\n# プロキシ起動（設定は自動検出）\nopen-mcp-guardrails -- npx @modelcontextprotocol/server-filesystem /tmp\n\n# 明示的にパス指定\nopen-mcp-guardrails -c custom.config.ts -- npx @modelcontextprotocol/server-github\n\n# 設定ファイルのスキャフォールド（対話式プロンプト）\nopen-mcp-guardrails init\n\n# JSON を直接生成\nopen-mcp-guardrails init --json\n\n# 設定ファイルのバリデーション\nopen-mcp-guardrails check\n\n# JSON Schema を出力\nopen-mcp-guardrails schema\n```\n\n## 対応クライアント\n\n- [Claude Code](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/claude-code) — `.mcp.json` プロジェクトレベル設定\n- [Claude Desktop](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/claude-desktop) — `claude_desktop_config.json`\n- [Codex CLI](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/codex) — `.codex/config.toml`\n\n## ドキュメント\n\n詳細なガイドと API リファレンスは [ドキュメントサイト](https://interactive-inc.github.io/open-mcp-guardrails/ja/) を参照してください。\n\n- [概要](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/introduction) — アーキテクチャと特徴\n- [クイックスタート](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/quick-start) — 設定ファイルの作成と動作確認\n- [設定](https://interactive-inc.github.io/open-mcp-guardrails/ja/guide/configuration) — 設定オプション、プリセット、scope\n- [API リファレンス](https://interactive-inc.github.io/open-mcp-guardrails/ja/api/) — Fluent Builder API の詳細\n\n## ライセンス\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractive-inc%2Fopen-mcp-guardrails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteractive-inc%2Fopen-mcp-guardrails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractive-inc%2Fopen-mcp-guardrails/lists"}