Anarkh-Lee/universal-db-mcp
MCP and REST gateway for AI-assisted queries across 17 database backends
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Universal DB MCP is a TypeScript service for Node.js 20 or later. It sits between the AI client and the database: the assistant selects tools and formulates queries, while the connector retrieves metadata and executes requests through database drivers. Local clients launch the universal-db-mcp CLI over stdio; HTTP mode uses Fastify to serve Streamable HTTP at /mcp, legacy SSE at /sse, and a REST API.
The runtime combines @modelcontextprotocol/sdk with database-specific dependencies including pg, mysql2, mongodb, ioredis, better-sqlite3, and @clickhouse/client. The MCP tool surface includes execute_query, get_schema, get_table_info, get_enum_values, get_sample_data, and clear_cache. This standardizes how clients discover and invoke tools, not the underlying query dialect or metadata semantics.
Key Capabilities & Differentiators
The connector supports 17 backends, from PostgreSQL, MySQL, Oracle, and SQL Server to Redis, MongoDB, SQLite, ClickHouse, and engines such as Dameng and KingbaseES. Multi-schema discovery is available for engines including PostgreSQL, SQL Server, Oracle, and Dameng. Table comments, inferred relationships, enum values, and sample rows give assistants more context for query generation. Inferred relationships are useful hints, not substitutes for declared keys or verified joins.
Metadata retrieval combines batching with a configurable cache TTL. In the published 500-table example, batched discovery cuts retrieval from about 50 seconds to about 500 milliseconds; that is a schema retrieval example, not a query latency target. Connection pooling, TCP keep-alive, and automatic reconnection are intended for longer-lived sessions. Data masking covers common patterns such as phone numbers and email addresses, but it does not replace limiting which columns and rows the database account can read.
Trade-offs & Limitations
Compared with embedding a database driver in one application, this design adds another process and a protocol boundary, but makes schema and query tools reusable across AI clients and database engines. Compared with an engine-specific connector, breadth is the benefit; verify dialect handling, schema visibility, and permission behavior on the engines you plan to deploy rather than assuming identical behavior. For a single engine and a fixed query set, direct integration has fewer components to operate.
The default safe mode is read-only, but database-level least privilege remains the stronger boundary. Read access can still expose sensitive records or run expensive queries, so use scoped accounts and views and enforce workload limits on the database side. Legacy SSE accepts connection settings in the URL query string, where credentials can enter access logs; prefer Streamable HTTP for remote clients and redact sensitive headers from logs. Do not copy the sample root account into production.
Hardware & Deployment Guide
For local use, install with npm install -g universal-db-mcp or launch it via npx from the MCP client. For self-hosting, start with MODE=http and configure API_KEYS, or use Docker Compose, which builds from docker/Dockerfile, binds to 0.0.0.0, publishes port 3000, and checks /api/health. Replace the default API key and wildcard CORS policy before sharing the service, and put remote access behind TLS and network controls.
v2.14.0 makes --type optional in stdio mode: the process can start disconnected, then use connect_database, disconnect_database, and get_connection_status. A new connection replaces the existing one, so this is a switching workflow, not simultaneous multi-database querying in one stdio session. v2.13.0 fixed a shutdown hang by handling stdin closure and closing the MCP server transport.
safe defaults to read-only, with readwrite, full, and custom modes for explicit write access.docker/Dockerfile, publishes port 3000, and probes /api/health.Engineering and data teams that want Claude Code, Cursor, or other MCP clients to inspect schemas and run controlled read-only analysis across several database engines.
One application runs a fixed query set against one engine, or production access requires centrally enforced tenant isolation and approval workflows that this connector does not establish on its own.
Quick Start & Installation
npm install -g universal-db-mcp
Comparison vs. Top Coding, Skills & MCP Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| universal-db-mcp ★ | 942 | +1 | TypeScript | MIT | MCP and REST gateway for AI-assisted queries across 17 database backends |
| rea | 488.8k | +7.6k | TypeScript | MIT | A local CLI and MCP server for evidence-backed app and binary analysis |
| chrome-devtools-mcp | 60.4k | +760 | TypeScript | Apache-2.0 | Chrome DevTools via MCP and CLI for live browser debugging and performance analy |
| skills | 42.3k | +1.1k | TypeScript | MIT | TypeScript CLI for distributing and restoring skills across coding agents |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/Anarkh-Lee/universal-db-mcp.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about universal-db-mcp
How should I connect Claude Code locally and a remote client?
--type; connect_database replaces the current connection, get_connection_status reports its state, and disconnect_database closes it. For remote MCP clients, use Streamable HTTP at /mcp where supported. REST is a separate option for clients that do not speak MCP.What hardware does the connector need, and does it consume VRAM?
Can we deploy it commercially, and does self-hosting keep all data on-premises?
When is this a better fit than integrating a database driver directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy