Database MCP Server

Universal database MCP server supporting multiple database types including PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server

Local serverstdioPython

What is the Database MCP server?

If you already use Database, the database mcp server is the piece that lets your assistant work with it directly. Universal database MCP server supporting multiple database types including PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery.

What the server does

A server that helps people access and query data in databases using the Legion Query Runner with integration of the Model Context Protocol (MCP) Python SDK.

The Model Context Protocol (MCP) is a specification for maintaining context in AI applications. This server uses the MCP Python SDK to:

  • Unified Multi-Database Interface — Connect to PostgreSQL, MySQL, SQL Server, and other databases through a single consistent API - no need to learn different client libraries for each database type
  • AI-Ready Integration — Built specifically for AI assistant interactions through the Model Context Protocol (MCP), enabling natural language database operations
  • Zero-Configuration Schema Discovery — Automatically discovers and exposes database schemas without manual configuration or mapping
  • Database-Agnostic Tools — Find tables, explore schemas, and execute queries with the same set of tools regardless of the underlying database technology
  • Secure Credential Management — Handles database authentication details securely, separating credentials from application code
  • Simple Deployment — Works with modern AI development environments like LangChain, FastAPI, and others with minimal setup

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • execute_query — Execute a SQL query and return results as a markdown table
  • execute_query_json — Execute a SQL query and return results as JSON
  • get_table_columns — Get column names for a specific table
  • get_table_types — Get column types for a specific table
  • get_query_history — Get the recent query history
  • list_databases — List all available database connections
  • get_database_info — Get detailed information about a database including schema
  • find_table — Find which database contains a specific table
  • describe_table — Get detailed description of a table including column names and types
  • get_table_sample — Get a sample of data from a table
  • Resources — The Resources tool exposed by this server
  • Tools — All database-specific tools (like execute_query, get_table_columns, etc.) require a db_id parameter to specify which database to use

Credentials and setup notes

Configuration is passed through the environment: DB_TYPE, DB_CONFIG, DB_CONFIGS. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Installation

The server ships on npm as @modelcontextprotocol/inspector, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

Where it fits

This sits in the database access group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Database's toolset — execute_query, execute_query_json, get_table_columns and 11 more — is a fair guide to whether it matches your workflow.

This entry was verified against Database's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Database.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
execute_queryExecute a SQL query and return results as a markdown table
execute_query_jsonExecute a SQL query and return results as JSON
get_table_columnsGet column names for a specific table
get_table_typesGet column types for a specific table
get_query_historyGet the recent query history
list_databasesList all available database connections
get_database_infoGet detailed information about a database including schema
find_tableFind which database contains a specific table
describe_tableGet detailed description of a table including column names and types
get_table_sampleGet a sample of data from a table
ResourcesThe Resources tool exposed by this server.
ToolsAll database-specific tools (like execute_query, get_table_columns, etc.) require a db_id parameter to specify which database to use.
PromptsThe Prompts tool exposed by this server.
TestingThe Testing tool exposed by this server.

How to install the Database MCP server

REPLACE DB_TYPE and DB_CONFIG with your connection info.
{
    "mcpServers": {
      "database-mcp": {
        "command": "uvx",
        "args": [
          "database-mcp"
        ],
        "env": {
          "DB_TYPE": "pg",
          "DB_CONFIG": "{\"host\":\"localhost\",\"port\":5432,\"user\":\"user\",\"password\":\"pw\",\"dbname\":\"dbname\"}"
        },
        "disabled": true,
        "autoApprove": []
      }
    }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
DB_TYPEConfiguration value read at startup.Optional
DB_CONFIGConfiguration value read at startup.Optional
DB_CONFIGSConfiguration value read at startup.Optional

Example prompts to try

  • Use Database to execute query.
  • Use Database to execute query json.
  • Use Database to get table columns.

Frequently asked questions

It connects Database to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (execute_query, execute_query_json, get_table_columns, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Database directly.