DB Gateway MCP Server
The DB Gateway MCP Server provides AI agents with direct access to databases across 8 engines (MySQL, PostgreSQL, Redshift, MongoDB, Redis, DynamoDB, Elasticsearch, Kafka) using 145+ tools, while keeping credentials hidden from the agent.
Query Execution: Run arbitrary SQL queries (
mysql_execute_query) and batch multiple statements (mysql_execute_batch).Schema Introspection: List databases/tables, describe structures, retrieve
CREATE TABLEstatements (single or all), and map foreign key relationships.Performance Monitoring: Explain query plans, view running processes, inspect server status/variables, and gather table statistics.
Administration: Switch databases, list indexes, kill processes, and manage connections.
Multi-Instance Support: Connect to multiple instances of the same engine using aliases (e.g.,
devandprod).Read-Only Mode: Restrict agents to
SELECT-only queries by settingREAD_ONLY=true.Selective Engine Registration: Only tools for specified engines are exposed, keeping the tool list clean.
Credential Safety: Agents reference only an alias; host, port, and password stay in the server configuration.
Provides tools for interacting with Elasticsearch, enabling search, indexing, and data exploration.
Provides tools for interacting with MongoDB, enabling operations on documents and collections, including schema discovery and data retrieval.
Provides tools for interacting with MySQL databases, including schema inspection, relationship discovery, and executing SQL queries.
Provides tools for interacting with PostgreSQL databases, including schema inspection, relationship discovery, and executing SQL queries.
Provides tools for interacting with Redis, enabling operations on data structures, keys, and cache management.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DB Gateway MCP Server Find users who signed up last month and never placed an order"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DB Gateway MCP Server
English | 한국어
An MCP server that gives AI agents direct access to your databases — 145+ tools across 8 engines.
The point is that the agent reads your schema itself instead of you pasting DDL into a prompt:
You: "Find users who signed up last month and never placed an order"
1. mysql_get_all_schemas → reads every table definition
2. mysql_get_table_relationships → finds the users ↔ orders foreign key
3. mysql_execute_query → runs the LEFT JOINWhy db-gateway?
Most database MCP servers cover one engine, or a handful of relational ones. If your stack is MySQL for the app, Redshift for analytics, Redis for cache, and Kafka for events, that means four servers with four different config styles.
This is one server, one config block:
Engines | Tools | |
Relational | MySQL, PostgreSQL, Redshift | 59 |
NoSQL | MongoDB, Redis, DynamoDB | 48 |
Search | Elasticsearch | 19 |
Streaming | Kafka | 19 |
DBS decides which of them are enabled — only those tools get registered, so a MySQL-only setup stays a MySQL-only tool list.
Related MCP server: Database MCP Server
See It Work
Every screenshot below is one real session against a development MySQL database holding 249 rows — unedited output, not mock data. The agent calls a single tool, mysql_execute_query, and never sees a host, port, or password: those stay in the client config, and the agent only ever names the alias.





