MCP server by krzysztof-i-cabaj
🤖 Autonomous Oracle DBA Agent (MCP + SQLcl Experiment)
Experiment: Can AI autonomously diagnose, fix, and report performance issues in an Oracle Database?
This project demonstrates a true Agentic Workflow, where an AI model (Claude Haiku 4.5) is connected to an Oracle Database 26ai instance via the Model Context Protocol (MCP) and SQLcl.
The Agent was given full database access and a single high-level command: "Find slow queries and fix them." I did not manually write a single line of remedial SQL code.
📊 Live Demo Results
The Agent autonomously generated the following reports as proof of work. These are hosted directly from this repository:
🚀 VIEW FULL TECHNICAL REPORT (HTML)
Interactive dashboard with Chart.js visualizations showing "Before" and "After" analysis.
📄 VIEW EXECUTIVE SUMMARY (HTML)
Business-ready version of the report, formatted for print/PDF export.
📉 Key Agent Achievements
In a single 5-minute autonomous session, the Agent achieved the following:
| Issue Detected | Agent's Diagnosis | Solution Applied | CBO Cost Impact | Improvement |
| :--- | :--- | :--- | :--- | :--- |
| Query 2 (VIP Join) | Missing FK indexes, Full Table Scan | Created index IDX_DEMO_CUSTOMERS_SEGMENT | 2,200 ➔ 414 | -81.2% 📉 |
| Query 3 (Top-N Sort) | Expensive in-memory sorting (PGA) | Created index IDX_ORDER_ITEMS_UNIT_PRICE_DESC | 11,492 ➔ 3 | -99.97% 🚀 |
🛠️ Solution Architecture
This is not just "Text-to-SQL". It is a system where AI executes commands in a live runtime environment.
- Database: Oracle Database 26ai (Free Developer Release)
- Interface: VS Code + GitHub Copilot (acting as the MCP Client)
- Tooling: Oracle SQLcl (running with the
-mcpflag) - Logic: Autonomous Decision Loop (OODA: Observe, Orient, Decide, Act)
Workflow:
- Analyze: Agent runs
EXPLAIN PLANfor the provided workload. - Decide: It detects
TABLE ACCESS FULLoperations and blocking functions inWHEREclauses. - Act: It executes DDL (
CREATE INDEX...) directly on the database. - Verify: It re-runs tests to compare metrics.
- Report: It generates HTML/JSON files with the results.
📂 Repository Structure
/docs- HTML reports generated by the AI (publicly accessible via GitHub Pages)./sql- SQL scripts used for environment setup and workload simulation./metrics- Raw CSV data containing performance metrics.
📞 Contact / About
This project was created to test the limits of current LLMs in database engineering tasks.
https://www.linkedin.com/in/krzysztof-cabaj-16b6a52/