mcp-server-mssql
MCP Server for MS SQL Integration - Provides ModelContextProtocol support for Microsoft SQL Server
Documentation
mcp-server-mssql
A Model Context Protocol server that gives LLM agents safe, structured access to Microsoft SQL Server: schema inspection plus row-level CRUD, every operation parameterized and logged.
Built because agents working against real business databases need more than "run this SQL string" — they need typed tools with predictable failure modes.
How it works
flowchart LR
A[MCP clientClaude Desktop / Claude Code] -- stdio --> B[mcp-server-mssql]
B --> C[connection poolmssql driver]
C --> D[(SQL Server)]
B -. structured logs .-> E[logs/]The server connects to a single database configured via environment variables and exposes six tools. All queries are parameterized — table and column names are validated against the live schema before any statement runs, so an agent cannot inject through identifiers.
Tools
| Tool | What it does |
|---|---|
| `list_tables` | List all user tables in the configured database |
| `get_table_schema` | Column names, types, nullability, and defaults for a table |
| `read_table_rows` | Read rows with optional column selection, WHERE filters, ORDER BY, and LIMIT |
| `create_table_records` | Insert one or more rows (column/value validated against schema) |
| `update_table_records` | Update rows matching a filter; returns affected count |
| `delete_table_records` | Delete rows matching a filter; returns affected count |
Example interaction
> User: "Which customers signed up this month?"
>
> Agent calls `list_tables` → finds `Customers` → calls `get_table_schema {"table_name": "Customers"}` → sees `CreatedAt datetime2` → calls `read_table_rows {"table_name": "Customers", "filters": {"CreatedAt": {">=": "2026-07-01"}}, "limit": 50}` → answers with the rows.
Setup
Requires Node.js 18+ and network access to a SQL Server instance.
git clone https://github.com/TerraCo89/mcp-server-mssql.git
cd mcp-server-mssql
npm install
cp .env.example .env # fill in connection details
npm run buildConfiguration (environment variables)
| Variable | Required | Notes |
|---|---|---|
| `MSSQL_HOST` / `MSSQL_PORT` | yes / no | Port defaults to 1433 |
| `MSSQL_USER` / `MSSQL_PASSWORD` | yes | SQL auth credentials |
| `MSSQL_DATABASE` | yes | Single database per server instance |
| `MSSQL_ENCRYPT`, `MSSQL_TRUST_SERVER_CERTIFICATE` | no | TLS options |
| `LOG_LEVEL` | no | `info` by default |
Use with Claude Desktop / Claude Code
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/path/to/mcp-server-mssql/dist/server.js"],
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "agent_reader",
"MSSQL_PASSWORD": "...",
"MSSQL_DATABASE": "MyDb"
}
}
}
}Tip: point it at a least-privilege SQL login — the server can only do what the login can.
Development
npm run dev # ts-node with live reload
npm test # jest test suite (src/*.test.ts, tests/)
npm run build # emit dist/Docker: `docker build -t mcp-server-mssql .` then run with the same environment variables.
License
Frequently asked questions
What is mcp-server-mssql?
mcp-server-mssql is MCP Server for MS SQL Integration - Provides ModelContextProtocol support for Microsoft SQL Server
How do I install mcp-server-mssql?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-server-mssql open source?
Yes — it is hosted on GitHub at https://github.com/TerraCo89/mcp-server-mssql and has 1 stars.
Related MCP tools
🍒 Cherry Studio is a desktop client that supports for multiple LLM providers. Built for the Model Context Protocol to enhance AI capabilities.
Enhanced ChatGPT Clone: Features Agents, MCP, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini...
FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, ...
Composio equips your AI agents & LLMs with 100+ high-quality integrations via function calling for the Model Context Protocol. Enhance AI assistants with powerf
📦 Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Lan...
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Ag...
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP