mcp-server-mssql
This server provides a Model Context Protocol (MCP) interface for safe, structured access to Microsoft SQL Server databases, allowing LLM agents to inspect schemas and perform CRUD operations. All queries are parameterized and validated against the live schema to prevent SQL injection, and all operations are logged.
list_tables: List all user tables in the database, with an optional schema name filter.get_table_schema: Retrieve column names, data types, nullability, and defaults for a specific table.read_table_rows: Query rows with optional column selection, WHERE filters (supporting operators like>=,=, etc.), ORDER BY (ASC/DESC), and LIMIT/OFFSET pagination.create_table_records: Insert one or more rows, with column and value validation against the live schema.update_table_records: Update rows matching specified filter conditions; returns the number of affected rows.delete_table_records: Delete rows matching specified filter conditions; returns the number of affected rows.
It is designed to integrate with MCP clients like Claude Desktop or Claude Code, connecting via stdio.
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., "@mcp-server-mssqllist all tables in the database"
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.
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 client<br/>Claude Desktop / Claude Code] -- stdio --> B[mcp-server-mssql]
B --> C[connection pool<br/>mssql 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.
Related MCP server: MCP Databases Server
Tools
Tool | What it does |
| List all user tables in the configured database |
| Column names, types, nullability, and defaults for a table |
| Read rows with optional column selection, WHERE filters, ORDER BY, and LIMIT |
| Insert one or more rows (column/value validated against schema) |
| Update rows matching a filter; returns affected count |
| Delete rows matching a filter; returns affected count |
Example interaction
User: "Which customers signed up this month?"
Agent calls
list_tables→ findsCustomers→ callsget_table_schema {"table_name": "Customers"}→ seesCreatedAt datetime2→ callsread_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 |
| yes / no | Port defaults to 1433 |
| yes | SQL auth credentials |
| yes | Single database per server instance |
| no | TLS options |
| no |
|
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
Maintenance
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
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/TerraCo89/mcp-server-mssql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server