# Repository Briefing: Anarkh-Lee/universal-db-mcp
> Source: https://repoforai.com/repo/Anarkh-Lee/universal-db-mcp (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/Anarkh-Lee/universal-db-mcp
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: B (53/100 · Maintenance 6/35 · Adoption 16/25 · Releases 11/20 · License 20/20)
- **Latest Release**: v2.14.0 (2026-03-17) — https://github.com/Anarkh-Lee/universal-db-mcp/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Docker, Self-Hosted, MCP, CLI, API
- **Momentum**: 942 ★ total (+0 24h / +1 7d) · 90 forks
- **When to Use**: Best for: 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. Skip if: 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.

## Overview
```text
### Architecture & 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.
```

## Key Capabilities
```text
- Transports: Two startup modes expose MCP stdio, legacy SSE, Streamable HTTP, and REST.
- Database coverage: 17 backends span relational, embedded, NoSQL, and OLAP systems, including Dameng and KingbaseES.
- Connection lifecycle: v2.14.0 adds stdio connect, disconnect, and status tools; connecting again replaces the current connection.
- Schema discovery: Configurable cache TTL, batched metadata retrieval, table comments, and inferred relationships support query generation.
- Permissions: `safe` defaults to read-only, with `readwrite`, `full`, and `custom` modes for explicit write access.
- Self-hosting: Docker Compose builds from `docker/Dockerfile`, publishes port 3000, and probes `/api/health`.
```

## Quick Start / Clone
```bash
npm install -g universal-db-mcp
```
