sql-assistant-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sql-assistant-mcplist all tables in the database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sql-assistant-mcp
A Model Context Protocol (MCP) server for SQL Server / Azure SQL — query, monitor, and
analyze databases directly from Claude. It is the data plane for the
sql-assistant-agent lineage / reconciliation copilot.
Fork notice. Derived from
@fabriciofs/mcp-sql-server(MIT). The headline addition is Microsoft Entra ID authentication; all original tools are retained. See LICENSE for attribution.
Features
Query Execution —
SELECT/WITHqueries with parameterized inputs (read-only enforced)Schema Exploration — tables, columns, procedures, indexes
Database Monitoring — active queries, blocking, wait stats, connections, sizes
Performance Analysis — missing/unused/duplicate indexes, fragmentation, statistics
Microsoft Entra ID auth —
az login, service principal, managed identity, access token, or Entra passwordWrite Operations —
INSERT/UPDATE/DELETE, registered only whenREADONLY=false
Related MCP server: MCP SQL Server
Installation
This server is run from a local build (not published to npm).
git clone <your-repo-url> sql-assistant-mcp
cd sql-assistant-mcp
npm install # runs the build via the prepare script
npm run build # (re)compile to build/Authentication modes
Set SQL_AUTH_TYPE (default sql). SQL_SERVER + SQL_DATABASE are always required.
| What it does | Required vars (besides server/database) |
| Classic SQL login (original behavior) |
|
| Entra ID via | — (optional |
| Entra app registration |
|
| Entra username + password (non-MFA only) |
|
| Pre-fetched Entra access token |
|
| Azure Managed Identity | — (optional |
The Entra modes acquire tokens through @azure/identity. Azure SQL requires encryption — keep
SQL_ENCRYPT=true. A SQL_CONNECTION_URL is shorthand for sql auth.
Local-dev example (recommended): az login
{
"mcpServers": {
"dash2": {
"command": "node",
"args": ["/abs/path/to/sql-assistant-mcp/build/index.js"],
"env": {
"SQL_SERVER": "your-server.database.windows.net",
"SQL_DATABASE": "Dash2",
"SQL_AUTH_TYPE": "azure-default",
"SQL_ENCRYPT": "true",
"READONLY": "true"
}
}
}
}Run az login once (granting your Entra user access to the DB); the server picks up the
credential automatically.
Service-principal example
{
"env": {
"SQL_SERVER": "your-server.database.windows.net",
"SQL_DATABASE": "Dash2",
"SQL_AUTH_TYPE": "azure-service-principal",
"SQL_AZURE_TENANT_ID": "<tenant-guid>",
"SQL_AZURE_CLIENT_ID": "<app-guid>",
"SQL_AZURE_CLIENT_SECRET": "<secret>",
"READONLY": "true"
}
}SQL login (original behavior)
{
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "mydb",
"SQL_USER": "sa",
"SQL_PASSWORD": "yourpassword",
"READONLY": "true"
}
}See .env.example for the full variable reference.
Other settings
Variable | Default | Description |
| required |
|
|
| Server port |
|
| Encrypt connection (required for Azure SQL) |
|
| Trust self-signed certs (dev only) |
|
| Query timeout ms (max 120000) |
|
| Max rows returned (max 5000) |
|
| Connection pool bounds |
|
|
|
Available Tools
Query
Tool | Description |
| Execute SELECT/WITH queries with parameterized inputs |
Schema
Tool | Description |
| List tables and views |
| Columns, indexes, foreign keys for a table |
| Search columns across tables |
| List stored procedures |
| List indexes with usage stats |
Monitor
Tool | Description |
| Currently running queries |
| Blocking sessions and lock chains |
| Wait statistics |
| Size and file usage |
| Active connections |
| Performance counters |
Analysis
Tool | Description |
| Execution plan and statistics |
| Suggested missing indexes |
| Unused indexes |
| Duplicate/overlapping indexes |
| Index fragmentation |
| Stale statistics |
Write (only when READONLY=false)
Tool | Description |
| Insert a row |
| Update rows (WHERE required) |
| Delete rows (WHERE required) |
Security Considerations
Keep
READONLY=trueunless writes are explicitly required — the read-only validator blocks anything that isn't aSELECT/WITH, plus stacked-query andSELECT INTObypasses.Prefer Entra ID auth over SQL logins; avoid embedding secrets where you can use
azure-default/ managed identity.Grant the principal minimal permissions (read-only DB role for this copilot).
Requirements
Node.js >= 20
SQL Server 2016+ or Azure SQL Database / Managed Instance
Development
npm install # install + build
npm run build # compile
npm run dev # watch compile
npm run typecheck # tsc --noEmit
npm test # vitest
npm run inspector # MCP InspectorLicense
MIT — see LICENSE. Original work © fabriciofs; modifications © Benrishty.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Benrishty/sql-assistant-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server