What you will build
These labs walk you through building the Zava Retail Analytics MCP Server — a production-grade implementation that connects AI assistants to a PostgreSQL retail database. The sample repository is at github.com/microsoft/MCP-Server-and-PostgreSQL-Sample-Retail. By the end of the path you will have built:- A multi-table retail database with customer orders, products, and inventory
- Row Level Security for store-based data isolation
- Semantic product search using Azure OpenAI embeddings and pgvector
- VS Code AI Chat integration for natural language queries
- Production-ready deployment with Docker and Azure Container Apps
- Comprehensive monitoring with Application Insights
Prerequisites
Programming
Familiarity with Python (preferred) or a similar language. Basic understanding of async programming.
Databases
Basic SQL and relational database concepts. No PostgreSQL expertise required.
APIs
Understanding of REST APIs and HTTP concepts. Familiarity with JSON.
Tools
Command line, Git, and a code editor. Docker familiarity recommended but not required.
Required tools
| Tool | Purpose |
|---|---|
| Docker Desktop | Run PostgreSQL and the MCP server locally |
| Azure CLI | Deploy cloud resources |
| VS Code | Development environment and MCP Chat integration |
| Git | Clone the sample repository |
| Python 3.8+ | MCP server development |
Lab structure
The labs are organized into three phases.Phase 1 — Foundations (Labs 00–03)
Understand the architecture, security model, and get your environment ready before writing any server code.Phase 2 — Building the MCP Server (Labs 04–06)
Design the database schema, implement the FastMCP server, and create database query tools.Phase 3 — Advanced Features and Production (Labs 07–12)
Add semantic search, testing, VS Code integration, deployment, monitoring, and best practices.All labs
Lab 0: Introduction
Overview of MCP database integration and the Zava Retail use case.
Lab 1: Core Architecture
Layered architecture patterns, database design, and connection management.
Lab 2: Security & Multi-Tenancy
Row Level Security, Azure Entra ID authentication, and audit logging.
Lab 3: Environment Setup
Install tools, deploy Azure resources, and start Docker containers.
Lab 4: Database Design
PostgreSQL schema, pgvector setup, RLS policies, and sample data.
Lab 5: MCP Server
Build the FastMCP server with database integration and health endpoints.
Lab 6: Tool Development
Create advanced query tools, schema introspection, and analytics tools.
Lab 7: Semantic Search
Vector embeddings with Azure OpenAI and pgvector similarity search.
Lab 8: Testing & Debugging
Unit tests, integration tests, performance testing, and debugging tools.
Lab 9: VS Code Integration
Configure VS Code MCP settings and use AI Chat for natural language queries.
Lab 10: Deployment
Docker, Azure Container Apps, CI/CD pipelines, and auto-scaling.
Lab 11: Monitoring
Application Insights, structured logging, alerting, and dashboards.
Lab 12: Best Practices
Performance optimization, security hardening, and production guidelines.
Recommended learning paths
Beginner path — new to MCP
Beginner path — new to MCP
- Complete MCP for Beginners modules 0–10 first.
- Work through Labs 00–03 to reinforce foundations.
- Follow Labs 04–06 for hands-on building.
- Try Labs 07–09 for practical usage.
Intermediate path — some MCP experience
Intermediate path — some MCP experience
- Review Labs 00–01 for database-specific concepts.
- Focus on Labs 02–06 for implementation.
- Dive into Labs 07–12 for advanced features.
Advanced path — experienced with MCP
Advanced path — experienced with MCP
- Skim Labs 00–03 for context.
- Focus on Labs 04–09 for database integration patterns.
- Concentrate on Labs 10–12 for production deployment.
Official MCP resources
- MCP Documentation — Detailed tutorials and user guides
- MCP Specification — Protocol architecture and technical reference
- MCP GitHub Repository — Open-source SDKs and code samples
- OWASP MCP Top 10 — Security best practices
Start with Lab 0: Introduction
Begin the learning path here.