Microsoft SQL Server MCP
Click on "Deploy 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., "@Microsoft SQL Server MCPshow me the schema for the users table"
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.
@adriancy/mcp-mssql
MCP server (stdio) for Microsoft SQL Server. Exposes tools so Cursor (or any MCP client) can list tables, describe columns, and run read-biased T-SQL.
Use it in Cursor
Open Cursor Settings → MCP (or edit your MCP JSON).
Add a server block. Set
envto your database (see.env.example).
From npm (after the package is published):
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["-y", "@adriancy/mcp-mssql"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_USER": "your_user",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}From a local clone (run pnpm install && pnpm build first):
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/absolute/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_USER": "your_user",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}Use node for local files. Avoid pnpm as the MCP command — extra output on stdout can break the protocol.
Confirm the install name matches npm: npm view @adriancy/mcp-mssql version.
Related MCP server: MSSQL Database MCP Server
Environment
All variables are read from the MCP process environment (e.g. Cursor env). Booleans treat 1, true, yes, on (case-insensitive) as true and 0, false, no, off as false. Invalid boolean and integer values fail startup validation.
Variable | Required | Default | Meaning |
| yes | — | Hostname or IP of SQL Server |
| yes† | — | Login user (SQL auth, NTLM, Azure AD password); not used for |
| yes*† | — | Login password (*may be empty for some setups) |
| yes | — | Initial database |
| no |
| TCP port; omit when using |
| no |
| TLS |
| no |
| Trust self-signed / skip cert validation (dev only) |
| no | — | Hostname for TLS validation when it differs from |
| no | — | Path to CA PEM; passed via |
| no | — | Optional client cert PEM (mutual TLS) |
| no | — | Optional client private key PEM |
| no | — | Passphrase for encrypted client key |
| no | (driver default) | Pool |
| no | — | Domain login ( |
| no | — | Named instance ( |
| no |
| Availability-group style failover hint |
| no |
| Read-only routing for AG secondaries |
| no | — | Tedious |
| no | — | Tedious |
| no |
| Pool max connections |
| no |
| Pool min connections |
| no |
|
|
| no | — |
|
| no |
|
|
| no | — |
|
| no | — |
|
| no‡ | — | Azure AD app (client) ID where required |
| no‡ | — | Tenant ID (optional for password auth, defaults |
| no‡ | — | Service principal secret |
| no‡ | — | Pre-obtained token for access-token auth |
| no |
| If false/unset, blocks common write/DDL/exec patterns in |
| no | (driver default) | Request timeout in ms for the driver. |
† Required for SQL authentication and for auth types that use interactive user login.
‡ Required depending on MSSQL_AUTH_TYPE; see .env.example. NTLM on Node 17+ may need --openssl-legacy-provider (see tedious FAQ).
See also .env.example.
Tools
Tool | Purpose |
| Run T-SQL; returns rows and |
| Tables in |
| Column metadata |
When MSSQL_ALLOW_WRITES is unset/false, obvious write/DDL patterns are blocked (heuristic only; use DB permissions for real safety).
Develop
pnpm install
pnpm check
pnpm test
pnpm build && pnpm start
pnpm devUse pnpm format to apply Biome formatting fixes and pnpm lint to run lint rules without formatting.
Use a read-only or least-privilege SQL login for day-to-day use.
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases through query execution, schema discovery, CRUD operations, stored procedures, and data export with built-in safety controls.18Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with Microsoft SQL Server databases to query data, inspect schemas, and retrieve metadata with read-only operations by default and optional write capabilities.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Microsoft SQL Server databases using both SQL Server and Windows Authentication. It supports flexible connection configurations, including read-only modes and encrypted communication for secure data management.2,404 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases via introspection and query tools. Supports single or multiple databases with read-only mode by default and an optional write capability.446 npm5MIT