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
1. Setup the Project
The setup script will:
Install
uv
package manager if neededInstall 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 queries with formatting |
(string),
(int, default: 1000) |
| List all tables in a schema |
(string, default: "public") |
| Get table structure details |
(string),
(string, default: "public") |
| Export table data as CSV |
(string),
(int, default: 10000),
(string, optional) |
MinIO Object Storage Tools
Tool | Description | Parameters |
| List all available buckets | None |
| List objects in a bucket |
(string),
(string, optional),
(int, default: 1000) |
| Upload data to object store |
(string),
(string),
(string),
(string, default: "text/plain") |
| Download object from storage |
(string),
(string) |
| Create a new bucket |
(string),
(string, optional) |
| Delete an object |
(string),
(string) |
Combined Operations
Tool | Description | Parameters |
| Backup PostgreSQL table to MinIO |
(string),
(string, default: "backups"),
(string, default: "public"),
(int, default: 10000),
(string, optional) |
🤖 AI-Enhanced Tools
Tool | Description | Parameters |
| Convert natural language to SQL and execute with AI analysis |
(string),
(string, default: "public"),
(string, optional) |
| Execute SQL and get AI-powered explanation |
(string),
(int, default: 100),
(string, optional) |
| Generate AI suggestions for database analysis |
(string, default: "public"),
(string, optional) |
| AI analysis of data patterns and quality |
(string),
(string, default: "public"),
(int, default: 1000),
(string, optional) |
| Comprehensive AI-powered data reports |
(string),
(string, comma-separated),
(string, default: "public"),
(string, optional) |
| 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
🎯 Smart Auto-Configuration - No command-line parameters needed! The server automatically detects and uses whatever AI models you have available.
Demo Mode (Works immediately):
Local Models (Recommended for security):
Cloud Models (Optional - add API keys for premium models):
✨ Benefits of Auto-Configuration:
No complex parameters - Just start with
uv run python src/dp_mcp/server.py
Smart detection - Uses Ollama models, cloud APIs, or demo mode automatically
User-friendly - Configure once in
.env.ai
, works everywhereFlexible - Mix local and cloud models as needed
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
MinIO Console:
http://localhost:9001
Username:
minioadmin
Password:
minioadmin123
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 -1
- AsecurityAlicenseAqualityEnables AI models to interact with PostgreSQL databases through a standardized interface, supporting operations like queries, table manipulation, and schema inspection.Last updated -62547MIT 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 -65021MIT 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 -481MIT License