Overview
The Database MCP Agent is a conversational AI assistant that manages GibsonAI database projects using natural language. Built with Agno framework and the GibsonAI MCP server, it allows you to create projects, manage schemas, deploy changes, and query databases without writing SQL or complex commands.Features
- Create Projects - Start new database projects from scratch
- Schema Management - Define tables, columns, and relationships
- Deploy Changes - Apply schema changes to hosted databases
- Natural Language - Interact using conversational commands
- Best Practices - Get recommendations on database structure
- Query Support - Interact with schema and data
Architecture
Prerequisites
- Python 3.8+
- GibsonAI account (gibson.ai)
- Nebius API key
gibson-cliinstalled (viauvxorpipx)
Installation
Usage
Basic Execution
Custom Queries
Modify the message inmain.py:
MCP Integration
MCPTools Setup
The agent uses Agno’sMCPTools to connect to the GibsonAI MCP server:
Agent Configuration
Complete Implementation
Usage Examples
- Create Project
- E-commerce Schema
- Schema Modification
- Deploy Changes
- Query Schema
MCP Tools Available
The GibsonAI MCP server provides the following tools throughgibson-cli:
Project Management
Project Management
- Create Project: Initialize new database project
- List Projects: View all existing projects
- Delete Project: Remove project and data
- Get Project Details: View project configuration
Schema Operations
Schema Operations
- Define Table: Create new table with columns
- Modify Table: Update existing table structure
- Delete Table: Remove table from schema
- Add Column: Add new column to table
- Modify Column: Update column properties
- Drop Column: Remove column from table
Relationships
Relationships
- Add Foreign Key: Define table relationships
- Add Index: Create database indexes
- Add Constraint: Define data constraints
Deployment
Deployment
- Deploy Schema: Apply changes to database
- Rollback: Revert to previous schema version
- Generate Migration: Create migration scripts
Querying
Querying
- Query Schema: Get schema information
- Query Data: Execute database queries
- Get Statistics: View database metrics
Advanced Features
Streaming Responses
The agent uses streaming for real-time feedback:Tool Call Visibility
View MCP tool calls in real-time:Extended Timeouts
Database operations may take longer:Connection Management
Always close MCP connections properly:Best Practices
Schema Design
- Use clear, descriptive table names
- Define primary keys for all tables
- Set up foreign key relationships
- Add appropriate indexes
Agent Instructions
- Provide clear, specific instructions
- Let agent decide details when appropriate
- Review schema before deploying
- Use streaming for long operations
Error Handling
- Always close MCP connections
- Handle timeout exceptions
- Validate user input
- Log tool call errors
Security
- Store API keys in environment variables
- Use separate projects for development/production
- Review schema changes before deployment
- Implement backup strategies
Troubleshooting
Gibson CLI Not Found
Gibson CLI Not Found
Install or update
gibson-cli:MCP Connection Timeout
MCP Connection Timeout
Increase timeout for complex operations:
API Key Errors
API Key Errors
Ensure environment variable is set:Or check
.env file exists and is loaded.Schema Deploy Failed
Schema Deploy Failed
- Verify project exists in GibsonAI
- Check for schema validation errors
- Review foreign key constraints
- Ensure no circular dependencies
Source Code
View the complete implementation at:~/workspace/source/mcp_ai_agents/database_mcp_agent/
GibsonAI
Database management platform
Agno Framework
Build AI agents with Agno
Related Examples
Couchbase MCP Server
Query Couchbase with MCP
Custom MCP Server
Build custom MCP servers