database-service MCP server
Commit Oct 28, 2026Allows an AI client to query, inspect, and analyze MySQL, PostgreSQL, Oracle, and Redis databases with persistent session support.
Also known as jadchene/mcp-database
- Stars
- 1
- Tools
- 8
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Oct 28, 2026
- License
- MIT
What is database-service MCP?
database-service allows an AI client to query, inspect, and analyze MySQL, PostgreSQL, Oracle, and Redis databases with persistent session support. It exposes 8 tools, such as connect, disconnect, get_transaction_status.
Summary generated from the project's README
About database-service MCP server
Querying and managing multiple database engines from an AI client is what this service enables. It provides a unified interface for interacting with MySQL, PostgreSQL, Oracle, and Redis. Developers can use it to inspect schemas, run SQL queries, manage transactions, and analyze performance metrics through tools like list_tables, execute_query, and explain_query.
The server runs locally via Node.js and connects to your databases using a configuration file named databases.json. It supports persistent sessions, meaning variables, temporary tables, and transaction states remain active as long as the session is open. You can configure specific databases as read-only or enable dangerMode to bypass certain restrictions.
Setup involves adding the service to clients like Claude Code or Codex using a specific configuration path. The server manages connections through a stdio interface, requiring no separate background process or HTTP port. It includes specialized tools for Redis, such as redis_get and redis_scan, alongside standard SQL capabilities for relational engines.
What you can do with it
- 1Inspect database structuresAsk the AI to list all tables and describe the columns in a specific schema.
- 2Manage SQL transactionsPerform a series of data modifications and then commit or roll them back within a single session.
- 3Retrieve Redis dataFetch values from specific keys or scan through a Redis database.
Written from the project's README. Every use case is checked against a quote from it.
database-service MCP tools 8
Detected from the READMEconnectdisconnectget_transaction_statuscommit_transactionrollback_transactionexecute_queryexecute_statementexecute_script
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablejadchene/mcp-database is public and reachablegithub.com/jadchene/mcp-database ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-10-28github.com/jadchene/mcp-database ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model8 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubEnglish | 简体中文
MCP Database Service
An MCP server for MySQL, PostgreSQL, Oracle, and Redis with explicit persistent connections and SQL session continuity.
Quick Start
Use Node.js 24 or later and install the service:
npm install -g @jadchene/mcp-database-service
Save the configuration below as databases.json and replace the connection details. Use the absolute path to that file when adding the service.
Codex:
codex mcp add database -- mcp-database-service --config /absolute/path/databases.json
Claude Code:
claude mcp add database -- mcp-database-service --config /absolute/path/databases.json
On Windows, a path such as C:/mcp/database/databases.json works. The client starts the stdio service; no separate background process or HTTP port is needed. The config path can also be supplied through MCP_DATABASE_CONFIG; there is no default config path.
Configuration
{
"sessionIdleTimeoutMs": 1800000,
"maxSessions": 32,
"query": {
"timeoutMs": 5000
},
"logging": {
"enabled": false,
"directory": "./logs"
},
"databases": [
{
"key": "main-mysql",
"type": "mysql",
"enable": true,
"readonly": true,
"dangerMode": false,
"codexAutoReview": false,
"connection": {
"host": "127.0.0.1",
"port": 3306,
"databaseName": "app_db",
"user": "app_reader",
"password": "replace-with-password",
"connectTimeoutMs": 5000,
"ssl": false
}
},
{
"key": "main-postgresql",
"type": "postgresql",
"enable": false,
"readonly": true,
"dangerMode": false,
"codexAutoReview": false,
"connection": {
"host": "127.0.0.1",
"port": 5432,
"databaseName": "app_db",
"user": "app_reader",
"password": "replace-with-password",
"connectTimeoutMs": 5000,
"ssl": false
}
},
{
"key": "oracle-thick-example",
"type": "oracle",
"enable": false,
"readonly": true,
"dangerMode": false,
"codexAutoReview": false,
"connection": {
"host": "127.0.0.1",
"port": 1521,
"serviceName": "XEPDB1",
"user": "app_reader",
"password": "replace-with-password",
"connectTimeoutMs": 5000,
"clientMode": "thick",
"clientLibDir": "C:/oracle/instantclient_19_25"
}
},
{
"key": "cache-redis",
"type": "redis",
"enable": false,
"readonly": true,
"dangerMode": false,
"codexAutoReview": false,
"connection": {
"host": "127.0.0.1",
"port": 6379,
"databaseName": 0,
"username": "default",
"password": "replace-with-password",
"connectTimeoutMs": 5000
}
}
]
}
The same configuration is available in databases.example.json. Keep the targets you need, replace their connection details, and set enable to true. Oracle Thin mode uses "clientMode": "thin" without clientLibDir; Redis without authentication can omit username and password. Config values are literal; ${VAR} placeholders are not expanded.
enable: false hides a target and closes its sessions. Configuration reloads automatically or through reload_config; invalid updates keep the last valid config. Connection or permission changes invalidate existing sessions.
Timeouts are in milliseconds. Idle time restarts after each operation, and maxSessions includes connections being established. Logging is off by default; relative log directories resolve from the config directory.
Supported Databases
| Database | SQL Query | SQL Write | Runtime Analysis | SQL Script |
|---|---|---|---|---|
| MySQL | ✓ | ✓ | ✓ | ✓ |
| PostgreSQL | ✓ | ✓ | ✓ | — |
| Oracle | ✓ | ✓ | — | — |
| Redis | — | — | — | — |
Redis supports GET, HGETALL, SCAN, and connectivity checks.
Tools
| Tool | Purpose |
|---|---|
list_databases / show_loaded_config / reload_config |
List enabled targets; inspect or reload sanitized configuration. |
connect |
Open an independent connection for an enabled databaseKey; return sessionId. |
disconnect |
Close an idle session; uncommitted work is rolled back. |
get_transaction_status |
Read actual transaction state without changing it. |
commit_transaction |
Commit the current SQL transaction. |
rollback_transaction |
Roll back the whole current SQL transaction. |
list_schemas / list_tables / describe_table |
Inspect schemas, tables, and columns. |
list_indexes / get_table_statistics / show_create_table |
Inspect indexes, statistics, and DDL. |
list_views / search_tables / search_columns |
List views or search table/column names. |
show_variables / find_long_running_queries |
Inspect settings and slow activity. |
find_blocking_sessions / show_locks |
Inspect blocking and locks, subject to engine support and privileges. |
execute_query |
Execute one read-only SQL statement with parameters and a row limit. |
explain_query / analyze_query |
Inspect a static plan or run runtime analysis; pass the original SQL. |
execute_statement |
Execute one non-query statement, including SET, USE, transaction control, DML, or DDL. |
execute_script |
Execute a whole MySQL script from sql or server-local sqlFile (UTF-8, at most 2 MiB). |
redis_get / redis_hgetall / redis_scan |
Read strings/hashes or cursor-scan Redis keys. |
Sessions and Transactions
Call connect with a databaseKey, reuse the returned sessionId for subsequent operations, and call disconnect when finished. Variables, temporary tables, the current schema, and transactions persist within that session.
Run same-session operations sequentially. Reconnect after idle expiry, connection loss, or a service restart. If a write times out or loses its connection, check the result before retrying.
Start SQL transactions with native SQL through execute_statement; use commit_transaction, rollback_transaction, and get_transaction_status to manage them. Queries do not automatically commit or roll back transactions. execute_script uses the current transaction by default; use useTransaction: true for a script-owned transaction without an existing transaction or transaction-control statements in the script. DDL follows the database's own commit rules.
Writes and Approval
Set the target's readonly to false to allow writes. Statements, scripts, and non-empty transaction commits require a client that supports interactive approval; rollback does not require approval.
Optional codexAutoReview: true allows compatible Codex clients to review operations automatically. dangerMode: true overrides readonly and skips approval. Both are disabled by default; database account permissions still apply.
Oracle
Enabled Oracle targets in one process must share the client mode and library directory. DML requires manual commit, and explain_query requires an active transaction.
Development
npm install
npm run build
npm test
npm run verify:reload
npm run verify:package
Agent skill: database-mcp.
License
database-service MCP questions
What tools does database-service MCP provide?
It exposes 8 tools, including connect, disconnect, get_transaction_status, commit_transaction, rollback_transaction.
Which databases are supported?
The server supports MySQL, PostgreSQL, Oracle, and Redis.
How do I enable write access to a database?
You must set the target's 'readonly' property to false in the configuration file.
Can I run multiple SQL statements in a single session?
Yes, variables, temporary tables, the current schema, and transactions persist within a session after calling connect.