sql-guard-mcp
sql-guard-mcp
AIエージェント向けの読み取り専用SQL。多層セーフティガード付き。
LLMエージェントに生のデータベースアクセスを与えるのは自爆行為です。このMCPサーバーは、4つの独立したガードレイヤーを通じてSQLiteデータベースをエージェントに公開します。エージェントが引き起こせる最悪の事態は読み取りが遅すぎることだけであり、それさえも遮断されます。
韓国語ドキュメント: README.ko.md
ガードレイヤー
レイヤー | 阻止するもの | 仕組み |
クエリ検証 | 書き込み、スキーマ変更、スタックされたステートメントによるインジェクション | 単一の |
テーブル許可リスト | 機密テーブル(PII、認証情報)の読み取り |
|
行数上限 | コンテキストウィンドウの氾濫 | すべてのクエリはサーバー側の |
実行上限 | 暴走クエリ(デカルト結合) | SQLiteのプログレスハンドラによるウォッチドッグが、N回のVMステップ後に、対処可能なメッセージ付きで中止する |
OSレベルの読み取り専用 | 上記すべてが失敗した場合 |
|
この設計原理は、本番環境のLLMエージェント向け意思決定ガードの構築から生まれました: モデルが注意深いことを信頼するな — 不注意を不可能にし、すべての拒否メッセージがエージェントに代わりの行動を伝えるようにせよ。
Related MCP server: sqlite-analyst
ツール
sql_list_tables— 表示可能なテーブル(許可リスト適用済み)sql_describe_table— 列、型、行数sql_query— ガード付き読み取り専用クエリsql_guard_status— 現在のガード設定(デバッグのための透明性)
デモ
Claude Desktopに接続し、同梱の広告キャンペーンデモDBに対してクエリを実行 — そして削除リクエストを拒否:

エージェントは自由に探索・集計します(「どのアクティブなキャンペーンが最もCTRが高いか?」)。しかしcampaignsテーブルの消去を求められると、ガードが拒否し、エージェントはその理由を説明します — 設計上読み取り専用であり、プロンプトではなくコードで強制されます。
セットアップ
MCP SDK以外の依存関係はゼロ — 合成広告キャンペーンのデモDBが同梱されており、初回実行時に自動作成されます。
pip install -e .
# optional configuration
export SQLGUARD_DB="/path/to/your.db" # default: bundled demo
export SQLGUARD_ALLOWED_TABLES="campaigns,daily_stats" # default: all tables
export SQLGUARD_MAX_ROWS="200"Claude Desktop
{
"mcpServers": {
"sql-guard-mcp": {
"command": "sql-guard-mcp",
"env": { "SQLGUARD_ALLOWED_TABLES": "campaigns,daily_stats" }
}
}
}次に、*「先週最もCTRが高かったアクティブなキャンペーンはどれ?」*と尋ねてみてください — エージェントがスキーマを探索し、ガードレール内でクエリを実行します。何かを削除するよう依頼してみてください。拒否メッセージを読んでみましょう。
テスト
pip install -e ".[dev]"
pytest # guard validation + execution enforcement, no external DB neededテストには敵対的なケースが含まれます: スタックされたステートメント、SELECT接頭辞付きの書き込み、JOINによる許可リストのバイパス、ユーザー指定のLIMITによる上書き試行、VMステップのウォッチドッグによって中止されるデカルト結合の暴走。
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables safe, read-only SQL access to SQLite databases for AI agents, allowing schema exploration and SELECT queries with defense-in-depth protections.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to explore and query SQLite databases through read-only tools, with defense-in-depth sandboxing preventing any data modifications.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to securely query databases (PostgreSQL, SQLite, MySQL, DuckDB) with read-only defaults and multi-layer SQL injection prevention.1MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/egoring/sql-guard-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server