Skip to main content
Glama
rog0x

mcp-database-tools

by rog0x
README.md

# 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

```bash
npm install
npm run build
```

## Usage

### With Claude Desktop

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

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

### Standalone

```bash
npm start
```

## Development

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

## License

MIT

TDQS

A3.9/5.0

Scored across 5 tools

Disambiguation5/5

Each tool addresses a distinct aspect of database work: formatting, natural language query building, explaining SQL, schema analysis, and migration generation. No two tools overlap in purpose, making selection unambiguous.

Naming Consistency5/5

All tool names follow a consistent '<domain>_<action>' pattern (e.g., sql_format, schema_analyze), with noun-first ordering and snake_case throughout. This creates a predictable and readable convention.

Tool Count5/5

With 5 tools, the set is concise and well-scoped for a database utility server. Each tool covers a core workflow (format, build, explain, analyze, migrate) without redundancy or bloat.

Completeness5/5

The tool set covers the full lifecycle of SQL development: creating/formatting queries, building from natural language, understanding, analyzing schema, and generating schema migrations. No critical gaps are apparent for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues