DBA MCP Server

DBA MCP Server

A multi-vendor database management tool that enables LLMs to query, migrate, and synchronize schemas across SQL engines like PostgreSQL, MySQL, and Oracle. It features persistent knowledge management for storing AI-generated context about database structures and business rules.

Category
Visit Server

README

DBA MCP Server 🚀

Multi-vendor Database Tool for DevOps, Migrations & Knowledge Management

dba-mcp is a Model Context Protocol (MCP) server designed to enable LLMs (like Claude, ChatGPT, or local models) to interact with, manage, and migrate SQL databases directly. It operates over stdio, making it ideal for integration with tools like Claude Desktop, Cursor, or any MCP client.

It combines "Infrastructure as Code" principles with persistent knowledge management, allowing AI agents to save specific context about databases (Governance, Business Rules, Schema Explanations) and recall it on demand.


🌟 Features

  • Multi-Vendor Support: Connect to Oracle, PostgreSQL, MySQL/MariaDB, SQL Server, and SQLite simultaneously.
  • Hybrid Configuration:
    • Stateless: Inject connections via CLI arguments (--[id] [connection_string]).
    • Persistent: Save connections permanently using the save_connection tool (stored in local SQLite).
  • Context & Knowledge Management 🧠:
    • Save AI-generated context (Markdown) about a database (e.g., "This endpoint creates users based on table X").
    • Recall context automatically to answer complex questions about specific databases.
  • Schema Intelligence:
    • Compare schemas between different engines.
    • Generate DDL scripts (CREATE, ALTER) to synchronize structures.
  • Data Migration:
    • migrate_data: Move data between connections with optimized bulk inserts.
    • replicate_database: Auto-Magic cloning of an entire database (Schema + Data).

📦 Installation

Via NPX (Recommended)

You can run it directly without installing. Connections defined in CLI are loaded alongside any persistent connections saved previously.

npx @grec0/dba-mcp --local sqlite://data.db --prod postgres://user:pass@host/db

Local Installation

git clone https://github.com/grecoLab/mcp-dba.git
cd mcp-dba
npm install
npm run build

🛠️ Configuration & Persistence

1. CLI Arguments (Ephemeral/Stateless)

Ideal for CI/CD or temporary sessions. Format: --[id] [connection_string]

/* claude_desktop_config.json */
{
  "mcpServers": {
    "dba-tools": {
      "command": "npx",
      "args": [
        "-y",
        "@grec0/dba-mcp",
        "--staging", "mysql://root:pass@localhost:3306/staging_db"
      ]
    }
  }
}

2. Persistent Storage (Stateful)

You can use tools to save connections. They are stored in an internal SQLite database (.dba-mcp/storage.db) within the running directory.

  • Save: save_connection
  • Remove: remove_connection
  • List: list_connections (Shows source: 💾=Saved, 🖥️=CLI)

🧰 Available Tools for LLMs

Once connected, the LLM will have access to these tools:

Connection & Context Management

Tool Description
list_connections Lists all active connections. Icons indicate status: <br>💾 Saved to Disk <br>🖥️ From CLI Args <br>📝 Context Available
save_connection Saves a new connection URL permanently.
remove_connection Removes a stored connection.
save_database_context Saves AI-generated markdown documentation for a specific connection (Governance, Business Logic).
get_database_context Retrieves the stored markdown context for a connection.

Database Operations

Tool Description
inspect_schema Explore the database structure. Pass tableName to see columns/PKs, or empty to list all tables.
sql_query Execute a read-only SQL query on a specific connection.
generate_migration_ddl Compares two schemas (Source -> Target) and generates the SQL DDL commands to make Target match Source.
migrate_data Migrates specific tables from Source to Target using bulk inserts.
replicate_database 🔥 Power Tool: Clones an ENTIRE database. Scans source, creates tables in target, and migrates all data automatically.

🧠 Supported Connection Strings

  • SQLite: sqlite://path/to/file.db
  • PostgreSQL: postgres://user:pass@host:5432/db
  • MySQL: mysql://user:pass@host:3306/db
  • Oracle: oracle://user:pass@host:1521/service
  • SQL Server: sqlserver://user:pass@host:1433/db

💻 Development & Release

Build

npm run build

This runs TypeScript compiler and ensures the binary is executable (shx chmod +x).

Release

To version and publish (follows Semantic Versioning):

npm run release:patch  # 0.0.1 -> 0.0.2
npm run release:minor  # 0.1.0 -> 0.2.0
npm run release:major  # 1.0.0 -> 2.0.0

Note: These scripts automatically push to Git and publish to NPM.

Inspector

To debug the MCP server communication visually:

npm run inspector -- --local sqlite://test.db

🐳 Docker

A multi-stage Dockerfile is included for containerized deployments.

docker build -t dba-mcp .
docker run -i dba-mcp --prod postgres://...

License

MIT

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
Qdrant Server

Qdrant Server

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

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
E2B

E2B

Using MCP to run code via e2b.

Official
Featured