MCP on Azure: Build and Run Your Own Model-Context Server (Blob + Image Captioning)

MCP on Azure banner

GitHub Repo: github.com/OfekBenEliezer/mcp-on-azure

Video: What is MCP? (YouTube, Captain Azure)

This guide shows exactly how to run a minimal MCP Server on Azure: list files from Azure Blob Storage and describe an image using Azure OpenAI (gpt-4o vision). It’s the same flow we built live - no fluff, just what works.

What is MCP (Model Context Protocol)?

MCP is an open spec that lets AI clients (e.g., GitHub Copilot, Claude) call secure, predefined β€œtools” over a simple JSON protocol. An MCP Server exposes those toolsβ€”each with a name, schema, and logicβ€”so your AI can safely interact with your data and services (RBAC, logging, guardrails).

Architecture (what we built)

High-level architecture of MCP server with Azure Blob Storage and Azure OpenAI
A (MCP Client)  β†’  B (MCP Server, Express/Node)
B β†’ Azure Blob Storage (list files, fetch blob URL)
B β†’ Azure OpenAI gpt-4o vision (describe the image)
B β†’ returns JSON back to A

Prerequisites

Get the Code

# clone
git clone https://github.com/OfekBenEliezer/mcp-on-azure.git
cd mcp-on-azure

# install dependencies
npm install

Environment Settings (.env)

Create a .env file at the repo root (the same folder you run commands from). These are the exact variables the server expects. Note the trailing slash on the OpenAI endpoint.

Azure Portal - Access keys panel showing Storage connection string
Where to find it: In the Azure Portal, go to your Storage Account β†’ Security + networking β†’ Access keys, and copy the Connection string.
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=<your-account>;<...>;EndpointSuffix=core.windows.net
AZURE_OPENAI_ENDPOINT=https://<your-openai>.openai.azure.com/
AZURE_OPENAI_KEY=<your-azure-openai-key>
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
AZURE_OPENAI_API_VERSION=2024-02-15-preview

Container name: The server uses captain-azure by default. If your container is different, edit the containerName constant inside mcp-ts-server/server.js.

Security tip: Don’t commit .env. Keep only .env.example in the repo.

Run the MCP Server (local)

node .\mcp-ts-server\server.js
# Expected log: MCP Server running on http://localhost:3333

Tools exposed by the server

Test (PowerShell / curl)

List files

Invoke-RestMethod -Uri "http://localhost:3333/tools/list_captain_files" `
  -Method Post `
  -ContentType "application/json"

Describe an image

Invoke-RestMethod -Uri "http://localhost:3333/tools/describe_blob" `
  -Method Post `
  -Body (@{ blobName = "CertWebinar.png" } | ConvertTo-Json) `
  -ContentType "application/json"

curl versions:

curl -s -X POST http://localhost:3333/tools/list_captain_files \
  -H "Content-Type: application/json"

curl -s -X POST http://localhost:3333/tools/describe_blob \
  -H "Content-Type: application/json" \
  -d '{"blobName":"CertWebinar.png"}'

What the server does (brief)

Troubleshooting (real fixes we used)

Deploy (optional, later)

In the repo we ran locally. To deploy, containerize and push to Azure Container Apps or Web App for Containers. Make sure you pass the same env vars in Azure (never commit secrets).

✨ Credits

Built and documented by πŸš€ Captain Azure β€” Ofek Ben Eliezer
πŸ“‚ Repo: mcp-on-azure
πŸŽ₯ Video: What is MCP?


πŸ’‘ Why this matters:
MCP gives your copilots a safe, consistent way to talk to Azure.
With a tiny Node.js server, you can bridge Azure Blob Storage and Azure OpenAI β€” fast. Start small, and extend with more tools whenever you’re ready.