mssql-mcp
An MCP server that enables interaction with Microsoft SQL Server instances using Windows or SQL Server authentication via native ODBC drivers. It allows users to execute SQL queries, list tables, and inspect schemas across multiple configured database environments through natural language.
README
mssql-mcp
MCP server for Microsoft SQL Server. Supports Windows Authentication and SQL Server Authentication via the native msnodesqlv8 ODBC driver.
Requirements
- Windows (native ODBC driver required)
- ODBC Driver 17 or 18 for SQL Server
- Node.js >= 18
The ODBC driver is auto-detected from the Windows registry — no configuration needed.
Installation
npm install
npm run build
Configuration
All configuration is via environment variables. No .env file is required when running via an MCP host — set env in the MCP config instead.
Authentication
Windows Authentication (use the current Windows user — no credentials needed):
MSSQL_SERVER=myserver
SQL Server Authentication (provide both user and password):
MSSQL_SERVER=myserver
MSSQL_USER=sa
MSSQL_PASSWORD=secret
Note:
MSSQL_USERandMSSQL_PASSWORDmust both be set or both be absent. Setting only one will throw an error.
Multiple servers
Use MSSQL_<KEY>_SERVER to configure multiple servers. Each key becomes a selectable dbKey in the MCP tools.
Windows auth on all servers:
MSSQL_PROD_SERVER=prod-server
MSSQL_QA_SERVER=qa-server
MSSQL_DEV_SERVER=dev-server
Mixed auth:
MSSQL_PROD_SERVER=prod-server
MSSQL_DEV_SERVER=dev-server
MSSQL_DEV_USER=sa
MSSQL_DEV_PASSWORD=secret
Each key can also override the ODBC driver:
MSSQL_PROD_DRIVER=ODBC Driver 18 for SQL Server
Or set a global override for all servers:
MSSQL_DRIVER=ODBC Driver 17 for SQL Server
Optional: port
MSSQL_PORT=1433
# or per-key: MSSQL_PROD_PORT=1433
MCP Host Config
Claude Desktop (claude_desktop_config.json)
Single server — Windows auth:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_SERVER": "your-server"
}
}
}
}
Single server — SQL auth:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_SERVER": "your-server",
"MSSQL_USER": "sa",
"MSSQL_PASSWORD": "secret"
}
}
}
}
Multiple servers:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_PROD_SERVER": "prod-server",
"MSSQL_QA_SERVER": "qa-server",
"MSSQL_DEV_SERVER": "dev-server",
"MSSQL_DEV_USER": "sa",
"MSSQL_DEV_PASSWORD": "secret"
}
}
}
}
VS Code (mcp.json)
{
"servers": {
"mssql": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_SERVER": "your-server"
}
}
}
}
Tools
| Tool | Description |
|---|---|
execute_sql |
Execute any SQL query |
list_tables |
List tables, optionally filtered by schema |
get_table_schema |
Get column definitions for a table |
list_databases |
List configured servers and their auth type |
When multiple servers are configured, each tool accepts a dbKey parameter to select the target server.
Notes
- The LLM should use fully-qualified table names (e.g.
MyDatabase.dbo.Orders) — no database selection is needed in config. - Connection pools are created lazily on first use and reused across calls.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.