sql-guard-mcp
Provides guarded read-only access to SQLite databases, with tools for listing tables, describing table schemas, and executing SELECT queries under configurable safety limits.
Click on "Install 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., "@sql-guard-mcpWhich active campaign had the best CTR last week?"
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.
sql-guard-mcp
Read-only SQL for AI agents, with layered safety guards.
Giving an LLM agent raw database access is a footgun. This MCP server opens a SQLite database to agents through four independent guard layers, so the worst an agent can do is read too slowly — and even that gets cut off.
한국어 문서: README.ko.md
Guard layers
Layer | What it stops | How |
Query validation | Writes, schema changes, injection via stacked statements | Only single |
Table allowlist | Reading sensitive tables (PII, credentials) |
|
Row cap | Context-window flooding | Every query is wrapped as a subquery with a server-side |
Execution cap | Runaway queries (cartesian joins) | SQLite progress-handler watchdog aborts after N VM steps with an actionable message |
OS-level read-only | Everything above failing | Connection opened with |
The design principle comes from building decision guards for a production LLM agent: don't trust the model to be careful — make carelessness impossible, and make every rejection message tell the agent what to do instead.
Related MCP server: sqlite-analyst
Tools
sql_list_tables— visible tables (allowlist applied)sql_describe_table— columns, types, row countsql_query— guarded read-only querysql_guard_status— current guard configuration (transparency for debugging)
Demo
Connected to Claude Desktop, querying the bundled ad-campaign demo DB — and refusing a delete request:

The agent freely explores and aggregates ("Which active campaign has the best CTR?"), but when asked to wipe the campaigns table, the guard rejects it and the agent explains why — read-only by design, enforced in code, not by prompt.
Setup
Zero dependencies beyond the MCP SDK — a synthetic ad-campaign demo DB is bundled and auto-created on first run.
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" }
}
}
}Then ask: "Which active campaign had the best CTR last week?" — the agent explores the schema and queries within the guardrails. Try asking it to delete something; read the refusal.
Test
pip install -e ".[dev]"
pytest # guard validation + execution enforcement, no external DB neededTests include the adversarial cases: stacked statements, SELECT-prefixed writes, allowlist bypass via JOIN, user-supplied LIMIT override attempts, and a cartesian-join runaway aborted by the VM-step watchdog.
License
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