mcp-database

mcp-database

MCP server for connecting to databases (PostgreSQL, MySQL, SQL Server, Redis) enabling SQL queries, table exploration, and Redis key-value operations.

Category
Visit Server

README

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

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured