Azure SQL
Enterprise-grade MCP server for Azure SQL with Azure AD auth, 34 tools, tiered safety gates, and multi-agent support
Ask AI about Azure SQL
Powered by Claude Β· Grounded in docs
I know everything about Azure SQL. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
mcp-azure-sql
Azure SQL + AI agents. 34 tools. One command.
Enterprise MCP server for Azure SQL & SQL Server.
Azure AD auth β’ Tiered safety gates β’ Zero dependencies β’ Written in Go.
Quick Start
Β Β 1Β Β Add to your AI agent
CLI agents β one command, done:
# Claude Code (Anthropic)
claude mcp add --transport stdio --scope user azure-sql -- npx -y mcp-azure-sql
# Codex CLI (OpenAI)
codex mcp add azure-sql -- npx -y mcp-azure-sql
# Gemini CLI (Google)
gemini mcp add -s user azure-sql npx -y mcp-azure-sql
IDE agents β add this JSON block to your agent's config file:
{
"azure-sql": {
"command": "npx",
"args": ["-y", "mcp-azure-sql"],
"env": {
"AZURE_SQL_CONFIG_FILE": "~/.config/azure-sql-mcp/connections.json"
}
}
}
Where does this go? (click to expand)
| Agent | File | Key |
|---|---|---|
VS Code settings.json | "mcp" > "servers" | |
~/.cursor/mcp.json | "mcpServers" | |
~/.codeium/windsurf/mcp_config.json | "mcpServers" | |
Cline Settings UI or cline_mcp_settings.json | "mcpServers" | |
~/.continue/config.yaml | mcpServers: (YAML) | |
claude_desktop_config.json | "mcpServers" |
Β Β 2Β Β Configure your databases
Create ~/.config/azure-sql-mcp/connections.json:
{
"defaults": { "auth": "azuread" },
"connections": [
{
"name": "dev",
"server": "myserver.database.windows.net",
"database": "myapp-dev",
"environment": "dev"
},
{
"name": "prod",
"server": "myserver.database.windows.net",
"database": "myapp-prod",
"environment": "prod",
"prod": true
}
]
}
See
example-config.jsonfor SQL auth, connection strings, and all options.
Β Β 3Β Β Sign in to Azure
az login
Β Β βΒ Β Done
Restart your AI agent. You now have 34 database tools.
Tools
| Query & Execute | query β’ execute |
| Schema | list_tables β’ describe_table β’ describe_indexes β’ describe_foreign_keys β’ search_columns β’ table_row_counts β’ search_objects β’ describe_triggers |
| Views / Procs / Functions | list_views β’ describe_view β’ list_stored_procs β’ describe_sproc β’ list_functions β’ describe_function |
| Performance | explain_query β’ active_queries β’ long_running_queries β’ top_queries_by_cpu β’ wait_stats β’ blocking_chains β’ index_usage_stats β’ missing_indexes β’ table_statistics_health β’ database_size |
| Connections | list_connections β’ test_connection β’ connection_info β’ add_connection |
| Compliance | compare_tables β’ ef6_migration_status β’ permission_audit β’ hangfire_dashboard |
Safety
Your AI agent cannot accidentally destroy production.
query | execute on dev | execute on prod | |
|---|---|---|---|
| SELECT | β | β | β |
| INSERT / UPDATE / DELETE | β | confirm=true | confirm=true |
| DROP / TRUNCATE / ALTER | β | confirm=true | Blocked |
| EXEC / {call} | β | confirm=true | confirm=true |
Production = any connection with "prod": true or "environment": "prod".
Authentication
| Mode | When to use |
|---|---|
azuread (default) | Azure SQL via az login, managed identity, or service principal |
sql | Legacy SQL Server β add "user" and "password" to connection |
connstr | Custom β add "connection_string" with full connection string |
Why Go?
| Go | TypeScript / Python | |
|---|---|---|
| Startup | ~5ms | 500ms+ |
| Binary | Single 16MB file | Runtime + packages |
| Memory | ~15MB | 80MB+ |
| Install | Download β run | npm install + Node.js |
| Azure AD | Native driver | @azure/identity shim |
| Concurrency | Goroutines | Event loop / GIL |
Configuration reference
Config file
{
"defaults": { "auth": "azuread", "app_name": "my-app" },
"connections": [{
"name": "unique-name",
"server": "server.database.windows.net",
"database": "dbname",
"auth": "azuread",
"environment": "dev",
"description": "Human-readable note",
"prod": false
}]
}
Environment tags: dev sqa qa beta delta test preprod prod
Environment variables
# Legacy (no config file needed)
export AZURE_SQL_CONNECTIONS="dev=server.database.windows.net/mydb;qa=qaserver.database.windows.net/qadb"
# Override production list
export AZURE_SQL_PROD_CONNECTIONS="my-prod-db,my-staging-db"
Architecture
AI Agent ββstdio/JSON-RPCββ> mcp-azure-sql ββAzure ADββ> Azure SQL
β
βββ 34 tools with MCP annotations
βββ Tiered safety (read/write/dangerous)
βββ Connection pool (30s ping skip)
βββ Audit logging
βββ Error sanitization
Built with mcp-go + go-mssqldb. MCP protocol 2024-11-05. Tool annotations (ReadOnlyHint, DestructiveHint, IdempotentHint, OpenWorldHint) on all 34 tools. Logging capability enabled.
Development & releases
go build -o mcp-azure-sql .
go vet ./...
./mcp-azure-sql --version
Release: git tag v1.3.0 && git push origin v1.3.0 β GitHub Actions builds 6 platform binaries via GoReleaser β npm auto-publishes.
