mcpField
@
@rog0x/mcp-database-tools

@rog0x/mcp-database-tools

Local
github.com/rog0xDatabases0Updated 32w ago

About @rog0x/mcp-database-tools

@rog0x/mcp-database-tools is an MCP server for AI agents working with SQL, with operations performed on SQL text rather than a live database. It formats and explains queries, analyzes schemas, builds queries from natural language, and generates migrations.

Key features

  1. 01Format SQL for MySQL, PostgreSQL, and SQLite
  2. 02Explain queries and suggest optimizations
  3. 03Extract schema details and create Mermaid ER diagrams
  4. 04Build SQL from natural language
  5. 05Generate forward and rollback migrations

Use cases

  1. 01Prettify a SQL statement before review
  2. 02Understand query structure and possible optimizations
  3. 03Map tables and relationships from CREATE TABLE statements
  4. 04Draft queries from a textual description
  5. 05Compare schema versions and produce migrations

MCP support

Exposes SQL and database-analysis tools to MCP clients. The tools operate on SQL text and do not require a database connection.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"database-tools": {
"command": "npx",
"args": [
"-y",
"@rog0x/mcp-database-tools"
]
}
}
}
Run commandnpx -y @rog0x/mcp-database-tools

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@rog0x/mcp-database-tools1.0.1

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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):

{
  "mcpServers": {
    "database-tools": {
      "command": "node",
      "args": ["path/to/mcp-database-tools/dist/index.js"]
    }
  }
}
Standalone
npm start

Development

npm run build    # Compile TypeScript
npm start        # Run the server

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.