PostgreSQL Retail

v1.0.0Databasesstable

A Model Context Protocol (MCP) server that provides comprehensive customer sales database access for Zava Retail DIY Business. This server enables AI assistants to query and analyze retail sales data through a secure, schema-aware interface.

mcp-server-and-postgresql-sample-retailmcpai-integration
Share:
16
Stars
0
Downloads
0
Weekly
0/5

What is PostgreSQL Retail?

PostgreSQL Retail is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server that provides comprehensive customer sales database access for zava retail diy business. this server enables ai assistants to query and analyze retail sales data th...

A Model Context Protocol (MCP) server that provides comprehensive customer sales database access for Zava Retail DIY Business. This server enables AI assistants to query and analyze retail sales data through a secure, schema-aware interface.

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A Model Context Protocol (MCP) server that provides comprehe

Use Cases

Query and analyze retail sales data from a customer database.
Access schema-aware retail business intelligence.
microsoft

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 16, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-server-and-postgresql-sample-retail

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use PostgreSQL Retail

This MCP server is a reference implementation from Microsoft that connects AI assistants to a PostgreSQL retail sales database for the fictional Zava Retail DIY Business. It exposes schema-aware query tools with Row Level Security so different store users only see their own data. Developers can use it as a working pattern for building secure, multi-tenant MCP database integrations with PostgreSQL and Azure AI embeddings.

Prerequisites

  • Docker and Docker Compose installed (used to run PostgreSQL and the MCP server)
  • Azure CLI installed and authenticated via 'az login' (needed for embedding model access)
  • Git to clone the repository
  • An MCP-compatible client such as Claude Desktop or VS Code with the MCP extension
  • Node.js is not required — the server runs entirely in Docker
1

Clone the repository

Clone the Microsoft sample repository which contains the Docker Compose configuration, database seed scripts, and MCP server code.

git clone https://github.com/microsoft/MCP-Server-and-PostgreSQL-Sample-Retail.git
cd MCP-Server-and-PostgreSQL-Sample-Retail
2

Authenticate with Azure

Log in with the Azure CLI so the server can access the Azure OpenAI embedding model used by the semantic_search_products tool.

az login
3

Copy and configure environment variables

Copy the provided template to .env and fill in your Azure OpenAI endpoint and deployment details. The file controls the embedding model connection.

cp .env.template .env
# Edit .env with your Azure OpenAI endpoint and deployment name
4

Start the stack with Docker Compose

This brings up PostgreSQL (with the retail schema pre-seeded) and the MCP HTTP server on port 8000.

docker compose up -d
5

Configure your MCP client

Connect your MCP client to the running server using HTTP transport. Different x-rls-user-id header values correspond to different store employees, enforcing Row Level Security. The head-office UUID shown below grants access to all stores.

{
  "servers": {
    "zava-sales-analysis-headoffice": {
      "url": "http://127.0.0.1:8000/mcp",
      "type": "http",
      "headers": {
        "x-rls-user-id": "00000000-0000-0000-0000-000000000000"
      }
    }
  }
}
6

Verify the server is responding

Check that all containers are running and the MCP endpoint is reachable before connecting your AI client.

docker compose ps
curl http://127.0.0.1:8000/mcp

PostgreSQL Retail Examples

Client configuration

VS Code MCP client config connecting to the local HTTP server with head-office Row Level Security access.

{
  "servers": {
    "zava-sales-analysis-headoffice": {
      "url": "http://127.0.0.1:8000/mcp",
      "type": "http",
      "headers": {
        "x-rls-user-id": "00000000-0000-0000-0000-000000000000"
      }
    }
  }
}

Prompts to try

Natural language queries that map to the four exposed MCP tools.

- "Show top 20 products by sales revenue this year"
- "What were last quarter's sales broken down by category?"
- "Show me sales performance by store location"
- "Find products similar to 'containers for paint' using semantic search"
- "What is today's UTC date?"

Troubleshooting PostgreSQL Retail

Docker Compose fails to start with a database connection error

Wait 10-15 seconds after 'docker compose up -d' for PostgreSQL to finish initializing, then check logs with 'docker compose logs db'. If the schema is missing, run 'docker compose down -v && docker compose up -d' to reset the volumes.

The semantic_search_products tool returns an authentication error

Re-run 'az login' to refresh your Azure credentials. Ensure your .env file contains the correct AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_DEPLOYMENT_NAME values and that your Azure account has access to the specified embedding deployment.

Queries return no data or only a subset of records

This is likely the Row Level Security working correctly. The x-rls-user-id header in your config restricts data to a specific store. Use the head-office UUID (all zeros) to access data across all stores.

Frequently Asked Questions about PostgreSQL Retail

What is PostgreSQL Retail?

PostgreSQL Retail is a Model Context Protocol (MCP) server that model context protocol (mcp) server that provides comprehensive customer sales database access for zava retail diy business. this server enables ai assistants to query and analyze retail sales data through a secure, schema-aware interface. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install PostgreSQL Retail?

Follow the installation instructions on the PostgreSQL Retail GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with PostgreSQL Retail?

PostgreSQL Retail works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is PostgreSQL Retail free to use?

Yes, PostgreSQL Retail is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Databases MCP Servers

Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-server-and-postgresql-sample-retail": { "command": "npx", "args": ["-y", "mcp-server-and-postgresql-sample-retail"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use PostgreSQL Retail?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides