rog0x avatar

Database

rog0x/mcp-database-tools

This is a static analysis toolkit for SQL that doesn't touch your actual database. It gives Claude five tools: sql_format for prettifying queries, sql_explain for translating SQL into plain English with optimization hints, schema_analyze for parsing CREATE TABLE statements and generating Mermaid ER diagrams, query_build for generating SQL from natural language, and migration_generate for diffing two schemas and producing ALTER TABLE statements with rollback support. Useful when you're working with SQL in documentation, learning queries, or need quick schema visualization without spinning up a database connection. Supports MySQL, PostgreSQL, and SQLite syntax across all tools.

tools
5
transport
STDIO
last updated
Mar 22, 2026

Tools

5 tools

Public tool metadata for what this MCP can expose to an agent.

sql_formatFormat and prettify SQL queries with proper indentation, uppercased keywords, and aligned columns. Supports MySQL, PostgreSQL, and SQLite syntax.

Format and prettify SQL queries with proper indentation, uppercased keywords, and aligned columns. Supports MySQL, PostgreSQL, and SQLite syntax.

No parameter schema in public metadata yet.

sql_explainTake a SQL query and explain what it does in plain English, step by step. Identifies query type, tables, columns, conditions, and provides optimization tips.

Take a SQL query and explain what it does in plain English, step by step. Identifies query type, tables, columns, conditions, and provides optimization tips.

No parameter schema in public metadata yet.

schema_analyzeParse CREATE TABLE statements to extract tables, columns, types, constraints, foreign keys, and indexes. Generates an ER diagram in Mermaid format.

Parse CREATE TABLE statements to extract tables, columns, types, constraints, foreign keys, and indexes. Generates an ER diagram in Mermaid format.

No parameter schema in public metadata yet.

query_buildBuild SQL queries from natural language descriptions. Supports common patterns like filtering by date, aggregation, joins, ordering, and pagination.

Build SQL queries from natural language descriptions. Supports common patterns like filtering by date, aggregation, joins, ordering, and pagination.

No parameter schema in public metadata yet.

migration_generateCompare two schemas (old vs new CREATE TABLE statements) and generate ALTER TABLE migration statements. Produces both up (forward) and down (rollback) migrations.

Compare two schemas (old vs new CREATE TABLE statements) and generate ALTER TABLE migration statements. Produces both up (forward) and down (rollback) migrations.

No parameter schema in public metadata yet.

Sponsors

Readme

mcp-database-tools

MCP server providing SQL and database tools for AI agents. All analysis is performed on SQL text — no actual database connection required.

Tools

sql_format

Format and prettify SQL queries with proper indentation, uppercased keywords, and aligned columns. Supports MySQL, PostgreSQL, and SQLite syntax.

sql_explain

Take a SQL query and explain what it does in plain English, step by step. Identifies query type, tables, columns, conditions, and provides optimization tips.

schema_analyze

Parse CREATE TABLE statements to extract tables, columns, types, constraints, foreign keys, and indexes. Generates an ER diagram in Mermaid format.

query_build

Build SQL queries from natural language descriptions. Supports common patterns like filtering by date, aggregation, joins, ordering, and pagination.

migration_generate

Compare two schemas (old vs new CREATE TABLE statements) and generate ALTER TABLE migration statements. Produces both up (forward) and down (rollback) migrations.

Installation

npm install
npm run build

Usage

With Claude Desktop

Add to your Claude Desktop config (claude_desktop_config.json):


View the full README on GitHub

Details

Repository
github.com/rog0x/mcp-database-tools
Category
Databases
Package
@rog0x/mcp-database-tools
Transport
STDIO
Registry
MCP registry, active

More from rog0x

Related Databases MCP servers

View all
1musaddiq-dev avatarPostgreSQL MCP Servermusaddiq-dev/postgresql-mcp-serverPython MCP server for PostgreSQL database inspection and querying0stars
2neo4j-contrib avatarMcp Neo4j Aura Managerneo4j-contrib/mcp-neo4jMCP server for Neo4j Aura Database Instance Manager.958stars
3waystation-ai avatarSupabasewaystation-ai/mcpConnect to your Supabase database to query data and schemas.0stars
4spences10 avatarMcp Sqlite Toolsspences10/mcp-sqlite-toolsMCP server for local SQLite database operations19stars
5neverinfamous avatarPostgreSQL MCP Serverneverinfamous/postgres-mcpEnterprise PostgreSQL MCP server with 63 tools, 10 resources, 10 prompts for AI-native operations8stars
6hovecapital avatarRead Only Local Mysql Mcp Serverhovecapital/read-only-local-mysql-mcp-serverMCP server for read-only MySQL database queries in Claude Desktop6stars