execute_queryLABSCO SUMMARY
Same questions, different databases.
The value is not any one engine but not having to change how you ask. Connect Postgres and SQL Server side by side and explore both with the same calls.
What it is
An MCP server built on the Legion Query Runner that puts several database engines behind one set of operations. The engine is named by a DB_TYPE code, schemas are discovered without mapping, and the same calls work whichever database is behind them.
What you get
- One interface across PostgreSQL, MySQL, Microsoft SQL Server, Redshift and CockroachDB
- Several databases connected at once, with the user choosing which to query
- Schema discovery with no manual configuration or mapping
- Query execution and result handling identical on every engine
- Database operations exposed as MCP resources, tools and prompts
- A FastAPI integration as an alternative to running standalone
Requirements
Connection details for each database, supplied as environment variables, command-line arguments or in the MCP settings JSON, with a DB_TYPE code naming the engine — pg, mysql, mssql, redshift or cockroach.
Setup effort
One command plus credentials — pip install database-mcp, then supply credentials
USE CASES
Getting oriented in a database you have never seen
Schemas are discovered on connection, so you can ask what tables exist before writing any SQL.
Comparing data across two engines
Connect a Postgres and a MySQL database at once and query both in the same session.
Querying a warehouse the same way as an app database
Redshift is reached through the same execution path as an operational database, with only the DB_TYPE code changing.
Keeping database credentials out of client code
Connection details are supplied as environment variables, command-line arguments or MCP settings rather than embedded anywhere.
Adding database access to an existing service
The same server runs as a FastAPI integration when a standalone MCP process is not what you want.
10 tools
Listed in project docs. Your client may show a different list.
execute_query_jsonget_table_columnsget_table_typesget_query_historylist_databasesget_database_infofind_tabledescribe_tableget_table_sampleBEFORE YOU INSTALL
What to know first
Tools you get
10 tools named in the project's documentation.
Requires
- DB_TYPE in your environment
- DB_CONFIG in your environment
INSTALLATION
Connect your client
Add the block to your client, or run the command directly.
Server setup
Configuration file
{
"mcpServers": {
"database": {
"command": "python",
"args": [
"-m",
"database_mcp"
],
"env": {
"DB_TYPE": "pg",
"DB_CONFIG": "{\"host\":\"localhost\",\"port\":5432,\"user\":\"user\",\"password\":\"pw\",\"dbname\":\"dbname\"}"
}
}
}
}To connect several databases at once, set DB_CONFIGS instead of DB_TYPE and DB_CONFIG: a JSON array in which each entry has db_type, configuration and description.
pip
pip install database-mcp