mcp node mssql
A Model Context Protocol server that enables AI assistants (Cursor, Windsurf, Claude Code) to interact with Microsoft SQL Server databases by providing connectivity through environment-configurable connections.
A Model Context Protocol server that enables AI assistants (Cursor, Windsurf, Claude Code) to interact with Microsoft SQL Server databases by providing connectivity through environment-configurable connections.
See the official Cursor docs for more information.
mcp.json
file (it should be in ~/.cursor/mcp.json
or <project-root>/.cursor/mcp.json
, but see Cursor docs for more details).{
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}
See the official Windsurf docs for more information.
Windsurf MCP Configuration Panel
Add custom server
.{
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}
See the official Claude Code docs for more information.
You can add a new MCP server from the Claude Code CLI. But modifying the json file directly is simpler!
~/.claude.json
).projects
> mcpServers
section and add the following details and save the file:{
"projects": {
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}
}
Before doing anything else, please make sure you are running the latest version!
If you run into problems using this MCP server, please open an issue on GitHub!
npm install
npm run build
To test your local development version of the MCP server rather than using the published package, follow these steps:
Build the project:
npm run build
Create or modify your mcp.json
file to reference your local build:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": [
"/path/to/your/local/mcp-node-mssql/dist/index.js"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}
Place this mcp.json
file in one of the following locations:
~/.cursor/mcp.json
) or in your project directory (.cursor/mcp.json
)For Windsurf: Use the MCP Configuration Panel to add the custom server
Restart your AI assistant (Cursor or Windsurf) to load the new configuration.
This allows you to instantly test changes to the MCP server without having to publish a new version.
[
{
"description": "Get a list of all tables in the database",
"name": "get-tables",
"parameters": {
"additionalProperties": false,
"properties": null,
"required": null,
"type": "object"
}
},
{
"description": "Get a specific table by name",
"name": "get-table",
"parameters": {
"additionalProperties": false,
"properties": {
"tableName": {
"description": "The name of the table to retrieve",
"type": "string"
}
},
"required": [
"tableName"
],
"type": "object"
}
},
{
"description": "Get a list of all stored procedures in the database",
"name": "get-stored-procedures",
"parameters": {
"additionalProperties": false,
"properties": null,
"required": null,
"type": "object"
}
},
{
"description": "Get a specific stored procedure by name",
"name": "get-stored-procedure",
"parameters": {
"additionalProperties": false,
"properties": {
"procedureName": {
"description": "The name of the stored procedure to retrieve",
"type": "string"
}
},
"required": [
"procedureName"
],
"type": "object"
}
},
{
"description": "Query the database with a SQL statement",
"name": "query",
"parameters": {
"additionalProperties": false,
"properties": {
"query": {
"description": "The SQL query to execute",
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
}
},
{
"description": "Start a new transaction",
"name": "start-transaction",
"parameters": {
"additionalProperties": false,
"properties": null,
"required": null,
"type": "object"
}
},
{
"description": "Commit a transaction",
"name": "commit-transaction",
"parameters": {
"additionalProperties": false,
"properties": {
"transactionId": {
"description": "The ID of the transaction to commit.",
"type": "string"
}
},
"required": [
"transactionId"
],
"type": "object"
}
},
{
"description": "Rollback a transaction",
"name": "rollback-transaction",
"parameters": {
"additionalProperties": false,
"properties": {
"transactionId": {
"description": "The ID of the transaction to rollback.",
"type": "string"
}
},
"required": [
"transactionId"
],
"type": "object"
}
}
]