# Mcp Azure Sql

> Enterprise-grade MCP server for Azure SQL with Azure AD auth, 34 tools, tiered safety gates, and multi-agent support

- **Type:** MCP server
- **Install:** `agentstack add mcp-albahubio-mcp-azure-sql`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [albahubio](https://agentstack.voostack.com/s/albahubio)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [albahubio](https://github.com/albahubio)
- **Source:** https://github.com/albahubio/mcp-azure-sql
- **Website:** https://www.npmjs.com/package/mcp-azure-sql

## Install

```sh
agentstack add mcp-albahubio-mcp-azure-sql
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

mcp-azure-sql

  Azure SQL + AI agents. 34 tools. One command.

  &nbsp;
  &nbsp;
  &nbsp;
  &nbsp;
  

  Enterprise MCP server for Azure SQL &amp; SQL Server.
  Azure AD auth &bull; Tiered safety gates &bull; Zero dependencies &bull; Written in Go.

  
  
  
  
  
  
  
  

---

## Quick Start

### &nbsp;&nbsp;1&nbsp;&nbsp; Add to your AI agent

> **CLI agents** &mdash; one command, done:

```bash
# 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** &mdash; add this JSON block to your agent's config file:

```json
{
  "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"` |

### &nbsp;&nbsp;2&nbsp;&nbsp; Configure your databases

Create `~/.config/azure-sql-mcp/connections.json`:

```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.json`](example-config.json) for SQL auth, connection strings, and all options.

### &nbsp;&nbsp;3&nbsp;&nbsp; Sign in to Azure

```bash
az login
```

### &nbsp;&nbsp;&check;&nbsp;&nbsp; Done

Restart your AI agent. You now have 34 database tools.

---

## Tools

Query &amp; Execute
query &bull; execute

Schema
list_tables &bull; describe_table &bull; describe_indexes &bull; describe_foreign_keys &bull; search_columns &bull; table_row_counts &bull; search_objects &bull; describe_triggers

Views / Procs / Functions
list_views &bull; describe_view &bull; list_stored_procs &bull; describe_sproc &bull; list_functions &bull; describe_function

Performance
explain_query &bull; active_queries &bull; long_running_queries &bull; top_queries_by_cpu &bull; wait_stats &bull; blocking_chains &bull; index_usage_stats &bull; missing_indexes &bull; table_statistics_health &bull; database_size

Connections
list_connections &bull; test_connection &bull; connection_info &bull; add_connection

Compliance
compare_tables &bull; ef6_migration_status &bull; permission_audit &bull; hangfire_dashboard

---

## Safety

Your AI agent **cannot** accidentally destroy production.

| | `query` | `execute` on dev | `execute` on prod |
|:--|:--|:--|:--|
| **SELECT** | &check; | &mdash; | &mdash; |
| **INSERT / UPDATE / DELETE** | &cross; | `confirm=true` | `confirm=true` |
| **DROP / TRUNCATE / ALTER** | &cross; | `confirm=true` | **Blocked** |
| **EXEC / {call}** | &cross; | `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 &mdash; add `"user"` and `"password"` to connection |
| **`connstr`** | Custom &mdash; 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 &rarr; run | `npm install` + Node.js |
| Azure AD | Native driver | `@azure/identity` shim |
| Concurrency | Goroutines | Event loop / GIL |

---

Configuration reference

### Config file

```json
{
  "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

```bash
# 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`](https://github.com/mark3labs/mcp-go) + [`go-mssqldb`](https://github.com/microsoft/go-mssqldb). MCP protocol `2024-11-05`. Tool annotations (`ReadOnlyHint`, `DestructiveHint`, `IdempotentHint`, `OpenWorldHint`) on all 34 tools. Logging capability enabled.

Development &amp; releases

```bash
go build -o mcp-azure-sql .
go vet ./...
./mcp-azure-sql --version
```

**Release:** `git tag v1.3.0 && git push origin v1.3.0` &rarr; GitHub Actions builds 6 platform binaries via GoReleaser &rarr; npm auto-publishes.

---

  Albahub, LLC &bull; MIT License

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [albahubio](https://github.com/albahubio)
- **Source:** [albahubio/mcp-azure-sql](https://github.com/albahubio/mcp-azure-sql)
- **License:** MIT
- **Homepage:** https://www.npmjs.com/package/mcp-azure-sql

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-albahubio-mcp-azure-sql
- Seller: https://agentstack.voostack.com/s/albahubio
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
