# db-connector-mcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/proton6980/db-connector  
**GitHub Stars:** 0  
**npm Downloads (last month):** 72  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/db-connector-mcp

## Description
Database Connector MCP Server - connect, query, and manage any database via MCP protocol

## Tools
Capabilities this server exposes over MCP:

- **list_connections** — 列出全部 active 连接（id、名称、类型、地址、库名）
- **create_connection** — 创建新连接：id + name + dbType(DM/MYSQL/KINGBASE/ORACLE/H2) + host + port + username + password + ...
- **update_connection** — 修改已有连接：按 connection（ID 或名称）定位，仅传需改字段
- **delete_connection** — 删除连接并关闭连接池，不可恢复
- **test_connection** — 测试连接可达性（JDBC `SELECT 1`），返回成功/失败及耗时
- **query_database** — 只读查询：`connection` + `sql` + `params`（`:name` 命名参数，绑定不拼接）
- **execute_dml** — 单条 INSERT/UPDATE/DELETE/MERGE，返回影响行数。需连接开启 DML；`allowFullTable=true` 放行无 WHERE 的全表操作
- **execute_ddl** — 单条 CREATE/ALTER/DROP/TRUNCATE。需连接开启 DDL
- **explain_sql** — SELECT 执行计划：只传 SELECT 原文（工具自动加 EXPLAIN），禁止自带 EXPLAIN / ANALYZE
- **list_tables** — 表清单（schema、表注释）
- **describe_table** — 字段/类型/可空/默认值/注释/主键/索引，`table` 可写 `TABLE` 或 `SCHEMA.TABLE
- **get_table_sample** — 表样例数据（≤5 行）

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "db-connector-mcp": {
    "command": "npx",
    "args": ["-y","db-connector-mcp"]
  }
}
```

## Documentation

## What db-connector-mcp does

db-connector-mcp acts as a local database sidecar, presenting configured JDBC connections as MCP tools. Supported connection types include Dameng DM8, MySQL, Kingbase KADB, Oracle, and H2. Its built-in web console provides connection CRUD operations, connectivity checks, connection-pool management, recent query statistics, and searchable audit logs with CSV export.

The service exposes its MCP endpoint at `/mcp`, while the web console runs separately on a local HTTP port. Credentials are stored in encrypted form using AES-256-GCM. A generated key is kept in the data directory unless `DBCONNECTOR_CRYPTO_KEY` is supplied.

## How it works

Agents select a connection by ID or name when invoking database tools. Read queries accept named parameters such as `:userId`; values are bound rather than interpolated into SQL. Query and plan responses include columns, rows, row counts, truncation status, and execution time. DML responses report the operation, affected-row count, and duration.

SQL passes through a parser-based safety check that classifies statements and rejects multiple statements, unsupported forms, and prohibited query shapes. Query results are capped at 100 rows and queries have a 10-second timeout. Statements are committed automatically and cannot be rolled back through the service.

The default HTTP access policy permits loopback clients only. The console can add individual IP addresses or CIDR ranges, and the same allowlist protects both the web interface and MCP endpoint. Audit entries record successful, failed, and blocked calls in an H2-backed store that persists across restarts.

## Setup and configuration

Run the packaged launcher with Node.js 16 or newer:

```bash
npx db-connector-mcp
```

The process normally exposes MCP on `http://127.0.0.1:63306/mcp` and the console on `http://127.0.0.1:63380`. `DBCONNECTOR_PORT` and `DBCONNECTOR_WEB_PORT` change those ports; both choose an available port automatically if the default is occupied. `DBCONNECTOR_DATA_DIR` changes the location of the H2 data and encryption key. Binding addresses can be controlled with `DBCONNECTOR_BIND_HOST` and `DBCONNECTOR_WEB_HOST`.

Cursor, Claude Code, VS Code, Cline, and Roo Code can connect using the HTTP/SSE endpoint. For example, clients using an MCP URL can point to `http://127.0.0.1:63306/mcp`.

## Tools and capabilities

- Manage active connections with `list_connections`, `create_connection`, `update_connection`, `delete_connection`, and `test_connection`.
- Run read-only SQL through `query_database` with named parameter binding.
- Execute one INSERT, UPDATE, DELETE, or MERGE with `execute_dml` when DML is enabled for the selected connection.
- Execute one CREATE, ALTER, DROP, or TRUNCATE statement with `execute_ddl` when DDL is enabled.
- Obtain a SELECT execution plan through `explain_sql`; the tool adds the EXPLAIN operation itself.
- Inspect schemas with `list_tables`, `describe_table`, and `get_table_sample`, which returns at most five rows.

## Limitations and notes

Write access is disabled by default and must be enabled separately for DML and DDL on each connection in the web console. UPDATE and DELETE statements require a WHERE clause unless `allowFullTable=true` is explicitly supplied. Database accounts should still use the minimum required privileges.

Oracle connections use a service name rather than a SID or TNS form, and Oracle `extraParams` are ignored. Oracle positional bindings such as `:1`, PL/SQL anonymous blocks, multiple statements, and some legacy `(+)` joins are outside the supported SQL forms. Multi-user access, RBAC, and remote-deployment features are not part of the current scope.

_Full upstream README: https://allmcps.com/mcp/db-connector-mcp/readme_

