Database Query Runner
A server that helps people access and query data in databases using the Query Runner with integration of the Model Context Protocol (MCP) Python SDK. Support databases including PostgreSQL Redshift MySQL Microsoft SQL Server Google APIs Amazon Web Se
What is Database Query Runner?
Database Query Runner is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to server that helps people access and query data in databases using the query runner with integration of the model context protocol (mcp) python sdk. support databases including postgresql redshift mysq...
A server that helps people access and query data in databases using the Query Runner with integration of the Model Context Protocol (MCP) Python SDK. Support databases including PostgreSQL Redshift MySQL Microsoft SQL Server Google APIs Amazon Web Se
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A server that helps people access and query data in database
Use Cases
Maintainer
Works with
Installation
NPM
npx -y database-mcpManual Installation
npx -y database-mcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Database Query Runner
Database Query Runner (database-mcp) is a multi-database MCP server built with the Model Context Protocol Python SDK that lets AI assistants connect to and query relational databases through natural language. It supports PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery, Oracle DB, and SQLite. Developers and data analysts use it to execute SQL, inspect schemas, retrieve sample data, and analyze query history — all without leaving their AI assistant.
Prerequisites
- Node.js 18+ or Python 3.8+ installed (server ships as an npm package wrapping Python)
- A running database instance (PostgreSQL, MySQL, SQL Server, BigQuery, SQLite, etc.)
- Database credentials (host, port, username, password, database name)
- An MCP-compatible client such as Claude Desktop, Cursor, or Windsurf
Install the database-mcp package
Install the server globally via npm so it is available as a command.
npm install -g database-mcpSet environment variables for your database
For a single database, export DB_TYPE (e.g. 'pg', 'mysql', 'mssql', 'sqlite', 'bigquery') and DB_CONFIG as a JSON string with connection details. For multiple databases, use DB_CONFIGS as a JSON array.
export DB_TYPE="pg"
export DB_CONFIG='{"host":"localhost","port":5432,"user":"myuser","password":"mypassword","dbname":"mydb"}'Add the server to your MCP client configuration
Open your client's config file (e.g. claude_desktop_config.json) and register database-mcp under the mcpServers key, passing DB_TYPE and DB_CONFIG as environment variables.
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["-y", "database-mcp"],
"env": {
"DB_TYPE": "pg",
"DB_CONFIG": "{\"host\":\"localhost\",\"port\":5432,\"user\":\"myuser\",\"password\":\"mypassword\",\"dbname\":\"mydb\"}"
}
}
}
}Restart your MCP client
Restart Claude Desktop (or your chosen MCP client) to load the new server configuration. The database tools will appear automatically.
Query your database through the AI assistant
The server exposes tools like execute_query, describe_table, find_table, get_table_sample, and list_databases. Ask your AI assistant to run SQL queries, inspect schemas, or retrieve sample rows.
Database Query Runner Examples
Client configuration
Example claude_desktop_config.json entry for connecting to a PostgreSQL database.
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["-y", "database-mcp"],
"env": {
"DB_TYPE": "pg",
"DB_CONFIG": "{\"host\":\"db.example.com\",\"port\":5432,\"user\":\"analyst\",\"password\":\"secret\",\"dbname\":\"analytics\"}"
}
}
}
}Prompts to try
Example prompts you can use once the server is connected.
- "List all databases available on this connection"
- "Show me the schema for the orders table"
- "Run this query and return results as a table: SELECT customer_id, SUM(total) FROM orders GROUP BY customer_id LIMIT 20"
- "Find all tables that contain the word 'product'"
- "Get 5 sample rows from the users table"
- "Show me the query history from this session"Troubleshooting Database Query Runner
Connection refused or authentication failure
Double-check DB_CONFIG values — host, port, user, password, and dbname must all be correct. For PostgreSQL on localhost, ensure pg_hba.conf allows the user. For remote databases, confirm the host is reachable and firewalls allow the port.
DB_TYPE not recognized
Use the correct short code for your database: 'pg' for PostgreSQL/Redshift/CockroachDB, 'mysql' for MySQL/RDS MySQL, 'mssql' for SQL Server, 'sqlite' for SQLite, 'bigquery' for BigQuery, 'oracle' for Oracle DB.
Multiple databases not showing up with list_databases
When connecting to multiple databases, use the DB_CONFIGS environment variable (a JSON array of connection objects) instead of DB_CONFIG. Each entry in the array should have a 'db_type' field alongside the connection details.
Frequently Asked Questions about Database Query Runner
What is Database Query Runner?
Database Query Runner is a Model Context Protocol (MCP) server that server that helps people access and query data in databases using the query runner with integration of the model context protocol (mcp) python sdk. support databases including postgresql redshift mysql microsoft sql server google apis amazon web se It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Database Query Runner?
Install via npm with the command: npx -y database-mcp. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Database Query Runner?
Database Query Runner works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Database Query Runner free to use?
Yes, Database Query Runner is open source and available under the GPL 3.0 license. You can use it freely in both personal and commercial projects.
Database Query Runner Alternatives — Similar Databases Servers
Looking for alternatives to Database Query Runner? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Database Query Runner in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Database Query Runner?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.