sql-guard-mcp
sql-guard-mcp
다층 안전 가드를 갖춘 AI 에이전트용 읽기 전용 SQL.
LLM 에이전트에게 데이터베이스에 대한 직접 접근 권한을 주는 것은 자충수와 같습니다. 이 MCP 서버는 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