🚀 Execute SQL queries on any database through MCP
Model Context Protocol (MCP) server for connecting to and querying multiple databases (PostgreSQL, MySQL, SQLite).
- 🔌 Support for multiple database types (PostgreSQL, MySQL, SQLite)
- 🔄 Manage multiple concurrent database connections
- 🔒 Separate read and write operations for better security
- 🛡️ SQL query validation to prevent unintended destructive operations
- 💾 Connection pooling and managementsal DB Client
- PostgreSQL (
psql
) - MySQL (
mysql
) - SQLite (
sqlite
)
Add the server to your MCP settings configuration file:
{
"mcpServers": {
"universal-db-client": {
"command": "npx",
"args": ["-y", "@izumisy/mcp-universal-db-client"]
}
}
}
Connect to a database using a connection string.
Parameters:
name
: Unique name for this connection (used as connection ID)dialect
: Database type (psql
,mysql
, orsqlite
)connectionString
: Connection string for the database
Example:
{
"name": "my-postgres-db",
"dialect": "psql",
"connectionString": "postgresql://user:password@localhost:5432/mydb"
}
List all active database connections.
Returns: Array of active connections with their IDs, dialects, and connection times
Disconnect a specific database connection.
Parameters:
connectionID
: The connection ID to disconnect
Disconnect all active database connections.
Run SELECT and other read-only SQL queries safely.
Supported Operations:
SELECT
- Query dataSHOW
- Show database informationDESCRIBE
/DESC
- Describe table structureEXPLAIN
- Explain query execution plan
Parameters:
connectionID
: The connection ID (connection name)query
: Array of SQL query strings (read-only operations only)
Example:
{
"connectionID": "my-postgres-db",
"query": [
"SELECT * FROM users WHERE id = 1",
"SELECT COUNT(*) FROM orders WHERE status = 'pending'"
]
}
Security: This tool validates queries and rejects destructive operations, making it safe for read-only access. If a destructive query is detected, it returns an error message suggesting to use query_write
instead.
Run INSERT, UPDATE, DELETE and other data-modifying queries.
Supported Operations:
INSERT
- Insert new dataUPDATE
- Update existing dataDELETE
- Delete dataCREATE
/ALTER
/DROP
- DDL operationsTRUNCATE
- Truncate tableREPLACE
/MERGE
- Replace/merge data
Parameters:
connectionID
: The connection ID (connection name)query
: Array of SQL query strings (any operation)
Example:
{
"connectionID": "my-postgres-db",
"query": [
"INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com')",
"UPDATE orders SET status = 'completed' WHERE id = 123"
]
}
Security: Use with caution as this tool can modify data. Should be restricted to authorized users only.
MIT