Point the same server at production with READ_ONLY=true and steps 2 through 4 simply do not exist — the write tools are never registered, so the agent cannot see them to call them.
Quick Start
Requires Node.js 18+. Register it with your MCP client — no install step:
{
"mcpServers": {
"db-gateway": {
"command": "npx",
"args": ["-y", "db-gateway"],
"env": {
"DBS": "mysql,redis",
"MYSQL": "mysql://<user>:<password>@<host>:3306/<database>?alias=dev&default=true",
"REDIS": "redis://:@<host>:6379/0?alias=dev&default=true"
}
}
}
}DBS decides which engines are enabled — only those tools get registered.
Connection strings
One string per engine. Semicolons separate multiple instances.
Variable | Format |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
aliasis required. It is how tools address a specific instance — omit it and that engine fails to connect.
Several instances of the same engine — separate their connection strings with a semicolon. The agent picks one by passing an alias argument to any tool; default=true marks the one used when no alias is given:
MYSQL="mysql://<user>:<password>@<dev-host>:3306/<db>?alias=dev&default=true;mysql://<user>:<password>@<prod-host>:3306/<db>?alias=prod"DynamoDB is the exception — it takes DYNAMODB_REGION, DYNAMODB_ACCESS_KEY_ID, and DYNAMODB_SECRET_ACCESS_KEY instead. See .env.example for every option.
Read-Only Mode
READ_ONLY=true hides write tools from the tool list entirely and restricts *_execute_query to SELECT-style statements.
Register production as a second MCP server with this flag on. The agent then cannot modify production data — the write tools do not exist as far as it can see.
"db-gateway-prod": {
"command": "npx",
"args": ["-y", "db-gateway"],
"env": { "READ_ONLY": "true", "DBS": "mysql", "MYSQL": "..." }
}Documentation
Tool Reference — all 145+ tools, by engine
Connection Management — pooling, health checks, and why
connectionLimitmultiplies per sessionDeployment — SSE mode, Nginx, PM2, sharing one gateway across a team
License
MIT
Available Tools
17 toolsmysql_describe_tableB
Describe the structure of a MySQL table
Inputs: table_name (required), alias.
mysql_execute_batchA
Execute multiple SQL queries sequentially on a single connection. Useful for running several queries at once. All queries share the same connection, so SET variables and temporary tables persist across queries. Returns an array of { query, result } pairs.
Inputs: queries (required), alias.
mysql_execute_queryC
Execute SQL query on MySQL database
Inputs: query (required), alias, limit.
mysql_explain_queryA
Get the execution plan for a SQL query (EXPLAIN)
Inputs: query (required), alias.
mysql_get_all_schemasB
Get CREATE TABLE statements for all tables in the current database
Inputs: alias.
mysql_get_schemaB
Get the CREATE TABLE statement for a specific MySQL table
Inputs: table_name (required), alias.
mysql_get_table_relationshipsA
Get all foreign key relationships between tables in the current database
Inputs: alias.
mysql_kill_processB
Kill a MySQL connection/query by process ID
Inputs: process_id (required), alias.
mysql_list_connectionsA
List all configured MySQL connections with their status (connected/disconnected)
Inputs: no named parameters.
mysql_list_databasesB
List all databases the current user can see in MySQL
Inputs: alias.
mysql_list_indexesA
List all indexes on a specific MySQL table
Inputs: table_name (required), alias.
mysql_show_processlistC
Show all running queries and connections in MySQL (SHOW FULL PROCESSLIST)
Inputs: alias.
mysql_show_statusC
Show MySQL server status variables (connections, queries, etc.)
Inputs: alias, pattern.
mysql_show_tablesA
Show all tables in the current MySQL database
Inputs: alias.
mysql_show_variablesB
Show MySQL server configuration variables
Inputs: alias, pattern.
mysql_table_statsA
Get table statistics including row count, data size, and index size
Inputs: alias, table_name.
mysql_use_databaseC
Switch to a different MySQL database
Inputs: database_name (required), alias.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools target distinct MySQL operations (e.g., show_tables vs. list_databases vs. get_schema). A few pairs like execute_query/execute_batch and describe_table/get_schema overlap in purpose, but descriptions clarify the differences.
All tools follow a consistent 'mysql_<verb>_<noun>' pattern (e.g., mysql_show_tables, mysql_execute_query, mysql_kill_process). This makes the set predictable and easy to navigate.
At 17 tools, the server is slightly larger than the ideal 3-15 range but remains well-scoped for a MySQL gateway. Each tool addresses a specific operational need without redundancy.
The set covers core database operations: schema inspection, query execution, process management, and table relationships. While explicit CRUD or transaction tools are absent, mysql_execute_query and mysql_execute_batch provide a flexible escape hatch for any SQL operation.
Maintenance
Related MCP Connectors
Query, explore, and manage your databases through natural conversation.
Direct access to 60+ scraping and search tools. Extract structured data from Google (Search, Maps, Trends), Amazon, Airbnb, Social Media, and any web page directly into your AI agent.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to connect to and interact with PostgreSQL, MySQL, SQLite, and MongoDB databases through natural language, supporting schema exploration, query execution, data export, and more.13MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to securely interact with multiple databases (MySQL, PostgreSQL) via natural language queries, with cross-database querying and enterprise-grade security.9 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.-
- AlicenseBqualityDmaintenanceEnables AI agents to interact with over 50 SQL and NoSQL databases through MCP tools for querying, schema inspection, and table management.51MIT