Azure SQL MCP Server
Enables querying an Azure SQL Products table via MCP, allowing integration with Microsoft Foundry agents for data retrieval.
README
SQL MCP Server — Foundry Demo — Resume Point
Project: Deploy Microsoft's SQL MCP Server (Data API builder) on Azure Container
Apps, backed by an Azure SQL Products table, so it can be wired into a
Microsoft Foundry agent (Claude, via Microsoft Agent Framework or the Foundry
portal) as a Custom MCP Tool.
Working folder on this machine: ~/MCP-Azure (contains dab-config.json and
Dockerfile). This is a separate folder from the agent.py / Cursor
project that consumes this MCP server later — don't merge them.
Current status
| Step | Status |
|---|---|
| 1. Azure SQL Database + Products table (10 sample rows) | ✅ Done — verified via Azure Portal Query Editor (SELECT COUNT(*) FROM dbo.Products → 10) |
2. dab-config.json (SQL MCP Server config) |
✅ Done — entity Products fully configured, anonymous:read, field descriptions set |
| 3. Dockerfile | ✅ Created |
| 3. Azure Container Registry (ACR) resource | ✅ Created (acrsqlmcp15272) |
3. Build image via az acr build (cloud build) |
❌ Blocked — Free Trial subscriptions can't use ACR Tasks (TasksOperationsNotAllowed). Switched to local Docker build + push instead. |
| 3. Build image locally with Docker, tag, push to ACR | 🔄 In progress — resume here |
| 3. Container Apps environment + deploy | ⬜ Not started |
3. Get /mcp URL, test /health |
⬜ Not started |
4. Wire into Foundry (portal or agent.py) |
⬜ Not started (guide + agent.py already exist from earlier session) |
Known values (already created — don't regenerate)
RESOURCE_GROUP="rg-mcp-demo"
LOCATION="westus3"
SQL_SERVER="sql-mcp-1000" # NOT the FQDN — just the server name
SQL_DATABASE="ProductsDb"
SQL_ADMIN="sqladmin"
SQL_PASSWORD="<not stored here — re-enter each session>"
CONNECTION_STRING="Server=tcp:${SQL_SERVER}.database.windows.net,1433;Database=${SQL_DATABASE};User ID=${SQL_ADMIN};Password=${SQL_PASSWORD};Encrypt=true;TrustServerCertificate=false;Connection Timeout=30;"
ACR_NAME="acrsqlmcp15272"
ACR_LOGIN_SERVER="acrsqlmcp15272.azurecr.io"
CONTAINERAPP_ENV="sql-mcp-env" # not yet created
CONTAINERAPP_NAME="sql-mcp-server" # not yet created
Re-paste this whole block into a fresh terminal at the start of each session — none of these persist across terminal tabs/restarts.
Remaining steps (resume here)
1. Confirm Docker Desktop is running
docker --version
If not installed: brew install --cask docker, then open Docker Desktop from
Applications and wait for the whale icon to go steady before continuing.
2. Build the image locally, targeting the right architecture
This Mac is Apple Silicon (arm64), but Azure Container Apps expects
linux/amd64 by default — build explicitly for that platform:
cd ~/MCP-Azure
docker build --platform linux/amd64 -t sql-mcp-server:1 .
3. Tag and push to ACR
az acr login --name "$ACR_NAME"
docker tag sql-mcp-server:1 "$ACR_LOGIN_SERVER/sql-mcp-server:1"
docker push "$ACR_LOGIN_SERVER/sql-mcp-server:1"
Confirm it landed:
az acr repository list --name "$ACR_NAME" --output table
Expect to see sql-mcp-server listed.
4. Create the Container Apps environment and deploy
az containerapp env create --name "$CONTAINERAPP_ENV" --resource-group "$RESOURCE_GROUP" --location "$LOCATION"
ACR_USERNAME=$(az acr credential show --name "$ACR_NAME" --query username --output tsv)
ACR_PASSWORD=$(az acr credential show --name "$ACR_NAME" --query "passwords[0].value" --output tsv)
az containerapp create \
--name "$CONTAINERAPP_NAME" --resource-group "$RESOURCE_GROUP" --environment "$CONTAINERAPP_ENV" \
--image "$ACR_LOGIN_SERVER/sql-mcp-server:1" \
--registry-server "$ACR_LOGIN_SERVER" --registry-username "$ACR_USERNAME" --registry-password "$ACR_PASSWORD" \
--target-port 5000 --ingress external --min-replicas 1 --max-replicas 3 \
--secrets "mssql-connection-string=$CONNECTION_STRING" \
--env-vars "MSSQL_CONNECTION_STRING=secretref:mssql-connection-string" \
--cpu 0.5 --memory 1.0Gi
5. Get the MCP URL and test it
MCP_URL=$(az containerapp show --name "$CONTAINERAPP_NAME" --resource-group "$RESOURCE_GROUP" \
--query "properties.configuration.ingress.fqdn" --output tsv)
echo "MCP Server URL: https://$MCP_URL/mcp"
curl "https://$MCP_URL/health"
A healthy response here means the SQL MCP Server is fully live. That URL is
what goes into PRODUCTS_MCP_URL in the separate agent.py / Cursor project,
or into the "Remote MCP Server endpoint" field when wiring this into Microsoft
Foundry's portal (Custom MCP Tool, Authentication: Unauthenticated, Require
approval: never).
Gotchas already hit and fixed (so you don't re-debug these)
- SQL Server region capacity restriction (Free Trial subscriptions can't
create SQL servers in some regions, e.g. East US) — fixed by using
westus3. sqlcmd(Go/Homebrew version) panics on certain flag combinations (panic: runtime error: index out of range) — worked around by verifying data via the Azure Portal Query Editor instead of the CLI.dab init --connection-string "@env(...)"fails withResponse file 'env(...)' does not exist— the DAB CLI's arg parser treats a leading@as a "response file" reference. Fixed by using--connection-string=@env(...)(no space,=sign) instead of a space-separated value..NET 8.0.0 not foundrunningdab— DAB2.0.9targets .NET 8, but only .NET 9 SDK was installed. Fixed withexport DOTNET_ROLL_FORWARD=LatestMajor(run once per terminal session, or prefix eachdotnet tool run dab ...command with it).dab update Products --fields.description "Category: Electronics, Furniture, ..."truncates at the first comma — the CLI parser splits on commas. Fixed by hand-editing theCategoryfield'sdescriptionvalue directly indab-config.jsonafter generation.Microsoft.ContainerRegistryprovider not registered — first-time use of ACR on this subscription. Fixed with:az provider register --namespace Microsoft.ContainerRegistry az provider register --namespace Microsoft.App az provider register --namespace Microsoft.OperationalInsightsaz acr buildfails withTasksOperationsNotAllowed— ACR Tasks (cloud-based builds) are blocked entirely for Azure Free Trial subscriptions; only a Pay-As-You-Go upgrade lifts this. Workaround: build the image locally with Docker (docker build --platform linux/amd64) and push directly withdocker tag/docker pushinstead ofaz acr build. This is where we are now (Step 3 above).
Related files from earlier work (not in this folder)
foundry-mcp-azure-sql-demo.md— full original step-by-step guide (Steps 1–6, including the no-code Foundry portal wiring and the Python SDK path).agent.py,.env.example,requirements.txt— a Microsoft Agent Framework + Claude-in-Foundry agent (separate Cursor project) that consumes this same MCP server viaPRODUCTS_MCP_URL.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.