Universal DB MCP logo

Universal DB MCP

Query PostgreSQL, SQLite, MySQL, and DuckDB through security-validated MCP tools with read-only defaults.

Install Universal DB MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "universal-db-mcp": {
      "command": "uvx",
      "args": [
        "universal-db-mcp"
      ],
      "env": {
        "POSTGRES_URI": "YOUR_VALUE_HERE",
        "SQLITE_PATH": "YOUR_VALUE_HERE",
        "MYSQL_URI": "YOUR_VALUE_HERE",
        "DUCKDB_PATH": "YOUR_VALUE_HERE",
        "ALLOW_DESTRUCTIVE": "YOUR_VALUE_HERE",
        "MAX_RESULT_ROWS": "YOUR_VALUE_HERE",
        "QUERY_TIMEOUT": "YOUR_VALUE_HERE",
        "RATE_LIMIT_RPM": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx universal-db-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The universal-db-mcp MCP server connects AI agents to PostgreSQL, SQLite, MySQL, and DuckDB through a Python-native FastMCP interface. It exposes SQL querying, schema inspection, query plans, health checks, history, and schema comparison tools. Queries are read-only by default and pass through eight security layers, including injection detection, statement blocking, parameter checks, and result limits. Reach for it when an agent needs controlled access to local databases, analytics files, or configured database services.

Use cases

  • Query local SQLite application data
  • Analyze DuckDB and Parquet-backed datasets
  • Inspect database schemas before generating SQL
  • Review query plans without execution
  • Compare schemas for drift

Key features

  • Read-only SQL access by default
  • Eight-layer SQL injection prevention
  • PostgreSQL, SQLite, MySQL, and DuckDB adapters
  • Schema inspection and drift comparison
  • Query plans, history, and health metrics
  • Result limits and configurable safeguards

Tools8

What Universal DB MCP lets your agent do. Expand a tool for its parameters.

Verified live~713 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

32/32 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · universal-db-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit5mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed8Callable tools this server registers over MCP.
Directory activity19 viewsConfig copies, upvotes, and views on AllMCPs.

How Universal DB MCP works

What universal-db-mcp MCP server does

The universal-db-mcp MCP server gives AI agents database access through MCP tools for four supported systems: PostgreSQL, SQLite, MySQL, and DuckDB. SQLite and DuckDB can run locally without a separate database service. DuckDB can also be used for in-process analytics involving supported local data files.

The default operating mode is read-only. The server is designed for cases where an agent needs to inspect data or structure without receiving unrestricted SQL access. Destructive operations can be configured, but the README recommends using dedicated read-only database accounts and does not treat application-level controls as a replacement for database permissions.

How it works

The server is implemented in Python with FastMCP and selects database adapters from environment configuration. A single process can be configured with more than one database connection. Agents can first call schema to inspect tables and columns, then use query for SQL generated from that structure.

Before a query reaches the database driver, the server applies eight protection layers. These include driver-level read-only settings, blocked write keywords, detection of common injection patterns, rejection of multiple statements, parameter type validation, result-size limits, identifier sanitization, and DuckDB-specific filesystem restrictions. The query tool limits results to MAX_RESULT_ROWS, which defaults to 1,000. The security model blocks patterns such as UNION SELECT, SQL comments, stacked statements, and several time-delay functions.

The explain tool returns a query execution plan without running the query. A DRYRUN setting can also be used while prototyping so the agent receives planning information instead of executing the statement. This is useful for reviewing generated SQL before allowing database work.

Setup and configuration

Run the universal-db-mcp MCP server with uvx universal-db-mcp, or build and run the supplied Docker image. Set one or more connection variables before starting it: POSTGRES_URI, SQLITE_PATH, MYSQL_URI, or DUCKDB_PATH. DuckDB accepts :memory: for a temporary in-memory database. SQLite and DuckDB do not require a database server or Docker.

Each adapter has a read-only setting enabled by default: POSTGRES_READONLY, SQLITE_READONLY, MYSQL_READONLY, and DUCKDB_READONLY. Other controls include ALLOW_DESTRUCTIVE, MAX_RESULT_ROWS, QUERY_TIMEOUT, RATE_LIMIT_RPM, and ENABLE_LOGGING. MCP client configuration passes these values through the process environment. The README provides examples for Claude Desktop, Claude Code, Cursor, Windsurf, and Docker.

Tools and capabilities

  • query: Execute SQL subject to the configured security checks.
  • schema: List tables and columns without additional configuration.
  • explain: Retrieve a query plan without executing the query.
  • health: Report connection status, database version, and pool metrics.
  • list_databases: Show configured databases and their connection state.
  • query_history: Inspect the last 100 executed queries.
  • snapshot_schema: Save the current schema for later comparison.
  • schema_diff: Compare the current schema with the most recent snapshot.

These tools support data exploration, generated-SQL review, connection diagnostics, and basic schema drift checks.

Limitations and notes

The security filters are defense-in-depth controls, not a substitute for database permissions. Use credentials that cannot modify production data when possible. DuckDB has an adapter-level blocklist for filesystem and extension operations including read_csv(), read_parquet(), glob(), LOAD, INSTALL, httpfs, and COPY; read-only mode alone does not block every file read. Large query results are truncated at the configured row limit, and query history covers only the last 100 queries.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Universal DB MCP

universal-db-mcp is an MCP server that connects AI agents to PostgreSQL, SQLite, MySQL, and DuckDB. Its main tools execute security-validated SQL, inspect schemas, explain queries without running them, check database health, review query history, and compare schemas against snapshots. Queries are read-only by default.

Run it with `uvx universal-db-mcp` after setting a database environment variable such as `SQLITE_PATH`, `DUCKDB_PATH`, `POSTGRES_URI`, or `MYSQL_URI`. You can also install the project in a Python environment or run its Docker image, then add the command to an MCP client configuration.

It supports PostgreSQL, SQLite, MySQL, and DuckDB. SQLite and DuckDB can run locally without a separate database service, while PostgreSQL and MySQL use connection URIs. DuckDB also supports an in-memory path using `DUCKDB_PATH=:memory:`.

Yes, the README includes Cursor configuration among its client examples. Configure the MCP command and pass the appropriate database environment variables, such as `SQLITE_PATH` or `POSTGRES_URI`, through the client.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewUniversal DB MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/universal-db-mcp?style=directory)](https://allmcps.com/mcp/universal-db-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/universal-db-mcp"><img src="https://allmcps.com/api/badge/universal-db-mcp?style=directory" alt="Universal DB MCP on AllMCPs" /></a>