MCP Servers

A collection of Model Context Protocol servers, templates, tools and more.

G
Gbbai Ai Foundry MCP Postgresql

Build a conversational AI agent that analyses sales data using Azure AI Foundry Agent Service, Model Context Protocol (MCP) for external data connections, and PostgreSQL with Row Level Security (RLS) and pgvector for role-based data protection and semantic search.

Created 10/8/2025
Updated 2 months ago
Repository documentation and setup instructions

Azure Foundry Azure AI Foundry with Model Context Protocol and PostgreSQL

📋 Description

Build a conversational AI agent that analyzes sales data and helps customers find products. Learn to create secure, intelligent agents using Azure AI Foundry Agent Service, Model Context Protocol (MCP) for external data connections, and PostgreSQL with Row Level Security (RLS) and pgvector for role-based data protection and semantic search.

💻 Technologies Used

  1. Azure AI Foundry
  2. PostgreSQL including Row Level Security (RLS) and Semantic Search with the pgvector extension
  3. Model Context Protocol (MCP)

⚙️ Set Up

This sample uses azd and a bicep template to deploy all Azure resources:

  1. Python Environment Setup
python3.11 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
  1. Login to your Azure account: azd auth login

  2. Deploy the Infrastructure

cd infra && ./deploy.sh

The deploy script generates the .env file, which contains the project and model endpoints, model deployment names, and Application Insights connection string. The .env file will automatically be saved in the src/python/workshop folder.

🏃 Run the Application

  1. Start the database server

    docker-compose up db -d
    
  2. Add the environment variable (since the database is running inside a local container)

    POSTGRES_URL=<your-local-container-address>
    
  3. Start the MCP server

    python src/python/mcp_server/sales_analysis/sales_analysis.py
    
  4. Start the dev tunnel

    cd src/python/workshop
    # Run DevTunnel script
    bash ../../shared/scripts/start_devtunnel.sh
    
  5. Start the backend

    python src/python/workshop/app.py
    
  6. Start the frontend

    cd src/shared/webapp/
    python app.py
    

🚀 Usage

Open your web browser and navigate to the frontend application. Start asking questions!

zava-diy-screenshot-1 - Gbbai Ai Foundry MCP Postgresql by pablocast

🗑️ Delete resources

To delete the Azure resources:

  1. Visit the Azure Portal
  2. Click Resource groups
  3. Click on your resource group rg-agent-workshop-**
  4. Click Delete Resource group
  5. In the field at the bottom "Enter resource group name to confirm deletion" enter rg-agent-workshop-**
  6. Click Delete
  7. At the Delete Confirmation prompt, click "Delete"

Then cleanup the resources with the script:

bash infra/cleanup-deleted-resources.sh
Quick Setup
Installation guide for this server

Install Package (if required)

uvx gbbai-ai-foundry-mcp-postgresql

Cursor configuration (mcp.json)

{ "mcpServers": { "pablocast-gbbai-ai-foundry-mcp-postgresql": { "command": "uvx", "args": [ "gbbai-ai-foundry-mcp-postgresql" ] } } }