loading…
Search for a command to run...
loading…
A multi-vendor database management tool that enables LLMs to query, migrate, and synchronize schemas across SQL engines like PostgreSQL, MySQL, and Oracle. It f
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.
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.
--[id] [connection_string]).save_connection tool (stored in local SQLite).CREATE, ALTER) to synchronize structures.migrate_data: Move data between connections with optimized bulk inserts.replicate_database: Auto-Magic cloning of an entire database (Schema + Data).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
git clone https://github.com/grecoLab/mcp-dba.git
cd mcp-dba
npm install
npm run build
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"
]
}
}
}
You can use tools to save connections. They are stored in an internal SQLite database (.dba-mcp/storage.db) within the running directory.
save_connectionremove_connectionlist_connections (Shows source: 💾=Saved, 🖥️=CLI)Once connected, the LLM will have access to these tools:
| Tool | Description |
|---|---|
list_connections |
Lists all active connections. Icons indicate status: 💾 Saved to Disk 🖥️ From CLI Args 📝 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. |
| 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. |
sqlite://path/to/file.dbpostgres://user:pass@host:5432/dbmysql://user:pass@host:3306/dboracle://user:pass@host:1521/servicesqlserver://user:pass@host:1433/dbnpm run build
This runs TypeScript compiler and ensures the binary is executable (shx chmod +x).
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.
To debug the MCP server communication visually:
npm run inspector -- --local sqlite://test.db
A multi-stage Dockerfile is included for containerized deployments.
docker build -t dba-mcp .
docker run -i dba-mcp --prod postgres://...
MIT
Add this to claude_desktop_config.json and restart Claude Desktop.
{
"mcpServers": {
"dba-mcp-server": {
"command": "npx",
"args": []
}
}
}