
SQL Preview
Let agents run read-focused SQL and inspect schemas against configured databases without opening a separate SQL client.
Overview
SQL Preview is a MCP server for the Build phase that runs governed SQL queries and schema inspection for agent-connected databases.
What is this MCP server?
- Inspect database schemas from MCP-connected agents
- Run SQL with SQL_PREVIEW_MCP_SAFE_MODE defaulting to true (mutations opt-in via false)
- Cap result sets with SQL_PREVIEW_MAX_ROWS default 10000
- Headless connection profiles via secret SQL_PREVIEW_CONNECTIONS JSON
- npx sql-preview --stdio for local MCP clients (registry version 0.6.4)
- Registry version 0.6.4 on npm as package sql-preview
- Default SQL_PREVIEW_MAX_ROWS is 10000
- SQL_PREVIEW_MCP_SAFE_MODE defaults to true in registry metadata
What problem does it solve?
Agents cannot safely explore live schemas and sample queries unless you bolt on a controlled database bridge.
Who is it for?
Indie builders wiring Postgres or other SQL stores who want read-biased agent access with explicit connection profiles.
Skip if: Greenfield projects with no database yet, or teams that refuse to put connection secrets in local MCP environment variables.
What do I get? / Deliverables
You get schema-aware answers and capped query previews in-chat while mutating SQL stays off unless you opt out of safe mode.
- Agent-visible table and column metadata from connected databases
- Capped query result previews for debugging and analytics checks
- Documented MCP stdio entry with environment-driven connection profiles
Recommended MCP Servers
Journey fit
How it compares
Governed SQL MCP bridge, not an ORM generator or migration skill.
Common Questions / FAQ
Who is SQL Preview MCP for?
It is for developers using Claude Code or Cursor who need agents to inspect schemas and run bounded SQL against configured connections.
When should I use SQL Preview MCP?
Use it during backend build and data debugging when you want read-focused exploration with safe mode and row limits enabled.
How do I add SQL Preview MCP to my agent?
Register npx sql-preview with --stdio, set SQL_PREVIEW_CONNECTIONS to your JSON profiles, and keep SQL_PREVIEW_MCP_SAFE_MODE true unless you intentionally allow writes.