MCP Azure Storage Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Azure Storage Server
An MCP (Model Context Protocol) server that exposes 43 tools and 12 resources for managing Azure Storage — Blob, Queue, Table, and File Share — over a single HTTP endpoint. Designed for use with AI assistants (Claude, RooCode, Copilot), Postman, MCP Inspector, and any MCP-compatible client.
Deploys to Azure Container Apps with automatic HTTPS, user-assigned managed identity, and Bicep infrastructure-as-code.
Features
43 MCP tools across 5 categories (Blob, Queue, Table, File Share, Utilities)
12 MCP resources — read-only, URI-addressable data for LLM context (listings, content reads, properties)
Direct file upload —
POST /uploadendpoint streams multipart form-data to Azure via busboy (no temp files, no full-file buffering)URL-based upload —
blob-upload-from-urltool fetches files server-side (no base64 through LLM context)Dual-mode transport — stateful sessions for MCP clients + stateless one-shot for HTTP testing
API key authentication with constant-time comparison (X-API-Key header or Bearer token)
Rate limiting — per-endpoint budgets with API-key-aware identity; configurable window and max requests
Security headers via Helmet
Session TTL — automatic cleanup of idle sessions (30 min)
SAS token generation — blob and container-level shared access signatures with expiry ceiling and protocol control
Tool gating —
DISABLED_TOOLSenv var to disable specific tools at runtime (omitted from listings; forbidden on invocation)Server introspection —
store-infotool exposes limits, auth mode, endpoints, and disabled tools (no secrets)Base64 content encoding — upload/download binary files through JSON
Docker — multi-stage build, non-root container user
Azure Container Apps — Bicep IaC, user-assigned managed identity, auto-HTTPS, auto-scaling (1–5 replicas)
Related MCP server: mcp-gateway
Architecture Overview
┌─────────────────────┐ HTTPS / JSON-RPC 2.0
│ MCP Client │──────────────────────────────┐
│ (Claude, RooCode, │ │
│ Postman, etc.) │ ▼
└─────────────────────┘ ┌──────────────────────────┐
│ Express.js Server │
│ ├─ Helmet (headers) │
│ ├─ Rate Limiter │
│ ├─ API Key Auth │
│ └─ MCP Transport │
│ ├─ Stateful (session)│
│ └─ Stateless (1-shot)│
└──────────┬───────────────┘
│
┌───────────────────────────┬┴──────────────────────────┐
│ 43 Tools (actions) │ 12 Resources (reads) │
├───────────────────────────┼───────────────────────────┤
│ Blob (14) │ Queue (8) │ Blob (4) │ Queue (2) │
│ Table (5) │ FileShare (8) │ Table (2) │ FileShare (4)│
│ Utility (8) │ │
└───────────┬───────────────┴──────────┬───────────────┘
│ │
└──────────┬───────────────┘
│
┌──────────▼──────────┐
│ Azure Storage │
│ (SharedKey auth) │
└─────────────────────┘
Optional: OpenTelemetry observability (enabled via OTEL_EXPORTER_OTLP_ENDPOINT)
Express.js Server ···OTLP/HTTP···> OTel Collector ──Azure Monitor──> Application Insights
(traces, metrics, :4318 (sidecar) Exporter (Log Analytics
structured logs) Workspace)Repository Guide
mcp-azure-storage/
├── src/
│ ├── server.ts # Express app, MCP transport, session management
│ ├── config.ts # Storage config from env vars (singleton)
│ ├── instrumentation.cjs # OpenTelemetry SDK bootstrap (loaded via --require before app starts)
│ ├── session-attributes.cjs # Extracts mcp-session-id header for OTel trace correlation
│ ├── middleware/
│ │ └── api-key.ts # API key auth (X-API-Key / Bearer)
│ ├── tools/
│ │ ├── blob-tools.ts # 14 tools -- container + blob CRUD, head, set-tier, SAS, metadata, batch delete, URL upload
│ │ ├── queue-tools.ts # 8 tools -- queue CRUD + message operations + lease renewal
│ │ ├── table-tools.ts # 5 tools -- table CRUD + entity operations
│ │ ├── fileshare-tools.ts # 8 tools -- share/directory/file operations
│ │ └── utility-tools.ts # 8 tools -- base64, SAS refresh, MIME lookup, upload info, store-info
│ ├── utils/
│ │ ├── errors.ts # Structured error mapping + server.tool() wrapper
│ │ ├── format.ts # Response formatting (JSON/HTML/MD) utility
│ │ ├── otel-logger.ts # Structured logger with dual console + OTel log record output
│ │ └── disabled-tools.ts # Parses DISABLED_TOOLS env var and builds forbidden error responses
│ └── resources/
│ ├── blob-resources.ts # 4 resources -- containers, blobs, properties
│ ├── fileshare-resources.ts # 4 resources -- shares, files, properties
│ ├── queue-resources.ts # 2 resources -- queues, queue properties
│ └── table-resources.ts # 2 resources -- tables, entity lookup
├── otel/
│ ├── Dockerfile # OTel Collector sidecar container image
│ ├── otel-collector-config.azure.yaml # Collector pipeline config (OTLP receiver, Azure Monitor exporter)
│ ├── workbook.bicep # Azure Monitor Workbook Bicep template
│ └── workbook.json # Workbook definition (KQL dashboards for MCP tool usage, latency, errors)
├── scripts/
│ ├── setup-monitoring.ps1 # Provisions Azure Monitor resources (Log Analytics, App Insights, Workbook)
│ ├── otel-verify.ps1 # End-to-end telemetry verification (20 MCP tool calls with pass/fail reporting)
│ ├── push-to-acr.ps1 # Builds and pushes container images to Azure Container Registry
│ ├── setup-acr.ps1 # Provisions Azure Container Registry
│ ├── teardown.ps1 # Tears down Azure resources
│ └── helpers/
│ └── common.ps1 # Shared PowerShell helper functions
├── tests/
│ ├── setup.ts # Test env bootstrap (dummy credentials)
│ ├── config.test.ts # Config module tests
│ ├── instrumentation.test.ts # OTel instrumentation bootstrap tests
│ ├── session-attributes.test.ts # Session attribute extraction tests
│ ├── upload.test.ts # Multipart upload endpoint tests
│ ├── helpers/
│ │ └── mcp-test-harness.ts # Stateless MCP endpoint + SSE-aware helpers
│ ├── middleware/
│ │ ├── api-key.test.ts # API key auth tests (503/401/403/pass-through)
│ │ ├── disabled-tools.test.ts # Disabled-tool gating tests
│ │ └── rate-limit.test.ts # Rate limiting tests
│ ├── tools/
│ │ ├── blob-tools.test.ts # Mock Azure Blob SDK + SSRF + lifecycle
│ │ ├── queue-tools.test.ts # Mock Azure Queue SDK + lease renewal
│ │ ├── table-tools.test.ts # Mock Azure Tables SDK
│ │ ├── fileshare-tools.test.ts # Mock Azure File Share SDK
│ │ ├── utility-tools.test.ts # base64, MIME, container name, upload URL
│ │ └── structured-errors.test.ts # Error mapping, SAS sanitisation, MCP integration
│ ├── resources/
│ │ ├── blob-resources.test.ts # List cap, download guard
│ │ ├── queue-resources.test.ts # List cap, properties
│ │ ├── table-resources.test.ts # List cap, entity lookup
│ │ └── fileshare-resources.test.ts # List cap, size guard
│ ├── utils/
│ │ ├── format.test.ts # JSON/HTML/MD formatting
│ │ └── otel-logger.test.ts # OTel logger dual-output tests
│ └── integration/
│ ├── blob-integration.test.ts # Azurite blob CRUD smoke test
│ ├── queue-integration.test.ts # Azurite queue CRUD smoke test
│ ├── table-integration.test.ts # Azurite table CRUD smoke test
│ └── upload-integration.test.ts # Streaming upload integration tests
├── infra/
│ ├── main.bicep # Full Azure infrastructure (Container Apps, Storage, OTel sidecar, alerts)
│ └── main.parameters.json # Bicep parameter defaults
├── img/
│ ├── ApplicationInsights-Overview.png # Azure Monitor dashboard screenshot
│ └── ApplicationInsights-Tools.png # Per-tool breakdown screenshot
├── deploy_to_azure.ps1 # One-command deploy script (reads .env, syncs to azd, deploys)
├── .github/workflows/
│ └── ci.yml # GitHub Actions -- unit + integration tests
├── docker-compose.azurite.yml # Azurite emulator for local integration tests
├── vitest.config.ts # Unit test config (coverage, thresholds)
├── vitest.integration.config.ts # Integration test config (Azurite)
├── .env.test # Azurite well-known credentials for tests
├── Dockerfile # Multi-stage build, non-root user
├── .dockerignore # Excludes .env, docs, infra from image
├── azure.yaml # Azure Developer CLI project definition
├── ENVIRONMENTS.md # Multi-environment deployment guide (dev, test, prod)
├── .azure.env.example # Template for azd deployment environment variables
├── .env.example # Template for local environment variables
├── .gitignore # Ignores .env, dist, node_modules, docs
├── tsconfig.json # TypeScript configuration
├── package.json # Dependencies and scripts
└── LICENSE # Project licenceResponse Format Option
All 43 tools accept an optional format parameter that controls how structured data is returned:
Value | Description |
| (default) Standard JSON — best for programmatic consumption and MCP tool chaining. |
| Minimal HTML fragment ( |
| GitHub-Flavoured Markdown — GFM tables for arrays, bold key–value lists for objects. Ideal for chat UIs that render Markdown natively. |
Example — request blob list as Markdown:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "blob-list",
"arguments": { "containerName": "my-data", "format": "md" }
},
"id": 3
}HTML output classes (for CSS targeting):
.mcp-title—<h3>section heading.mcp-table—<table>for array-of-objects.mcp-detail—<dl>for single-object key–value.mcp-nested—<pre>for nested JSON inside a detail list.mcp-raw—<pre>for primitives or non-object data
Structured Error Model
All 43 tools return structured error JSON when an operation fails. Instead of plain-text error messages, every error response uses isError: true with a single text content item containing a JSON object. This makes errors machine-parseable for automated retry logic, error routing, and client-side handling.
Error Response Shape
When a tool call fails, the MCP response looks like:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"isError": true,
"content": [
{
"type": "text",
"text": "{\"error\":{\"code\":\"not_found\",\"status\":404,\"azureCode\":\"BlobNotFound\",\"message\":\"BlobNotFound: The specified blob does not exist.\",\"retryable\":false}}"
}
]
}
}Parse the text field as JSON to access the structured payload:
{
"error": {
"code": "not_found",
"status": 404,
"azureCode": "BlobNotFound",
"message": "BlobNotFound: The specified blob does not exist.",
"retryable": false
}
}Error Codes
Every error includes a code field from this fixed set:
Code | HTTP Status | Description | Extra Fields |
| 404 | The requested resource (blob, container, queue, table, share) does not exist. | — |
| 409 | The resource already exists (container, queue, table, share). | — |
| varies | A lease or pop receipt is invalid, missing, or mismatched. Retry after re-acquiring. | — |
| 409 | The blob is protected by an immutability policy or legal hold. |
|
| 409 | The blob is in the Archive tier and must be rehydrated before access. |
|
| — | The payload exceeds the maximum allowed size. |
|
| 429 | Too many requests — back off and retry. |
|
| 400 | A parameter or request value is invalid. |
|
| 403 | The request is not authorised for this operation. | — |
| 5xx / null | An unexpected server-side or network error. |
|
Common Fields
Field | Type | Description |
|
| Error category from the fixed set above. |
|
| HTTP status code from the Azure REST API, or |
|
| The Azure-specific error code (e.g. |
|
| Human-readable message. Starts with the Azure code when known (e.g. |
|
|
|
Handling Errors
const response = await callTool("blob-read", { containerName: "docs", blobName: "missing.txt" });
if (response.isError) {
const { error } = JSON.parse(response.content[0].text);
switch (error.code) {
case "not_found":
console.log(`Resource not found: ${error.message}`);
break;
case "rate_limited":
console.log(`Throttled — retry after ${error.retryAfterSeconds}s`);
break;
case "backend":
if (error.retryable) {
console.log("Transient failure — safe to retry");
}
break;
default:
console.log(`Error [${error.code}]: ${error.message}`);
}
}Available Tools
Blob Storage (14 tools)
Tool | Description |
| Create a blob container (idempotent). Use before uploading blobs to a new container. Use |
| Destructive — permanently delete a container and ALL blobs inside it. Verify with |
| Check whether a container exists. Returns |
| List blobs in a container, optionally filtered by virtual directory prefix or name prefix. Returns name, size, content type, etag, dates, and optional metadata. Set |
| Upload or overwrite a blob (base64 content). MIME type is auto-detected from extension. Use |
| Upload a file by URL — the server fetches it server-side. Ideal for large/binary files (PDFs, images) that exceed LLM context limits. No base64 encoding needed. |
| Get blob properties (metadata, content type, size, tier, immutability, legal hold) without downloading content. Supports version-specific lookups via |
| Download blob content as base64, or set |
| Destructive — permanently delete a blob and its snapshots. Supports version-specific deletion via |
| Destructive — delete up to 256 blobs in a single request using the Azure Blob Batch API. Blobs that do not exist are reported as |
| Replace all custom metadata on a blob. Include existing keys you want to keep — this is a full replacement. |
| Change a blob's access tier (Hot, Cool, or Archive). Use for lifecycle cost optimisation. Moving to Archive is potentially destructive — archived blobs must be rehydrated before reading, which can take hours. Supports version-specific tier changes via |
| Generate a time-limited SAS URL for a specific blob. Use to grant temporary access without exposing account keys. |
| Generate a time-limited SAS token for an entire container. Returns both the token and a ready-to-use connection string. |
Queue Storage (8 tools)
Tool | Description |
| Create a queue (idempotent). Use before sending messages to a new queue. |
| Destructive — permanently delete a queue and ALL pending messages. Check queue properties via the |
| Send a text message to a queue with optional TTL. For structured data, serialise as JSON string. |
| Preview messages at the front of a queue WITHOUT removing them. Messages stay visible to other receivers. |
| Receive and hide messages for processing. Call |
| Permanently remove a processed message. Requires |
| Update a JSON message body with additive fields (state, progress, attempt, owner, details) and optionally renew the lease. Requires |
| Renew a message's visibility timeout (lease) without changing the body. Pass |
Table Storage (5 tools)
Tool | Description |
| Create a table (idempotent). Use before upserting entities to a new table. |
| Destructive — permanently delete a table and ALL entities. |
| Insert or merge-update an entity. Pass |
| Query entities with an OData filter (e.g. |
| Destructive — permanently delete a single entity by partition key + row key. |
File Share (8 tools)
Tool | Description |
| List all file shares with names and properties (quota, last modified). |
| Create a file share (idempotent). Use before uploading files to a new share. |
| Destructive — permanently delete a share and ALL files/directories inside it. |
| Create a directory and any missing parents (idempotent). Or let |
| Delete a directory (must be empty — remove all contents first). Use the |
| Upload a file (base64 content). Auto-creates parent directories. Use |
| Download file content as base64. Use |
| Destructive — permanently delete a file from a share. |
Utilities (8 tools)
Tool | Description |
| Encode text to base64. Use BEFORE |
| Decode base64 to text. Use AFTER |
| Generate a fresh SAS URL for a specific blob. Use to replace an expired SAS URL. |
| Generate a fresh SAS token + connection string for a container. Use to replace an expired container SAS. |
| MIME type lookup by file name or extension. Returns |
| Sanitise arbitrary text (email, URL, display name) into a valid Azure container name. Use BEFORE |
| Get the direct file upload endpoint URL, required fields, and usage examples. Use when uploading large or binary files that exceed base64/JSON-RPC limits. |
| Read-only snapshot of server runtime configuration, limits, disabled tools, auth mode, endpoints, and capabilities. Use to discover upload/body size limits and self-calibrate client behaviour. No secrets included. |
store-info — Server Configuration Discovery
The store-info tool returns a read-only snapshot of the server's runtime configuration and capabilities. It is intended for MCP clients to self-calibrate limits (e.g. max upload size, SAS expiry ceiling) and discover which tools are available without trial-and-error probing.
Inputs: { format?: "json" | "html" | "md" } (default "json")
Output schema:
{
"ok": true,
"limits": {
"maxUploadBytes": 5368709120,
"maxJsonBodyBytes": 52428800,
"sasMaxExpiryMinutes": 1440
},
"sas": {
"protocol": "https"
},
"disabledTools": [],
"auth": {
"mode": "shared_key",
"accountName": "mystorageaccount"
},
"endpoints": {
"blobServiceUrl": "https://mystorageaccount.blob.core.windows.net"
},
"capabilities": {
"versions": null,
"archiveTier": null,
"maxContainerConcurrency": 4
}
}Field | Description |
| Maximum file size for |
| Maximum JSON body size for |
| Ceiling for SAS token lifetime (env: |
| SAS protocol: |
| Canonical (lowercase) list of tools disabled via |
| Authentication mode: |
| Azure Storage account name. |
| Base URL for blob service operations (respects Azurite overrides). |
|
|
|
|
| Indicative concurrency for upload streaming (default 4). Not a strict guarantee. |
Security: No secrets, keys, SAS tokens, or connection strings are included in the output.
MCP Resources (12 resources)
Resources provide read-only, URI-addressable access to storage data. Unlike tools (which are actions), resources allow agents to directly attach storage data as LLM context without invoking a tool call. Resources complement the tools above — use resources for reading/browsing and tools for mutations.
Blob Storage Resources (4)
Resource URI | Description |
| List all blob containers. Starting point to discover containers before reading blobs. Returns JSON with name and index. |
| Container properties and metadata (lease status, immutability policy, legal hold). |
| List all blobs in a container with name, size, content type, and last-modified date. |
| Read blob content. Text blobs returned as UTF-8 text; binary blobs as base64. |
File Share Resources (4)
Resource URI | Description |
| List all file shares. Starting point to discover shares before browsing directories. Returns JSON with name and index. |
| List files and subdirectories in a directory. Use empty directoryPath for root. Returns name, type, size. |
| Read file content. Text files returned as UTF-8 text; binary files as base64. |
| File properties (size, content type, timestamps, metadata) without downloading content. |
Queue Storage Resources (2)
Resource URI | Description |
| List all queues. Messages are accessed via tools (not resources) because receiving has side effects. |
| Queue properties including approximate message count and metadata. |
Table Storage Resources (2)
Resource URI | Description |
| List all tables. Use before querying or upserting entities via tools. |
| Get a single entity by composite key. Faster than a query when you know the exact key. |
Uploading Large / Binary Files
MCP uses JSON-RPC, so all tool parameters are JSON strings. For small files, blob-create works well with base64 encoding. But for large or binary files (PDFs, images, videos), base64 encoding is impractical — especially when the LLM context window can't hold a multi-MB encoded string.
Three approaches solve this:
Option 1 — blob-upload-from-url MCP tool (recommended for AI agents)
Give the server a URL; it fetches and uploads server-side. No base64 needed — the LLM only passes a short URL string:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "blob-upload-from-url",
"arguments": {
"containerName": "documents",
"blobName": "reports/annual-report.pdf",
"sourceUrl": "https://example.com/files/annual-report.pdf"
}
},
"id": 1
}The URL must be publicly accessible or include authentication (e.g. a SAS URL from another storage account). The server detects the MIME type from the HTTP response headers.
Option 2 — POST /upload REST endpoint (recommended for scripts / CI / clients)
Upload files directly via standard multipart form-data — the same format used by HTML file inputs and curl. No MCP or JSON-RPC involved:
# Upload a PDF
curl -X POST https://<your-app>.azurecontainerapps.io/upload \
-H "X-API-Key: <your-api-key>" \
-F "file=@./annual-report.pdf" \
-F "containerName=documents" \
-F "blobName=reports/annual-report.pdf"
# Upload with metadata
curl -X POST https://<your-app>.azurecontainerapps.io/upload \
-H "X-API-Key: <your-api-key>" \
-F "file=@./photo.jpg" \
-F "containerName=images" \
-F "blobName=photos/vacation.jpg" \
-F 'metadata={"photographer":"Alice","location":"Paris"}'Python example:
import requests
response = requests.post(
"https://<your-app>.azurecontainerapps.io/upload",
headers={"X-API-Key": "<your-api-key>"},
files={"file": open("report.pdf", "rb")},
data={
"containerName": "documents",
"blobName": "reports/report.pdf",
},
)
print(response.json())
# → {"success": true, "blobName": "reports/report.pdf", "contentType": "application/pdf", "size": 2048576, ...}Field | Required | Description |
| Yes | The file to upload (multipart form field) |
| Yes | Target blob container |
| No | Blob name (defaults to the uploaded filename) |
| No | JSON string of key-value metadata |
Streaming: The /upload endpoint streams files directly to Azure Blob Storage without buffering the entire file in memory or on disk. This keeps server memory bounded even for multi-GB uploads. Oversized files (exceeding MAX_UPLOAD_BYTES, default 5 GiB) are rejected with HTTP 413 and a structured JSON body containing code: "too_large" and maxBytes.
Limits: Default 5 GiB per upload (configurable via MAX_UPLOAD_BYTES). For larger files, use Option 3 below.
Option 3 — SAS URL direct upload (for very large files)
Use blob-get-container-sas to generate a write-enabled SAS URL, then upload directly to Azure Storage from any HTTP client — bypassing the MCP server entirely:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "blob-get-container-sas",
"arguments": {
"containerName": "documents",
"permissions": "rwl",
"expiryHours": 1
}
},
"id": 1
}Then upload directly to Azure Blob Storage using the SAS token from the response — no size limits from the MCP server.
Prerequisites
Node.js 26+
An Azure Storage Account with access keys
Azure CLI + Azure Developer CLI (
azd) for deployment
Quick Start (Local Development)
1. Clone and install
git clone https://github.com/<your-username>/mcp-azure-storage.git
cd mcp-azure-storage
npm install2. Configure environment
cp .env.example .envEdit .env with your values:
PORT=3000
MCP_API_KEY=your-secret-api-key-here
AZURE_STORAGE_ACCOUNT_NAME=yourstorageaccount
AZURE_STORAGE_ACCOUNT_KEY=youraccountkeyFinding your storage account key: Azure Portal → Storage Account → Access keys, or via CLI:
az storage account keys list --account-name yourstorageaccount --query "[0].value" -o tsv
3. Run the dev server
npm run devYou should see:
MCP Azure Storage Server v1.4.0
MCP endpoint : http://localhost:3000/mcp
Upload : http://localhost:3000/upload
Health check : http://localhost:3000/health
Mode : Stateless (per-request, multi-replica safe)
TLS : DISABLED (plain HTTP)
API key auth : ENABLED
CORS : ENABLED
Rate limit : MCP 3000 / Upload 600 per 900s (API-key-aware)
JSON limit : 50mb
Upload limit : 5120mb (streaming to Azure)4. Verify
curl http://localhost:3000/health
# → {"status":"healthy"}Health check under TLS: When running with
TLS_CERT_FILEandTLS_KEY_FILE, the server listens on HTTPS. If your certificate is self-signed (common in dev),curlwill reject it. Use--insecure(or-k) to skip verification:curl -k https://localhost:3000/health # → {"status":"healthy"}In containers where
curlis not installed, you can use Node.js directly:node -e "const https=require('https');https.get('https://localhost:3000/health',{rejectUnauthorized:false},r=>{let d='';r.on('data',c=>d+=c);r.on('end',()=>{console.log(d);process.exit(r.statusCode===200?0:1)})})"
Testing with Postman
All requests go to POST http://localhost:3000/mcp with headers:
Content-Type: application/json
Accept: application/json, text/event-stream
X-API-Key: <your-api-key>Important: The MCP SDK requires
Accept: application/json, text/event-streamexactly —*/*will not work.
Stateless mode (recommended for HTTP testing)
Skip initialize entirely — send tool calls directly:
List tools:
{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}Call a tool:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "blob-list",
"arguments": { "containerName": "my-container" }
},
"id": 2
}List resources:
{
"jsonrpc": "2.0",
"method": "resources/list",
"params": {},
"id": 3
}Read a resource:
{
"jsonrpc": "2.0",
"method": "resources/read",
"params": {
"uri": "azure-blob:///containers"
},
"id": 4
}Stateful mode (for MCP clients)
Send initialize first — the response includes a Mcp-Session-Id header. Pass it on all subsequent requests:
Mcp-Session-Id: <session-id-from-init-response>Testing with MCP Inspector
npx @modelcontextprotocol/inspectorSet transport to Streamable HTTP, URL to http://localhost:3000/mcp, and add header X-API-Key: <your-key>.
Connecting to AI Assistants
RooCode (VS Code)
RooCode supports Streamable HTTP transport natively. Add to your VS Code MCP settings (.vscode/mcp.json or global settings):
Local dev server:
{
"mcpServers": {
"azure-storage": {
"url": "http://localhost:3000/mcp",
"transport": "streamable-http",
"headers": {
"X-API-Key": "<your-api-key>"
}
}
}
}Remote (Azure-deployed) server:
{
"mcpServers": {
"azure-storage": {
"url": "https://<your-app>.azurecontainerapps.io/mcp",
"transport": "streamable-http",
"headers": {
"X-API-Key": "<your-production-api-key>"
}
}
}
}Claude Desktop
Claude Desktop does not natively support remote HTTP MCP servers — it only connects to local stdio processes. To bridge the gap, use mcp-remote, which acts as a local stdio-to-HTTP proxy.
Prerequisites: Node.js 26+ must be installed.
Setup:
Open Claude Desktop → Settings → Developer → Local MCP Servers → Edit Config
Add the following to your
claude_desktop_config.json:
{
"mcpServers": {
"mcp-azure-storage": {
"command": "C:\\PROGRA~1\\nodejs\\npx.cmd",
"args": [
"-y",
"mcp-remote",
"https://<your-app>.azurecontainerapps.io/mcp",
"--header",
"X-API-Key: <your-production-api-key>",
"--transport",
"http-first"
]
}
}
}macOS / Linux — replace
"command"with"npx"(assuming Node.js is on your PATH):{ "mcpServers": { "mcp-azure-storage": { "command": "npx", "args": [ "-y", "mcp-remote", "https://<your-app>.azurecontainerapps.io/mcp", "--header", "X-API-Key: <your-production-api-key>", "--transport", "http-first" ] } } }
Restart Claude Desktop. The MCP server should appear in the tools list.
How it works: mcp-remote runs as a local stdio process that Claude Desktop spawns. It forwards all MCP JSON-RPC messages over HTTP to your remote Azure endpoint, passing the X-API-Key header for authentication. The --transport http-first flag tells it to prefer Streamable HTTP transport (matching this server's transport).
For local development, point at http://localhost:3000/mcp instead of the Azure URL:
{
"mcpServers": {
"mcp-azure-storage": {
"command": "C:\\PROGRA~1\\nodejs\\npx.cmd",
"args": [
"-y",
"mcp-remote",
"http://localhost:3000/mcp",
"--header",
"X-API-Key: <your-local-api-key>",
"--transport",
"http-first"
]
}
}
}Deploy to Azure
Quick Deploy (Recommended)
The deploy_to_azure.ps1 script automates the entire deployment process. It reads your .env file, syncs the relevant variables into the azd environment, and runs azd up — so you only need to maintain one .env file for both local development and Azure deployment.
# Full provision + deploy (reads .env, syncs to azd, runs azd up)
.\deploy_to_azure.ps1
# Code-only redeploy — faster, skips Bicep infrastructure provisioning
.\deploy_to_azure.ps1 -SkipProvision
# Use a different env file
.\deploy_to_azure.ps1 -EnvFile ".env.production"
# Enable one-way lifecycle policy (Cold after 15d, Archive after 90d)
.\deploy_to_azure.ps1 -LifecyclePolicy one-way
# Enable smart lifecycle policy (Cool after 30d inactivity, auto-reheat on access)
.\deploy_to_azure.ps1 -LifecyclePolicy smartFlag | Description |
| Path to the |
| Runs |
| Controls automatic blob access-tier transitions on new storage accounts. Values: |
What the script does:
Parses your
.envfile for uncommentedKEY=VALUElinesSyncs
AZURE_STORAGE_ACCOUNT_NAME,AZURE_STORAGE_ACCOUNT_KEY, andMCP_API_KEYinto the active azd environmentSets optional infrastructure flags (e.g. lifecycle policy)
Shows a deployment summary with confirmation prompt
Runs
azd up(orazd deploywith-SkipProvision)Displays the MCP endpoint URL on success
Storage Lifecycle Policy
The -LifecyclePolicy parameter controls automatic blob access-tier transitions that reduce storage costs without any application changes. Three modes are available:
Mode | Description |
| (default) No lifecycle rules. All blobs stay in Hot tier. |
| Blobs move to cheaper tiers based on modification date and never automatically return. Cold after 15 days, Archive after 90 days. Archived blobs must be manually rehydrated (via the |
| Blobs move to Cool tier after 30 days of inactivity (no reads), then automatically promote back to Hot when accessed. Enables access-time tracking on the storage account. Does not use Archive tier (Azure cannot auto-rehydrate archived blobs). |
Mode details
one-way mode rules:
Rule | Scope | Action |
| All block blobs | Move to Cold tier after 15 days of no modification |
| All block blobs | Move to Archive tier after 90 days of no modification |
smart mode rules:
Rule | Scope | Action |
| All block blobs | Move to Cool tier after 30 days with no access |
(automatic) | Cool blobs | Auto-promote back to Hot when accessed ( |
Why no Archive in smart mode? Azure lifecycle management can automatically move blobs into Archive tier, but it cannot automatically rehydrate them when accessed. Rehydration is a manual, asynchronous operation that takes up to 15 hours (Standard priority) or under 1 hour (High priority). Smart mode uses only Hot/Cool tiers where automatic promotion is supported.
Notes:
Off by default (
none) -- no lifecycle rules are provisionedOnly applies to new storage accounts provisioned by Bicep -- has no effect when using BYOSA (bring-your-own storage account)
To change modes, pass the new
-LifecyclePolicyvalue and runazd provision; the next deployment will replace the lifecycle policyDay thresholds can be customised by editing
infra/main.bicep
Prerequisites: You must have run
az login,azd auth login, andazd initat least once before using the script. See the manual steps below if this is your first deployment.
Manual Deployment
1. Login
az login
azd auth login2. Initialize (first time only)
azd initThis prompts you for an environment name (e.g. mcp-azure-storage-dev), Azure subscription, and location. It creates a .azure/<env-name>/.env file to store configuration for subsequent commands.
3. Set deployment variables
azd stores environment variables in .azure/<env-name>/.env. Some are set automatically by azd init; others need to be set manually. See .azure.env.example for the full template with descriptions.
Required — set before first deploy:
azd env set MCP_API_KEY "your-strong-secret-key-here"Or generate a random key:
macOS / Linux:
azd env set MCP_API_KEY "$(openssl rand -base64 24)"Windows (PowerShell):
azd env set MCP_API_KEY ([Convert]::ToBase64String((1..24 | ForEach-Object { Get-Random -Max 256 }) -as [byte[]]))Optional — use an existing Storage Account (BYOSA):
By default, azd provision creates a new empty Storage Account. To connect to an existing storage account (e.g. one that already contains your data), set both variables before deploying:
azd env set AZURE_STORAGE_ACCOUNT_NAME "yourstorageaccount"
azd env set AZURE_STORAGE_ACCOUNT_KEY "youraccountkey"Finding your storage account key:
az storage account keys list --account-name yourstorageaccount --query "[0].value" -o tsv
When both are set:
No new Storage Account is created by Bicep
Storage RBAC role assignments are skipped
The Container App connects directly using the provided credentials
The existing account can be in any subscription, resource group, or region
Leave them unset to have Bicep provision a new storage account automatically.
Auto-populated after azd init (no action needed):
Variable | Description |
| Environment name chosen during |
| Azure region chosen during |
| Azure subscription chosen during |
Auto-populated after azd provision (no action needed):
Variable | Description |
| ACR login server (Bicep output) |
| Full MCP endpoint URL (Bicep output) |
| Provisioned storage account name (Bicep output) |
Auto-populated after azd deploy (no action needed):
Variable | Description |
| Docker image pushed to ACR |
| Whether the Container App resource exists |
Tip: View all current environment values with
azd env get-values. To start fresh after a teardown, delete the.azure/<env-name>/directory or runazd env new <new-name>.
Multiple environments (dev, test, prod):
azdsupports named environments out of the box — each with its own subscription, region, and secrets. See the Multi-Environment Deployment Guide for step-by-step instructions on creating, switching, and deploying to separate dev and test environments.
4. Deploy
Option A — Single command
azd upOption B — Step-by-step (provision then deploy separately)
If azd up fails, times out, or you need more control, run the two phases individually:
# Step 1: Provision infrastructure (Bicep → Resource Group, ACR, Storage, Container App, RBAC)
azd provision
# Step 2: Build Docker image, push to ACR, and update the Container App
azd deployTip: If only infrastructure changed (edited
infra/main.bicep), runazd provisionalone. If only application code changed, runazd deployalone. Running both in sequence is equivalent toazd up.
Both options provision via Bicep:
Resource Group with Container Apps Environment
Azure Container Registry (Basic SKU, admin-user disabled)
User-Assigned Managed Identity — created before the Container App to break the ACR pull circular dependency
Azure Storage Account (Standard_LRS, TLS 1.2)
Azure Container App with auto-HTTPS on
*.azurecontainerapps.io, sticky sessions, placeholder image on first provisionRBAC — AcrPull + Blob, Queue, and Table Data Contributor roles (all assigned before the Container App is created)
Secrets — MCP_API_KEY and Storage Account Key injected securely
5. Test the deployed endpoint
curl -X POST https://<your-app>.azurecontainerapps.io/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-API-Key: <your-production-key>" \
-d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":1}'6. Check deployment status
Use azd show to view the current state of all provisioned resources and service endpoints:
azd showTo see detailed provisioning output or diagnose issues, review the last deployment operation:
azd provision --previewYou can also check the Container App's live status directly via the Azure CLI:
az containerapp show \
--name <your-app-name> \
--resource-group <your-resource-group> \
--query "{status:properties.runningStatus, fqdn:properties.configuration.ingress.fqdn}" \
-o table7. Redeploy after code changes
After modifying source code, rebuild and redeploy the container with:
azd deployThis rebuilds the Docker image, pushes it to the Azure Container Registry, and updates the Container App — without re-provisioning infrastructure.
If you have also changed the Bicep infrastructure files (e.g. infra/main.bicep), run the full provision-and-deploy cycle instead:
azd up8. Tear down the deployment
To delete all Azure resources created by azd up (Resource Group, Container App, Storage Account, Container Registry, etc.):
azd downAdd the --purge flag to also purge any soft-deleted resources (e.g. Key Vault) so the names can be reused immediately:
azd down --purgeWarning:
azd downis destructive. All data in the provisioned Storage Account will be permanently lost.
OpenTelemetry Monitoring
Version 1.2 adds opt-in OpenTelemetry observability with a three-tier architecture:
Application layer -- the MCP server emits traces, metrics, and structured logs via the OpenTelemetry SDK (bootstrapped by
src/instrumentation.cjsvia--requirebefore the app starts).Collector layer -- an OTel Collector sidecar receives all signals via OTLP/HTTP on port 4318, applies batch processing and severity filtering, and exports to Azure Monitor.
Monitoring layer -- Application Insights provides dashboards, alerting, and KQL query access through a Log Analytics Workspace.
Default behaviour is unchanged -- OTel activates only when OTEL_EXPORTER_OTLP_ENDPOINT is set. Without it, the server runs exactly as before with zero overhead.
Zero-overhead Guard
When OTEL_EXPORTER_OTLP_ENDPOINT is not set, the instrumentation module (src/instrumentation.cjs) exits immediately -- no SDK initialisation, no span processors, no performance impact. This means production deployments without observability pay absolutely no cost for having the instrumentation code present.
Architecture
MCP Server --OTLP/HTTP--> OTel Collector --azure_monitor--> Application Insights
(Express) :4318 (sidecar) exporter (Log Analytics Workspace)All three signals (traces, metrics, logs) land in a single Application Insights resource, correlated by operation_Id.
Enabling on Azure
.\deploy_to_azure.ps1 -EnableOTelThis provisions Application Insights, builds the OTel Collector sidecar image, and deploys both containers to Azure Container Apps. The Bicep parameter ENABLE_OTEL (default false) controls whether the sidecar and Application Insights resources are deployed.
Telemetry Levels
Control data volume and cost via OTEL_TELEMETRY_LEVEL:
Level | Trace Sampling | Log Severity | Metrics Interval | Use Case |
| Disabled | Disabled | Disabled | No telemetry overhead |
| 10% | WARN+ | 60s | Production |
| 100% | INFO+ | 15s | Staging / troubleshooting |
| 100% (always_on) | All | 5s | Development / debugging |
Cost depends on request volume. The first 5 GB/month of Application Insights data ingestion is free. Estimated costs: basic ~$1-4/mo, detailed ~$5-20/mo, full ~$20-100+/mo.
Session Correlation
The mcp-session-id HTTP header is extracted by src/session-attributes.cjs and attached to spans as a session.id attribute. This enables per-session trace filtering in Application Insights -- you can query all operations belonging to a single MCP client session using customDimensions.session.id in KQL.
Structured Logging
The otel-logger provides debug(), info(), warn(), and error() functions that emit to both:
Console -- filtered by
OTEL_LOG_MIN_SEVERITY(e.g.WARNsuppressesinfoanddebugoutput)OpenTelemetry log records -- with automatic trace correlation (
trace_id,span_id) so logs appear alongside their parent spans in Application Insights
Dashboard
When OTel is enabled, an Azure Workbook is deployed with four tabs:
Overview -- Request rate, error rate, latency percentiles (P50/P90/P99)
Tools -- Per-tool call distribution, latency breakdown, error rates
Data Volume -- Blob payload sizes, daily data transfer, request counts by tool
Logs -- Severity distribution, correlated log stream
The workbook definition lives in otel/workbook.json and is deployed via the Bicep template otel/workbook.bicep. It provides pre-built KQL dashboards for MCP tool usage, latency percentiles, error rates, and dependency health.
Application Insights Overview

The Overview tab showing request volume tiles, request rate over time, and latency percentile charts (P50/P90/P99).
Tools Breakdown

The Tools tab showing per-tool call distribution, latency table, and error rate over time.
Alert Rules
Two pre-configured alert rules are created in infra/main.bicep (no notifications by default):
High Error Rate -- Fires when more than 10% of requests return 5xx errors in a 5-minute window
Latency Degradation -- Fires when P95 response time exceeds 5 seconds over a 5-minute window
Monitoring Setup
# Provision Azure Monitor resources (Log Analytics, App Insights, Workbook)
.\scripts\setup-monitoring.ps1 -ResourceGroup "my-rg" -AppInsightsName "my-appi"
# Verify telemetry is flowing (end-to-end check)
.\scripts\otel-verify.ps1The scripts/setup-monitoring.ps1 script is idempotent and supports a -VerifyOnly mode to check that telemetry is arriving without provisioning anything:
.\scripts\setup-monitoring.ps1 -ResourceGroup "my-rg" -AppInsightsName "my-appi" -VerifyOnlyThe scripts/otel-verify.ps1 script exercises 20 MCP tool calls across all categories (blob, queue, table, utility) and reports pass/fail for each, providing confidence that the full telemetry pipeline is working.
Local Development
For local OTel testing, run a collector container and set the endpoint:
# Start collector (requires otel-collector-config.azure.yaml and a connection string)
docker run -d --name otel-collector \
-p 4318:4318 \
-e APPLICATIONINSIGHTS_CONNECTION_STRING="your-connection-string" \
-e OTEL_LOG_MIN_SEVERITY=13 \
-e OTEL_DEPLOYMENT_ENV=dev \
-v $(pwd)/otel/otel-collector-config.azure.yaml:/etc/otelcol-contrib/config.yaml:ro \
otel/opentelemetry-collector-contrib:0.127.0
# Set the endpoint in .env
echo "OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318" >> .envConfiguration Reference
Variable | Required | Default | Description |
| No |
| Server listen port |
| Yes | — | API key for client authentication |
| Yes | — | Azure Storage account name |
| Yes | — | Azure Storage account key |
| No |
| Enable CORS headers for browser-based clients (MCP Inspector, web chat). Set |
| No |
| Default SAS token expiry (hours) |
| No |
| Default SAS permissions |
| No |
| Maximum allowed SAS token lifetime in minutes (ceiling). Requests for |
| No |
| Controls the |
| No |
| Rate limit window in seconds (overrides |
| No |
| Max requests per window for |
| No |
| Max requests per window for |
| No |
| Legacy rate limit window (minutes). Used when |
| No |
| Legacy max requests per window. Used for both endpoints when specific |
| No |
| Number of trusted reverse proxy hops for X-Forwarded-For resolution. Default is |
| No | (unset) | Path to a PEM-encoded TLS certificate file. When set together with |
| No | (unset) | Path to a PEM-encoded TLS private key file. Must be set together with |
| No |
| Minimum TLS protocol version. Accepts |
| No |
| Maximum concurrent stateful MCP sessions (returns 503 when full) |
| No |
| Retry hint (seconds) returned in 503 session-capacity errors |
| No |
| Interval (ms) between SSE keepalive heartbeats. Prevents Azure reverse proxy from killing idle SSE connections (~240s timeout). |
| No |
| Hard byte limit for streaming multipart uploads via |
| No |
| Hard byte limit for JSON request bodies on |
| No |
| Maximum allowed visibility timeout (lease duration) for |
| No | (empty) | Comma-separated list of tool names to disable at runtime. Disabled tools are omitted from |
| No |
| Use Azure Managed Identity instead of shared key authentication. |
Observability
Variable | Default | Description |
| (unset) | OTLP endpoint URL (e.g. |
|
| Telemetry preset: |
|
| Service name reported in traces and metrics. |
| (per preset) | Minimum severity for both console and OTel log output (e.g. |
| (per preset) | Trace sampling ratio ( |
| (per preset) | Metrics export interval in milliseconds. Overrides the preset value. |
|
| Enable PII scrubbing on outbound spans. When |
| (unset) | When set, resource names (container, queue, table, share) in scrubbed telemetry are replaced with a deterministic 16-character HMAC hex digest. This preserves correlation across spans without revealing the actual names to the telemetry backend. Use any string as the key. |
|
| Bicep parameter to deploy the OTel Collector sidecar and Application Insights. |
Note: The Azure deployment uses
minReplicas: 1to keep at least one replica always running, ensuring consistent response times and no cold-start connection drops. The Container App auto-scales up to 5 replicas under load (HTTP concurrency threshold: 20 requests). If you want to reduce costs in a non-production environment, you can setminReplicas: 0ininfra/main.bicep, but be aware that scale-to-zero causes 10-30 second cold starts that may time out HTTP clients like Postman.
Connection Stability (Azure Container Apps)
The deployment includes three mechanisms to ensure reliable connections:
Sticky sessions — The Bicep ingress configures
stickySessions.affinity: 'sticky'withactiveRevisionsMode: 'Single'(required by Azure for sticky session support) so all requests from the same client are routed to the same replica. Without this, stateful MCP sessions (stored in-memory) would break when the load balancer routes a request to a different replica.SSE keepalive heartbeats — Azure Container Apps has a ~240 second idle timeout on ingress connections. SSE streams (used by stateful MCP sessions for server-initiated notifications) that go idle would be silently killed by the reverse proxy. The server sends periodic SSE comments (
: keepalive) every 30 seconds to keep the connection alive. Configure viaSSE_KEEPALIVE_INTERVAL_MS.Stale session detection — If a client sends a
Mcp-Session-Idthat no longer exists (e.g. after server restart, scale event, or TTL expiry), the server returns a clear404error instead of silently falling through to stateless mode. Clients should handle this by sending a newinitializerequest.
Security
Fail-closed authentication -- the server returns 503 if
MCP_API_KEYis not set in the environment; no requests are processed until a key is configuredAPI key authentication -- accepts
X-API-Keyheader orAuthorization: Bearertoken; validated withcrypto.timingSafeEqualfor constant-time comparison to prevent timing attacksNo query-param auth -- API keys are only accepted via headers (not URLs that leak to logs)
Disabled tools -- the
DISABLED_TOOLSenv var restricts tool access at runtime; disabled tools are omitted fromtools/listand return structured"forbidden"errors (withdata.reason: "disabled_tool") when invoked viatools/callSSRF protection --
blob-upload-from-urlvalidates URLs before fetching: blocks loopback, link-local (Azure IMDS 169.254.169.254), private RFC 1918 ranges, non-HTTP schemes, and open redirects (redirect: "error")Streaming uploads --
POST /uploadstreams directly to Azure Blob Storage via busboy +uploadStream(no temp files, no full-file buffering). Capped atMAX_UPLOAD_BYTES(default 5 GiB); oversized files return 413 withcode: "too_large". Rate-limited by the same per-identity limiter as/mcpHelmet -- sets security headers (HSTS, X-Content-Type-Options, X-Frame-Options, etc.)
Rate limiting -- request throttling on both
/mcpand/upload, applied before authentication so failed attempts are counted: requests with the configured API key share the authenticated budget; requests with no key, a wrong key, or any key whileMCP_API_KEYis unset are counted per client address (IPv6 grouped by /56,X-Forwarded-Forbelieved only forTRUST_PROXY_HOPShops), so rotating keys does not open new budgetsLog redaction -- every log record passes a redaction boundary before stdout and OpenTelemetry: credential-named fields (at any depth), Azure account keys and connection-string secrets, SAS signatures and other secret query parameters, URL credentials and bearer tokens are replaced with
[redacted]. The startup banner prints only state words, allowlisted constants, integers and tool names, never paths, URLs or environment textSession TTL -- idle sessions are automatically evicted after 30 minutes
Non-root Docker -- container runs as unprivileged
appuserUser-assigned managed identity -- ACR pull + Storage RBAC with no circular dependency
Secrets in Bicep -- storage keys and API keys are injected as Container App secrets via
@secure()parametersConnection string handling -- Application Insights connection string is stored as a Container Apps secret and redacted from script output
.envgitignored -- credentials never enter version control
Scripts
npm Scripts
Script | Command | Description |
|
| Start dev server with hot reload ( |
|
| Compile TypeScript to |
|
| Run compiled production build |
|
| Run unit tests (no Azure needed) |
|
| Run tests in watch mode |
|
| Run tests with v8 coverage report |
|
| Run Azurite integration tests |
|
| Provision + deploy to dev environment |
|
| Provision dev infrastructure only |
|
| Deploy app to dev only (skip provision) |
|
| Provision + deploy to test environment |
|
| Provision test infrastructure only |
|
| Deploy app to test only (skip provision) |
PowerShell Scripts
Script | Purpose |
Full deployment automation with | |
Idempotent Azure Monitor provisioning and verification ( | |
End-to-end telemetry verification with 20 MCP tool calls | |
Build and push container images to ACR | |
Provision Azure Container Registry | |
Tear down Azure resources |
Testing
Unit Tests (no Azure required)
Unit tests mock all Azure SDK modules and test through a stateless MCP HTTP endpoint using supertest. No Azure credentials or network access needed.
# Run all unit tests
npm test
# Watch mode
npm run test:watch
# With coverage report
npm run test:coverageTest coverage: Config, API key middleware, rate limiting, disabled-tool gating, structured errors, all 43 tools across 5 modules, all 12 resources across 4 modules, format utility (JSON/HTML/MD), OTel instrumentation bootstrap, session attribute extraction, multipart upload endpoint, OTel logger dual-output, TLS termination, PII scrubbing, and metrics utilities.
Integration Tests (Azurite)
Integration tests run against Azurite, the official Azure Storage emulator. They perform real CRUD operations against Blob, Queue, and Table services.
1. Start Azurite
docker compose -f docker-compose.azurite.yml up -d2. Run integration tests
npm run test:integrationThis sets TEST_INTEGRATION=1 and uses the Azurite well-known credentials from .env.test.
3. Stop Azurite
docker compose -f docker-compose.azurite.yml downRunning Integration Tests — Advanced Gating
Integration tests use environment-variable gates to control which test suites run. This keeps default CI fast while still allowing heavy or live-Azure tests on demand.
Gate variable | Default | Effect |
|
| Master gate — set to |
|
| Set to |
|
| Set to |
|
| Size in MiB for the large upload test payload. Only used when |
Azurite SAS protocol: Azurite serves over plain HTTP, so SAS tokens generated with the default SAS_PROTOCOL=https will fail validation. Set SAS_PROTOCOL=https,http in your .env.test or test environment when running SAS-related integration tests against Azurite.
Endpoint overrides: Azurite uses non-standard URLs (http://127.0.0.1:10000/<account>). The integration test environment configures these via:
AZURE_BLOB_SERVICE_URL=http://127.0.0.1:10000/devstoreaccount1
AZURE_QUEUE_SERVICE_URL=http://127.0.0.1:10001/devstoreaccount1
AZURE_TABLE_SERVICE_URL=http://127.0.0.1:10002/devstoreaccount1These are already set in .env.test. For live Azure tests, unset these overrides so SDK clients connect to the real service endpoints.
Example — run large upload tests locally:
docker compose -f docker-compose.azurite.yml up -d
set TEST_INTEGRATION=1&& set TEST_UPLOAD_LARGE=1&& vitest run --config vitest.integration.config.tsCI / GitHub Actions
The .github/workflows/ci.yml workflow runs on every push and PR to main:
Unit tests — Node 20 + 22 matrix, with coverage upload on Node 22
Integration tests — Azurite service container, Node 22, blob/queue/table CRUD
Test Architecture
tests/
├── helpers/mcp-test-harness.ts # createTestApp(), mcpPost(), SSE parsers
├── config.test.ts # getStorageConfig singleton + env vars
├── instrumentation.test.ts # OTel instrumentation bootstrap tests
├── session-attributes.test.ts # Session attribute extraction tests
├── upload.test.ts # Multipart upload endpoint tests
├── middleware/
│ ├── api-key.test.ts # Auth middleware (503/401/403/pass-through)
│ ├── disabled-tools.test.ts # Disabled-tool gating tests
│ └── rate-limit.test.ts # Rate limiting tests
├── tools/ # vi.mock Azure SDKs -> test via MCP endpoint
│ ├── blob-tools.test.ts
│ ├── queue-tools.test.ts
│ ├── table-tools.test.ts
│ ├── fileshare-tools.test.ts
│ ├── utility-tools.test.ts
│ └── structured-errors.test.ts # Error mapping, SAS sanitisation, MCP integration
├── resources/ # vi.hoisted + vi.mock for module-scope clients
│ ├── blob-resources.test.ts
│ ├── queue-resources.test.ts
│ ├── table-resources.test.ts
│ └── fileshare-resources.test.ts
├── utils/
│ ├── format.test.ts # JSON/HTML/MD formatting
│ └── otel-logger.test.ts # OTel logger dual-output tests
└── integration/ # Real CRUD against Azurite (gated by TEST_INTEGRATION)
├── blob-integration.test.ts # Blob CRUD + head + set-tier + versioned reads
├── queue-integration.test.ts # Queue CRUD + update-message + renew-lease
├── upload-integration.test.ts # Streaming upload via POST /upload (large tests gated)
└── table-integration.test.ts # Table CRUD smoke testDocker
Build locally
docker build -t mcp-azure-storage .Run locally
docker run -p 3000:3000 \
-e MCP_API_KEY="your-key" \
-e AZURE_STORAGE_ACCOUNT_NAME="youraccount" \
-e AZURE_STORAGE_ACCOUNT_KEY="yourkey" \
mcp-azure-storageContainer Registry (ACR)
Push the Docker image directly to Azure Container Registry using the included scripts.
Prerequisites
Setup
Set
ACR_NAMEin your.envfile:ACR_NAME=your-acr-nameCreate the registry (one-time):
npm run acr:setup -- -ResourceGroup rg-mcp-storageOptional parameters:
-Location(default:uksouth),-Sku(default:Basic)
Push Image
# Build, scan, and push with 'latest' tag
npm run acr:push
# Push with a specific tag
npm run acr:push:tag -- v1.0.0
# Skip Trivy scan
npm run acr:push -- -SkipScan
# Reuse existing local image (skip build)
npm run acr:push -- -SkipBuildThe push script will:
Login to ACR via Azure CLI
Build the Docker image (multi-stage,
productiontarget)Run a Trivy vulnerability scan (CRITICAL severity — aborts on findings)
Push the image to
<acr-name>.azurecr.io/mcp-azure-storage:<tag>
Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/my-feature)Commit your changes (
git commit -am 'Add my feature')Push to the branch (
git push origin feature/my-feature)Open a Pull Request
License
See LICENSE for details.
For a complete list of third-party open-source libraries and their licences, see THIRD-PARTY-LICENSES.md.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
The agent-native cloud: database, functions, AI, storage, computers. 53 tools. OAuth or API key.
Backend for AI agents: one batched tool over ~668 actions (hosting, storage, auth, payments).
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that exposes core Azure services as read-mostly tools any MCP client can call, including Blob Storage, Key Vault, Service Bus, and Resource Manager.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables secure exposure of internal tools to LLM clients with API-key authentication, tenant isolation, per-tool guardrails, PII scrubbing, rate limiting, audit logging, and telemetry over stdio and HTTP/SSE.MIT
- AlicenseAqualityCmaintenanceEnables developers to expose product operations as model-callable tools over stdio or Streamable HTTP with bearer-token auth, per-client rate limits, host allow-listing, structured call logging, and a swappable backend for secure, testable deployments.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to manage S3-compatible storage through 39 tools covering buckets, objects, versions, policies, CORS, lifecycle, tags, encryption, presigned URLs, and multipart cleanup, either as a shared Streamable HTTP service or a local stdio process. It turns a local file path into a public URL in a single call while keeping storage credentials on the server.MIT