MCP Server
AI-DBA runs as an MCP (Model Context Protocol) server, exposing database diagnostics as tools for AI agents.
Starting the Server
The server communicates over stdio (JSON-RPC).
MCP Tools
Six tools are registered:
databases
List databases/schemas on an engine.
tables
List tables (optional database/schema filter).
describe-table
Show column metadata for a table.
indexes
List indexes for a table.
processes
List active connections/sessions.
blocking-chains
Detect blocking chains.
Integration with AI Agents
Hermes Agent
Add to your MCP client config:
mcp_servers:
ai-dba:
command: node
args: ["/path/to/ai-dba/dist/index.js", "--config", "/path/to/ai-dba/config.yaml", "serve"]
Claude Code
Add to .mcp.json:
{
"mcpServers": {
"ai-dba": {
"command": "node",
"args": ["/path/to/ai-dba/dist/index.js", "--config", "/path/to/ai-dba/config.yaml", "serve"]
}
}
}
Cursor
Add to MCP settings:
{
"mcp.ai-dba": {
"command": "node",
"args": ["/path/to/ai-dba/dist/index.js", "--config", "/path/to/ai-dba/config.yaml", "serve"]
}
}
Read-Only Guardrails
The query tool (available via sql REPL command) enforces read-only access:
- MySQL: Allows
SELECT,SHOW,WITH,EXPLAIN,DESCRIBE - PostgreSQL: Allows
SELECT,WITH,EXPLAIN - SQL Server: Allows
SELECT,WITH,EXPLAIN - Oracle: Allows
SELECT,WITH,EXPLAIN,DESCRIBE - MongoDB: Allows
find,aggregate,count,distinct,ping
Any write operation (INSERT, UPDATE, DELETE, DROP, createCollection, etc.) is rejected with an error message.