Registry / database / mssql-mcp-node

mssql-mcp-node

JSON →
library3.0.0jsnpmunverified

MCP server for Microsoft SQL Server (v3.0.0) providing 11 introspection and query tools, table resources, and guided prompts. Supports single and multi-database modes, read-only by default with opt-in write support, and runs over stdio or Streamable HTTP. Breaking changes from v2.x include renamed tools, persistent connection pooling, and removal of bespoke REST API.

npm install mssql-mcp-node
INSTALL
IMPORT
SIG · MSSQL-MCP-NODE
M
mssql-mcp-node
databasejavascriptv3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

McpServer
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
const { McpServer } = require('@modelcontextprotocol/sdk')
ESM-only package, requires .js extension in import
StdioServerTransport
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
import StdioServerTransport from '@modelcontextprotocol/sdk/server/stdio.js'
Named export, not default
StreamableHTTPServerTransport
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/http.js'
Note the 'streamable' prefix and exact filename

Creates an MCP server for MSSQL with one tool and connects over stdio.

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; const server = new McpServer({ name: "mssql", version: "3.0.0" }); server.tool("list_databases", {}, async () => { return { content: [{ type: "text", text: "Databases listed" }] }; }); const transport = new StdioServerTransport(); await server.connect(transport);
Debug
Known issues
breakingexecute_sql renamed to execute_read_query + execute_write_query
fix
Use execute_read_query for read-only and execute_write_query for writes (requires MSSQL_ENABLE_WRITES=true)
affects: >=3.0.0
breakingget_table_schema renamed to describe_table
fix
Call describe_table instead of get_table_schema
affects: >=3.0.0
breakingConnection pool now per-dbKey and reused; old code each call created a new pool
fix
No action needed, but connections are now reused. Ensure pool cleanup on server shutdown.
affects: >=3.0.0
breakingBespoke REST API removed in favor of Streamable HTTP at POST /mcp
fix
Switch to MCP client sending POST requests to /mcp endpoint
affects: >=3.0.0
gotchaMSSQL_ENABLE_WRITES must be set to true to allow write queries; default is read-only
fix
Set environment variable MSSQL_ENABLE_WRITES=true to enable execute_write_query
affects: >=3.0.0
gotchaMulti-database mode conflicts with single-database mode if both sets of env vars are present
fix
Use only single-database MSSQL_* variables OR multi-database MSSQL_<NAME>_* variables, not both
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module '@modelcontextprotocol/sdk'
Missing dependency or incorrect install
fix
npm install @modelcontextprotocol/sdk
TypeError: Class extends value undefined is not a constructor or null
Incorrect import of McpServer or Transport
fix
Ensure correct import path: import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
Error: listen EADDRINUSE :::3000
Port 3000 already in use
fix
Kill the process using port 3000 or set a different port via environment variable
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
@modelcontextprotocol/sdkrequiredCore SDK for implementing the MCP protocol
Agent activity
2 hits · last 30 days
node
2
Resources
mssql-mcp-node — npm install mssql-mcp-node · libregistry