Skip to main content
Glama
mcp-database-tools

mcp-database-tools

by rog0x

mcp-database-tools

MCPサーバーは、AIエージェント向けのSQLおよびデータベースツールを提供します。すべての分析はSQLテキストに対して実行され、実際のデータベース接続は不要です。

ツール

sql_format

SQLクエリを適切なインデント、大文字のキーワード、整列された列で整形・美化します。MySQL、PostgreSQL、SQLiteの構文をサポートします。

sql_explain

SQLクエリを受け取り、それが何を行うかを平易な英語で段階的に説明します。クエリの種類、テーブル、列、条件を特定し、最適化のヒントを提供します。

schema_analyze

CREATE TABLE文を解析して、テーブル、列、型、制約、外部キー、インデックスを抽出します。Mermaid形式のER図を生成します。

query_build

自然言語の説明からSQLクエリを構築します。日付によるフィルタリング、集計、結合、並べ替え、ページネーションなどの一般的なパターンをサポートします。

migration_generate

2つのスキーマ(古いCREATE TABLE文と新しいCREATE TABLE文)を比較し、ALTER TABLEマイグレーション文を生成します。アップ(前進)とダウン(ロールバック)の両方のマイグレーションを生成します。

Related MCP server: MCP Data Analyst

インストール

npm install
npm run build

使用法

Claude Desktopを使用する場合

Claude Desktopの設定(claude_desktop_config.json)に追加します:

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

スタンドアロン

npm start

開発

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

ライセンス

MIT

Available Tools

5 tools
migration_generateA

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

Inputs: new_schema (required), old_schema (required), dialect.

query_buildC

Build SQL queries from natural language descriptions. Example: "get all users who signed up this month and have at least 3 orders" generates the corresponding SQL.

Inputs: description (required), dialect, schema_hint.

schema_analyzeA

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

Inputs: sql (required).

sql_explainA

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

Inputs: sql (required).

sql_formatA

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

Inputs: sql (required), dialect, uppercase, indent_size, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to query databases using natural language, with automatic schema discovery and SQL compilation.
      4,182 npm
      3,243
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language querying of SQL databases using AI, supporting multiple database types and automatic schema discovery.
      1
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.
      3
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables LLM agents to connect to multiple database types, retrieve normalized schemas, and execute optimized SQL queries through a unified API.
      -