MCP-Server-and-PostgreSQL-Sample-Retail
Verified Safeby microsoft
Overview
Enables AI assistants to securely access and analyze retail sales data through a Model Context Protocol (MCP) server, integrating with PostgreSQL and Azure AI services.
Installation
docker compose up -dEnvironment Variables
- POSTGRES_DB_HOST
- POSTGRES_DB_PORT
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
- AZURE_OPENAI_ENDPOINT
- EMBEDDING_MODEL_DEPLOYMENT_NAME
- PROJECT_ENDPOINT
- AZURE_CLIENT_ID
- AZURE_CLIENT_SECRET
- AZURE_TENANT_ID
- APPLICATIONINSIGHTS_CONNECTION_STRING
- LOG_LEVEL
- ENVIRONMENT
Security Notes
The server implements robust security features including Row Level Security (RLS) for data isolation, Azure AD authentication for AI services (DefaultAzureCredential), input validation for table names, and parameterized queries (implied by `asyncpg` usage in Python for database interaction). Secrets like database passwords and Azure API keys are expected to be provided via environment variables, reducing the risk of hardcoding. Docker containers run as a non-root user. Minor exposure of PGPASSWORD in a healthcheck is noted but generally within a trusted network context.
Similar Servers
MCP-PostgreSQL-Ops
The MCP server provides professional operations, monitoring, and management capabilities for PostgreSQL databases using natural language queries.
powerbi-mcp
Enables AI assistants to interact with Power BI Desktop and Service for querying data, managing models, and performing safe bulk operations through natural language, ensuring enterprise-grade security and preserving report visual integrity during refactoring.
DBchat
Transforms a database into an intelligent conversational partner, enabling natural language queries, instant answers, and data visualizations via MCP clients.
metabase-ai-assistant
The Metabase AI Assistant integrates an AI agent with Metabase to enable AI-powered data exploration, SQL generation, dashboard creation, and Metabase instance management through an MCP client.