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.
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_connectiontool (stored in local SQLite).
- Stateless: Inject connections via CLI arguments (
- 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。