Enables management of MariaDB databases, including capabilities for schema inspection, SQL query execution, and data migration.
Provides tools for interacting with MySQL databases, allowing for schema exploration, SQL query execution, and synchronization across different environments.
Allows for the management of PostgreSQL instances, including schema comparison, data migration, and the execution of SQL commands.
Facilitates interaction with SQLite databases, supporting schema discovery, SQL queries, and database replication or cloning.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DBA MCP ServerCompare the staging and production schemas and generate a migration script."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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_connectiontool (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.
Local Installation
π οΈ Configuration & Persistence
1. CLI Arguments (Ephemeral/Stateless)
Ideal for CI/CD or temporary sessions.
Format: --[id] [connection_string]
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_connectionRemove:
remove_connectionList:
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 |
| Lists all active connections. Icons indicate status: πΎ Saved to Disk π₯οΈ From CLI Args π Context Available |
| Saves a new connection URL permanently. |
| Removes a stored connection. |
| Saves AI-generated markdown documentation for a specific connection (Governance, Business Logic). |
| Retrieves the stored markdown context for a connection. |
Database Operations
Tool | Description |
| Explore the database structure. Pass |
| Execute a read-only SQL query on a specific connection. |
| Compares two schemas (Source -> Target) and generates the SQL DDL commands to make Target match Source. |
| Migrates specific tables from Source to Target using bulk inserts. |
| π₯ 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.dbPostgreSQL:
postgres://user:pass@host:5432/dbMySQL:
mysql://user:pass@host:3306/dbOracle:
oracle://user:pass@host:1521/serviceSQL Server:
sqlserver://user:pass@host:1433/db
π» Development & Release
Build
This runs TypeScript compiler and ensures the binary is executable (shx chmod +x).
Release
To version and publish (follows Semantic Versioning):
Note: These scripts automatically push to Git and publish to NPM.
Inspector
To debug the MCP server communication visually:
π³ Docker
A multi-stage Dockerfile is included for containerized deployments.
License
MIT