Microsoft SQL Server 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., "@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.
mssql-mcp
MCP server (stdio) that connects to Microsoft SQL Server using the mssql driver. Tool arguments are defined and validated with Valibot; JSON Schema for clients is generated with @valibot/to-json-schema.
Implementation note: This project uses the low-level @modelcontextprotocol/sdk Server class rather than McpServer, because the current SDK’s McpServer.registerTool path is built around Zod for schema export and validation. Tools are registered with ListTools / tools/call handlers and Valibot parsing inside the handlers.
Tools
mssql_query— Run a T-SQL batch; returnsrecordsetsandrowsAffected. HonorsMSSQL_MAX_ROWSviaSET ROWCOUNTwhen set.mssql_list_tables— Base tables fromINFORMATION_SCHEMA.TABLES, optional schema filter.mssql_describe_table— Column metadata fromINFORMATION_SCHEMA.COLUMNS.
Environment variables
See .env.example. Required: MSSQL_SERVER, MSSQL_USER, MSSQL_PASSWORD, MSSQL_DATABASE.
MSSQL_ALLOW_WRITES— Default off. When off, a heuristic blocks common write/DDL/exec keywords (not a substitute for DB permissions).MSSQL_MAX_ROWS— When set, wraps batches inSET ROWCOUNTformssql_query.MSSQL_ENCRYPT/MSSQL_TRUST_SERVER_CERTIFICATE— Passed through to the driver (encryptdefaults to true).
Build and run
pnpm install
pnpm run build
pnpm startDevelopment (no separate build):
pnpm devDo not write logs to stdout when running under MCP; the protocol uses stdout. Errors on startup go to stderr via console.error.
Cursor MCP configuration
Use the absolute path to your checkout. Example user MCP config fragment:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/home/adrian/code/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 as command (as above). Do not set command to pnpm or npx: if pnpm fails or prints to stdout, Cursor shows errors like Unexpected token … "ERR_PNPM_"… is not valid JSON because stdout must be JSON-RPC only.
Dev mode without a build (still use node)
Set cwd to this repo so node can resolve tsx from node_modules:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["--import", "tsx", "/home/adrian/code/mcp/src/index.ts"],
"cwd": "/home/adrian/code/mcp",
"env": { }
}
}
}Fill env the same as in the example above. Run pnpm install locally first so tsx exists.
This server cannot be installed
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/AdrianCY/mssql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server