AS

azure-samples/azure-postgres-mcp-demo

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 8 forks 质量 69 趋势 29MIT

The Azure Database for PostgreSQL allows you to manage Azure Database for PostgreSQL resources using natural language prompts.

概览

This is a demo repo that will show you how to setup the that enables AI agents to interact with Azure PostgreSQL databases through natural language queries. Supports SQL operations, schema discovery, and data analysis with enterprise-grade security. This server is a part of the . This repo will show you how to enable the Postgres specific features and how to connect it to your project via MCP - 🔍 - Execute queries, manage data, perform analytics - 📊 - Automatic table and column analysis - 🔐 - Azure managed identity and Entra ID authentication - 🎯 - Query databases using conversational AI - 🚀 - One-click Azure deployment with complete infrastructure The system consists of three main components: 1. (Client): Authenticates to the Azure MCP Server using its Managed Identity. 2. (Server): Runs in Azure Container Apps (ACA), using ACA Managed Identity for PostgreSQL access. 3. (Target): Azure Database for PostgreSQL Flexible Server with Entra ID authentication enabled.

README

以下为原文 README 节选,完整内容请查看原文。

Azure MCP PostgreSQL Server Demo

This is a demo repo that will show you how to setup the Azure Database for Postgres MCP server that enables AI agents to interact with Azure PostgreSQL databases through natural language queries. Supports SQL operations, schema discovery, and data analysis with enterprise-grade security.

This server is a part of the Azure MCP Server. This repo will show you how to enable the Postgres specific features and how to connect it to your Foundry project via MCP

Features

  • 🔍 SQL Operations - Execute queries, manage data, perform analytics
  • 📊 Schema Discovery - Automatic table and column analysis
  • 🔐 Enterprise Security - Azure managed identity and Entra ID authentication
  • 🎯 Natural Language - Query databases using conversational AI
  • 🚀 Easy Deployment - One-click Azure deployment with complete infrastructure

Components

The system consists of three main components:

  1. Foundry Agent (Client): Authenticates to the Azure MCP Server using its Managed Identity.

  2. Azure MCP PostgreSQL Server (Server): Runs in Azure Container Apps (ACA), using ACA Managed Identity for PostgreSQL access.

  3. PostgreSQL Database (Target): Azure Database for PostgreSQL Flexible Server with Entra ID authentication enabled.

Identity Separation: Two separate managed identities are used - the client MI (Foundry) authenticates to the MCP Server, while the MCP Server uses its own ACA MI to access PostgreSQL, ensuring proper security isolation.

Prerequisites

Quick start deployment

Deploy the complete Azure MCP PostgreSQL Server infrastructure by using Azure Developer CLI (azd):

Step 1: Deploy with azd up

The fastest way to get started is by using the automated deployment script.

  1. First, clone the repo:

    # Clone the repository
    git clone https://github.com/Azure-Samples/azure-postgres-mcp-demo
    cd azure-postgres-mcp-demo
    
  2. Open infra/main.parameters.json and update these 2 values

    Parameter Description
    postgresResourceId Resource ID of the Azure Database for PostgreSQL Flexible Server you want to connect to
    aifProjectResourceId Resource ID of the Azure Foundry project you want to use
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →