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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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: warehouse-mcp
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
- 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
- AlicenseAqualityBmaintenanceEnables AI agents to inspect database schemas and run strictly read-only SQL queries with guardrails against destructive statements, multi-statement chaining, and unbounded scans. Supports SQLite natively and PostgreSQL optionally.437 PyPIMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to explore and query PostgreSQL or SQLite databases read-only, with SQL allow-listing, automatic row limits, statement timeouts, column masking, per-tool rate limits and JSONL audit logging.MIT