Database MCP

Features

Database support, MCP tools, transport modes, and security in Database MCP

Database MCP gives AI assistants structured access to your databases through the Model Context Protocol. This page summarizes what it can do.

Database Support

Database MCP connects to four database backends with a single binary:

BackendVersionsNotes
MySQL5.7+ / 8.xFull support including character set configuration
MariaDB10.x+Treated as a distinct backend with its own defaults
PostgreSQL12+Native protocol support via libpq-compatible driver
SQLite3.xFile-based — requires only a path, no server needed

Each backend has sensible defaults for host, port, and user. See Configuration for the full default table.

MCP Tools

Database MCP exposes tools through the MCP protocol. The available tool set depends on the database backend and read-only setting. AI assistants call these tools to explore and query your database.

Tool Availability

ToolMySQL / MariaDBPostgreSQLSQLiteBlocked when read-only
list_databasesYesYesNoNo
list_tablesYesYesYesNo
get_table_schemaYesYesYesNo
get_table_schema_with_relationsYesYesYesNo
read_queryYesYesYesNo
write_queryYesYesYesYes
create_databaseYesYesNoYes

SQLite is file-based with a single database, so list_databases and create_database are not applicable.

list_databases

Discover all accessible databases on the connected server. This is typically the first tool an assistant calls to understand what data is available. Not available for SQLite.

list_tables

List all tables in a specific database. Requires a database name (use list_databases first on MySQL/MariaDB/PostgreSQL).

get_table_schema

Inspect column definitions for a table — column names, types, nullability, keys, and default values. Useful for understanding table structure before writing queries.

get_table_schema_with_relations

Like get_table_schema, but also includes foreign key relationships. Helps assistants understand how tables connect to each other.

read_query

Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, USE, EXPLAIN) against a specific database. This tool is always available and enforces SQL validation — write statements are rejected even when read-only mode is disabled. See Security for details on query validation.

write_query

Execute a write SQL query (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) against a specific database. This tool is only available when read-only mode is disabled. No SQL type validation is performed — the tool boundary is the access control.

create_database

Create a new database. Only available when read-only mode is disabled. Not supported for SQLite.

Transport Modes

Database MCP supports two transport modes for communicating with MCP clients.

Stdio (default)

The server communicates over standard input/output. This is the default mode and works with local MCP clients like Claude Desktop, Claude Code, and Cursor. No network configuration is needed — the client launches the server as a subprocess.

Best for: Local development, single-user setups, desktop MCP clients.

HTTP

The server runs as an HTTP service with Streamable HTTP transport and CORS support. This mode is useful for remote access or shared environments where multiple clients connect to the same server.

Best for: Remote servers, shared team databases, environments where the MCP client cannot launch local processes.

See Configuration for HTTP-specific options like bind host, port, and allowed origins.

Single Binary

Database MCP ships as a single compiled binary with no runtime dependencies. There is no language runtime to install, no package manager to configure, and no dependency tree to manage. Download the binary for your platform and it is ready to use.

On this page