Skip to main content
Glama
mcp-database

mcp-database

by justpoypoy

Database MCP Server

MCP server untuk koneksi database yang mendukung PostgreSQL, MySQL, SQL Server, dan Redis.

Installation

Opsi 1: Development Mode

pip install -e .

Opsi 2: Binary (Standalone) ✅ READY

# Build binary
python3.11 build.py

# Opsi instalasi:
# 1. Install ke system PATH
./install.sh

# 2. Atau menggunakan Make
make install

# 3. Atau install manual
python3.11 build.py --install

# 4. Atau gunakan langsung
./dist/database-mcp-server

Related MCP server: Universal Database MCP Server

Usage

Jalankan MCP Server

Binary Mode (Recommended):

# Setelah install
database-mcp-server

# Atau langsung dari dist
./dist/database-mcp-server

Development Mode:

# Langsung dari source
python -m database_mcp_server.main

Konfigurasi di Kiro

Binary Mode (Recommended): Gunakan database-mcp-server langsung Development Mode: Lihat mcp.json.example

Available Tools

SQL Database Tools

  • list_tables(connection_name) - List semua tabel

  • describe_table(table_name, connection_name) - Lihat struktur tabel

  • execute_query(query, connection_name) - Eksekusi SQL query

Redis Tools

  • redis_get(key, connection_name) - Get value dari Redis

  • redis_set(key, value, expiration, connection_name) - Set value ke Redis

  • redis_keys(pattern, connection_name) - List keys dengan pattern

Database Support

  • PostgreSQL - psycopg2

  • MySQL - PyMySQL

  • SQL Server - pyodbc

  • Redis - redis-py

Configuration

Database connections dikonfigurasi melalui mcp.json dengan environment variables:

Single Connection (Simple)

{
  "mcpServers": {
    "database": {
      "command": "database-mcp-server",
      "args": [],
      "env": {
        "DB_TYPE": "postgresql",
        "DB_HOST": "localhost",
        "DB_PORT": "5432",
        "DB_NAME": "mydb",
        "DB_USER": "postgres",
        "DB_PASSWORD": "password"
      },
      "disabled": false
    }
  }
}

Multiple Connections (Advanced)

{
  "mcpServers": {
    "database": {
      "command": "database-mcp-server",
      "args": [],
      "env": {
        "DB_CONNECTIONS": "{\"default\":{\"type\":\"postgresql\",\"host\":\"localhost\",\"port\":5432,\"database\":\"mydb\",\"username\":\"postgres\",\"password\":\"password\"},\"mysql_db\":{\"type\":\"mysql\",\"host\":\"localhost\",\"port\":3306,\"database\":\"mydb\",\"username\":\"root\",\"password\":\"password\"},\"redis\":{\"type\":\"redis\",\"host\":\"localhost\",\"port\":6379,\"password\":\"\",\"db\":0}}"
      },
      "disabled": false
    }
  }
}

Binary Configuration

After installation (recommended):

{
  "mcpServers": {
    "database": {
      "command": "database-mcp-server",
      "args": [],
      "env": {
        "DB_CONNECTIONS": "{\"default\":{\"type\":\"postgresql\",\"host\":\"localhost\",\"port\":5432,\"database\":\"mydb\",\"username\":\"postgres\",\"password\":\"password\"}}"
      },
      "disabled": false
    }
  }
}

Direct binary usage:

{
  "mcpServers": {
    "database": {
      "command": "./dist/database-mcp-server",
      "args": [],
      "env": {
        "DB_CONNECTIONS": "{\"default\":{\"type\":\"postgresql\",\"host\":\"localhost\",\"port\":5432,\"database\":\"mydb\",\"username\":\"postgres\",\"password\":\"password\"}}"
      },
      "disabled": false
    }
  }
}

Environment Variables

Single Connection:

  • DB_TYPE - Database type (postgresql, mysql, sqlserver)

  • DB_HOST - Database host

  • DB_PORT - Database port

  • DB_NAME - Database name

  • DB_USER - Username

  • DB_PASSWORD - Password

  • REDIS_HOST, REDIS_PORT, etc. - Redis connection

Multiple Connections:

  • DB_CONNECTIONS - JSON string dengan semua database connections

Troubleshooting

Error: "uvx: executable file not found"

Gunakan binary yang sudah terinstall:

{
  "command": "database-mcp-server"  // ✅ Correct
  // "command": "uvx"              // ❌ Wrong - uvx not needed
}

Error: "database-mcp-server: command not found"

Install binary terlebih dahulu:

./install.sh
# atau
make install

Binary tidak bisa dijalankan

Pastikan binary executable:

chmod +x /usr/local/bin/database-mcp-server

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A modular MCP server that enables interaction with multiple database types including PostgreSQL, MySQL, SQLite, Redis, MongoDB, and LDAP. It provides tools for executing queries, managing SQL commands, and exploring database schemas with configurable read-only security.
      13 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A versatile MCP server that connects to multiple relational databases (MySQL, PostgreSQL, Oracle, SQL Server, SQLite) and enables secure read-only SQL query execution and metadata access.
      4
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A multi-database MCP server supporting PostgreSQL, ClickHouse, and MySQL that enables database exploration and SQL execution through MCP stdio or HTTP API.
      -
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for querying and managing multiple databases (SQLite, PostgreSQL, MySQL) with read-only mode and schema inspection.
      2
      13
      MIT