Database Auditor MCP
Provides read-only SQL query execution, AST-based guardrails, dynamic schema introspection, and analytical data profiling for PostgreSQL databases.
Provides read-only SQL query execution, AST-based guardrails, dynamic schema introspection, and analytical data profiling for SQLite databases.
Click on "Deploy 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., "@Database Auditor MCPrun a health check and profile the invoices table"
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.
MCP Database Auditor
Inspect database schemas, profile tables and review SQL query plans through the Model Context Protocol.
The auditor gives an MCP client structured access to SQLite and PostgreSQL metadata and read-only queries. SQL policy checks, database permissions and execution deadlines help keep exploratory database work controlled.
Features
Schema exploration: tables, columns, keys, indexes and relationships exposed as MCP resources.
Read-only queries: SQLGlot AST validation, function policies and bounded result limits.
Table profiling: sampled column statistics, including JSON and decimal values.
Query-plan inspection: EXPLAIN output with scan and indexing observations.
Audit records: JSONL events with execution outcomes and normalized query fingerprints.
Schema comparison: changes between successive in-process snapshots.
Related MCP server: Postgres Analytics MCP Server
Architecture
flowchart LR
Client[MCP client] --> Tools[FastMCP tools and resources]
Tools --> Policy[SQL AST validation]
Policy --> Database[Read-only SQLite or PostgreSQL]
Database --> Results[Rows, schema and query plans]
Results --> Output[Profiles, audit events and responses]MCP tool | Purpose |
execute_safe_query | Validate and execute a read-only query |
profile_table | Summarize a sample of table data |
get_database_health | Report connection and database information |
analyze_query_plan | Inspect the database query plan |
schema_changes | Compare the current schema with the previous snapshot |
Schema resources: schema://current and schema://table/{table_name}.
Quick start
python -m venv .venv
# Activate the environment, then install:
pip install -e ".[dev]"
python scripts/seed_demo_db.py
python server.pyIn another terminal with the environment activated:
python client_test.pyThe default transport is stdio. DATABASE_URL selects a database connection; the default configuration initializes a local SQLite demo. AUDIT_LOG_PATH selects the JSONL audit destination.
For local SSE:
python server.py --transport sse --host 127.0.0.1 --port 8000Use least-privilege database roles. A hosted SSE deployment also needs an authentication layer.
PostgreSQL
The Compose configuration separates the database owner from a SELECT-only reader:
docker compose up --buildUse the disposable reader URL from docker-compose.yml for TEST_POSTGRES_URL when running the PostgreSQL integration test:
python -m pytest tests/test_postgres_integration.py -qValidation and performance
python -m pytest -q
python benchmark.py --repeats 30 --output benchmark-results.jsonThe local suite passes 58 tests. Linux CI also passes the PostgreSQL integration job and the SQLite/MCP checks.
Operation | Median | p95 |
Schema reflection | 14.80 ms | 15.80 ms |
SQL policy validation | 0.445 ms | 0.591 ms |
Measurements use 30 runs on a seeded five-table local SQLite database. Benchmark samples ? CI results
Profiles summarize the first 100 returned rows. Schema comparison state lasts for the server process, and query-plan observations should be interpreted alongside the database workload.
Demo

Regenerate the terminal walkthrough with requirements-demo.txt and python scripts/render_demo.py.
Development
Engineering guide ? CPU service-check notebook ? Continuation notes
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables an AI assistant to run guarded, read-only SQL queries against a Postgres database with enforced limits and validation.MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to safely inspect and query PostgreSQL databases with read-only enforcement, row/timeout limits, and audit logging, providing tools for schema/table listing, read-only queries, query explanations, and table statistics.-
- AlicenseNot gradedqualityCmaintenanceLets an AI assistant explore and query Postgres, DuckDB, or Snowflake with read-only SQL, table and schema discovery, sampling, and explainable guardrails.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query Postgres, BigQuery and DuckDB read-only through policy-checked SQL, with AST-based guards that refuse writes and dangerous functions, column masking on the way out, and an audit log of every query. Also exposes schema browsing and query-planning tools so agents can see allowed tables, columns and costs before running anything.MIT