Database Query Runner

v1.0.0Databasesstable

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

databaselegion-aimcpmcp-serverquery-builder
Share:
91
Stars
0
Downloads
0
Weekly
0/5

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

Multi-database access and querying
PostgreSQL, MySQL, SQL Server support
Query building and data analysis
TheRaLabs

Maintainer

LicenseGPL 3.0
Languagepython
Versionv1.0.0
UpdatedMay 6, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y database-mcp

Manual Installation

npx -y database-mcp

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

Install the database-mcp package

Install the server globally via npm so it is available as a command.

npm install -g database-mcp
2

Set 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"}'
3

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\"}"
      }
    }
  }
}
4

Restart your MCP client

Restart Claude Desktop (or your chosen MCP client) to load the new server configuration. The database tools will appear automatically.

5

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.

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.

Quick Config Preview

{ "mcpServers": { "database": { "command": "npx", "args": ["-y", "database-mcp"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides