Enables bucket management, object operations (upload, download, list, delete), and flexible configuration with MinIO object storage.
Supports local AI models like llama2, codellama, and mistral for secure, private AI analysis of database data without external API calls.
Integrates OpenAI models (gpt-4, gpt-3.5-turbo) for AI-powered database analysis, natural language to SQL conversion, and comprehensive data reports.
Provides tools for executing SQL queries, schema introspection, table structure description, and data export to CSV format from PostgreSQL databases.
DP-MCP Server
A comprehensive Data Platform MCP (Model Context Protocol) server that provides seamless integration between PostgreSQL databases and MinIO object storage. Built with FastMCP 2.0 for modern AI applications.
🚀 Features
PostgreSQL Operations
- Query Execution: Execute SQL queries with results formatting
- Schema Introspection: List tables, describe table structures
- Data Export: Export table data to CSV format
- Connection Management: Robust connection handling with SSL support
MinIO Object Storage
- Bucket Management: Create, list, and manage buckets
- Object Operations: Upload, download, list, and delete objects
- Flexible Configuration: Support for secure and insecure connections
Advanced Capabilities
- Database Backup: Automated PostgreSQL table backup to MinIO
- Combined Operations: Seamless data pipeline between DB and storage
- FastMCP Integration: Modern MCP server with HTTP transport
- Docker Support: Complete development environment
🤖 AI-Powered Features (NEW!)
- Natural Language Queries: Ask questions in plain English, get SQL results
- Intelligent Query Analysis: AI-powered insights and pattern detection
- Data Privacy Protection: Multiple security levels for sensitive data
- Multi-Model Support: Claude, GPT, local Ollama models, or mock models
- Secure by Design: Data never leaves your environment with local models
📋 Table of Contents
- Quick Start
- Installation
- Configuration
- Available Tools
- AI Features
- Usage Examples
- CLI Tool
- MCP Client
- API Reference
- Development
- Deployment
- Troubleshooting
- Contributing
🏃 Quick Start
1. Setup the Project
The setup script will:
- Install
uv
package manager if needed - Install all Python dependencies
- Start Docker services automatically
- Test your configuration
2. Configure Environment
Note: The default configuration works with the included Docker services.
3. Start Services
You should see both services as "healthy":
4. Launch the MCP Server
Successful startup looks like:
5. Verify Installation
✅ Server Status: The server will be available at: http://127.0.0.1:8888/mcp/
✅ Test Connection:
✅ Access Development Services:
- MinIO Console: http://localhost:9001 (minioadmin/minioadmin123)
- PostgreSQL: localhost:5432 (dp_mcp_user/dp_mcp_password)
🎯 Alternative Running Methods
Run in Background:
Custom Host/Port:
Using Entry Point (if installed):
🔧 Troubleshooting Quick Start
Services Won't Start:
Server Won't Start:
Connection Issues:
🎉 You're Ready!
Your DP-MCP server is now running and ready to:
- ✅ Execute PostgreSQL queries and manage database schemas
- ✅ Upload, download, and manage MinIO objects and buckets
- ✅ Perform automated database backups to object storage
- ✅ Serve AI agents through the MCP protocol with 17+ specialized tools
- ✅ NEW: Answer natural language questions about your data with AI
- ✅ NEW: Generate intelligent insights and analysis reports
🤖 Test AI Features
To test the new AI capabilities:
The server runs until you stop it with Ctrl+C
. For production deployment, see the Deployment Guide.
📦 Installation
Prerequisites
- Python 3.10 or higher
- Docker and Docker Compose
- uv package manager (installed automatically by setup.sh)
Manual Installation
Docker Services
The included docker-compose.yml
provides:
- PostgreSQL 15 with sample data
- MinIO object storage with web console
- Automatic health checks and initialization
⚙️ Configuration
Environment Variables
Create a .env
file with the following configuration:
Configuration Validation
🛠️ Available Tools
The server provides 17+ MCP tools for database, object storage, and AI-powered operations:
PostgreSQL Tools
Tool | Description | Parameters |
---|---|---|
execute_sql_query | Execute SQL queries with formatting | query (string), limit (int, default: 1000) |
list_db_tables | List all tables in a schema | schema (string, default: "public") |
describe_db_table | Get table structure details | table_name (string), schema (string, default: "public") |
export_table_csv | Export table data as CSV | table_name (string), limit (int, default: 10000), where_clause (string, optional) |
MinIO Object Storage Tools
Tool | Description | Parameters |
---|---|---|
list_minio_buckets | List all available buckets | None |
list_bucket_objects | List objects in a bucket | bucket_name (string), prefix (string, optional), max_keys (int, default: 1000) |
upload_to_minio | Upload data to object store | bucket_name (string), object_name (string), data (string), content_type (string, default: "text/plain") |
download_from_minio | Download object from storage | bucket_name (string), object_name (string) |
create_minio_bucket | Create a new bucket | bucket_name (string), region (string, optional) |
delete_minio_object | Delete an object | bucket_name (string), object_name (string) |
Combined Operations
Tool | Description | Parameters |
---|---|---|
backup_table_to_minio | Backup PostgreSQL table to MinIO | table_name (string), bucket_name (string, default: "backups"), schema (string, default: "public"), limit (int, default: 10000), where_clause (string, optional) |
🤖 AI-Enhanced Tools
Tool | Description | Parameters |
---|---|---|
ask_natural_language_query | Convert natural language to SQL and execute with AI analysis | question (string), schema (string, default: "public"), model_name (string, optional) |
explain_query_with_ai | Execute SQL and get AI-powered explanation | sql_query (string), limit (int, default: 100), model_name (string, optional) |
get_ai_data_insights | Generate AI suggestions for database analysis | schema (string, default: "public"), model_name (string, optional) |
analyze_table_patterns | AI analysis of data patterns and quality | table_name (string), schema (string, default: "public"), sample_size (int, default: 1000), model_name (string, optional) |
generate_ai_data_report | Comprehensive AI-powered data reports | title (string), tables (string, comma-separated), schema (string, default: "public"), model_name (string, optional) |
get_ai_system_status | Get AI system status and configuration | None |
🤖 AI Features
Secure AI Integration
The DP-MCP server now includes comprehensive AI capabilities designed with security and privacy as top priorities:
🔒 Privacy Levels:
- None: No filtering (public data only)
- Basic: Remove obvious PII (emails, phones)
- Moderate: Mask patterns, limit data size
- Strict: Schema-only mode, heavy sanitization
- Paranoid: No actual data sent to AI
🤖 Supported Models:
- Claude (Anthropic): claude-3-sonnet, claude-3-haiku
- OpenAI: gpt-4, gpt-3.5-turbo
- Local Models: Ollama (llama2, codellama, mistral)
- Mock Models: Safe testing without API calls
🛡️ Security Features:
- Data sanitization and pattern masking
- SQL injection detection
- Audit logging for all AI interactions
- Local-only processing with Ollama
- Environment-based configurations
Quick AI Setup
- Demo Mode (No setup required):
- Local Models (Recommended for security):
- Cloud Models (API keys required):
AI Usage Examples
💡 Usage Examples
Basic Database Operations
Object Storage Operations
Advanced: Database Backup to Object Storage
🖥️ CLI Tool
The DP-MCP CLI tool provides direct command-line access to all PostgreSQL and MinIO operations without requiring the MCP protocol overhead.
Quick CLI Usage
CLI Features
✅ 11 Commands: Direct access to all server tools
✅ Colored Output: Beautiful terminal interface
✅ File Operations: Upload/download from files
✅ Batch Processing: Perfect for scripting
✅ Error Handling: Comprehensive error messages
📖 Full CLI Documentation: CLI Reference Guide
🔌 MCP Client
The DP-MCP client enables MCP protocol communication for integration with AI agents.
Note: The MCP client is currently in development for full FastMCP compatibility. For immediate testing and usage, we recommend using the CLI Tool which provides direct access to all functionality.
Basic MCP Client Usage
AI Agent Integration
For AI agents and applications that need MCP protocol access, the server is available at:
- Server URL:
http://127.0.0.1:8888/mcp/
- Protocol: JSON-RPC 2.0 over HTTP with Server-Sent Events
- Transport: FastMCP Streamable HTTP
MCP Client Status
🚧 In Development: Full MCP protocol client
✅ Session Management: Basic connectivity established
✅ Server Discovery: Endpoint detection working
⏳ Tool Calling: FastMCP protocol compatibility in progress
Recommended: Use the CLI Tool for immediate access to all 11 tools and full functionality.
📖 Full MCP Client Documentation: MCP Client Guide
📚 API Reference
Server Endpoints
The FastMCP server provides the following endpoints:
- Base URL:
http://127.0.0.1:8888/mcp/
- Transport: Streamable HTTP (Server-Sent Events)
- Protocol: MCP (Model Context Protocol) v1.0
Connection Information
Error Handling
All tools implement comprehensive error handling:
- Database Errors: Connection failures, SQL syntax errors, permission issues
- Storage Errors: Bucket not found, object not found, access denied
- Validation Errors: Invalid parameters, missing required fields
- System Errors: Network issues, timeout errors
Response Format
All responses follow the MCP protocol format:
🔧 Development
Project Structure
Running Tests
Code Quality
Development Services
Access the development environment:
- PostgreSQL:
localhost:5432
- Database:
dp_mcp_dev
- Username:
dp_mcp_user
- Password:
dp_mcp_password
- Database:
- MinIO Console:
http://localhost:9001
- Username:
minioadmin
- Password:
minioadmin123
- Username:
- MinIO API:
http://localhost:9000
🚀 Deployment
Production Configuration
For production deployment, create a secure .env
file:
Docker Production Build
Systemd Service
Create /etc/systemd/system/dp-mcp.service
:
Health Checks
🔍 Troubleshooting
Common Issues
Connection Refused Errors
Authentication Errors
Server Won't Start
Debug Mode
Enable comprehensive logging:
Performance Tuning
For high-throughput scenarios:
🤝 Contributing
Development Setup
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and add tests
- Run the test suite:
uv run pytest
- Format your code:
uv run black src/ tests/
- Submit a pull request
Code Standards
- Follow PEP 8 style guidelines
- Add type hints for all functions
- Write comprehensive docstrings
- Include unit tests for new features
- Update documentation for API changes
Reporting Issues
Please include:
- Python version and operating system
- Complete error messages and stack traces
- Steps to reproduce the issue
- Configuration details (without sensitive data)
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- FastMCP - Modern MCP server framework
- Model Context Protocol - Standard protocol for AI tool integration
- PostgreSQL - Advanced open source database
- MinIO - High performance object storage
For more information, visit the project documentation or contact the development team.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A comprehensive Data Platform server that enables seamless integration between PostgreSQL databases and MinIO object storage, with AI-powered natural language query capabilities.
Related MCP Servers
- -securityFlicense-qualityA server that allows AI models to interact with PostgreSQL databases through a standardized protocol, providing database schema information and SQL query execution capabilities.Last updated -1JavaScript
- AsecurityAlicenseAqualityEnables AI models to interact with PostgreSQL databases through a standardized interface, supporting operations like queries, table manipulation, and schema inspection.Last updated -56365JavaScriptMIT License
- AsecurityAlicenseAqualityA server that connects to PostgreSQL databases and provides tools for safely exploring schemas, running read-only SQL queries, and performing data analysis with pre-built templates.Last updated -56521JavaScriptMIT License
- AsecurityAlicenseAqualityA blazing fast MCP server that enables AI agents to interact with multiple PostgreSQL databases, providing functionality to list tables, inspect schemas, execute queries, and run transactions.Last updated -442TypeScriptMIT License