# @codegiveness/mssql-mcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/codegiveness/mssql-mcp  
**GitHub Stars:** 6  
**npm Downloads (last month):** 655  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codegiveness-mssql-mcp

## Description
A Model Context Protocol (MCP) server for Microsoft SQL Server, built in C#/.NET 10. Lets AI agents (Claude Desktop, Cursor, etc.) safely query and interact with SQL Server databases through a controlled tool surface.

## Tools
Capabilities this server exposes over MCP:

- **list_databases** — List all databases with an `is_current` flag (system DBs excluded).
- **list_schemas** — List schemas in the current or specified database.
- **list_objects** — List tables/views/procedures/functions with schema, type, and limit filters (default 1000).
- **get_object_details** — Return columns, parameters, indexes, and triggers for a specific object.
- **execute_sql** — Execute a T-SQL batch. SELECT in Restricted; DML/DDL in Unrestricted.
- **explain_query** — Show the execution plan summary (or raw XML) without executing the query.
- **analyze_indexes** — Missing-index analysis from `sys.dm_db_missing_index_*` DMVs (workload-wide or per-query).
- **get_top_queries** — Top queries by CPU/duration/reads from `sys.dm_exec_query_stats`.
- **analyze_db_health** — Summary health check: size, VLFs, fragmentation, stats staleness, blocking.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mssql-mcp": {
    "command": "npx",
    "args": ["-y","@codegiveness/mssql-mcp"],
    "env": {
      "MSSQL_CONNECTION_STRING": ""
    }
  }
}
```

**Requires environment variables:** `MSSQL_CONNECTION_STRING` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What @codegiveness/mssql-mcp MCP server does

The @codegiveness/mssql-mcp MCP server gives AI agents an MCP interface to Microsoft SQL Server. It is intended for database access through a controlled set of query and interaction tools rather than direct shell or database-driver access from the agent. The project is implemented in C# on .NET 10 and belongs in the 🗄️ Databases category.

Restricted mode is the default access posture. In that mode, the server is read-only, so a recommended deployment uses a SQL login that can only run `SELECT` operations against the databases the agent should see. The server also documents AST validation, transaction rollback, and operation timeouts as safeguards around database requests.

## How it works

The @codegiveness/mssql-mcp MCP server uses MCP over stdio. An MCP client starts the process, passes the SQL Server connection string through the environment, and communicates with the server over standard input and output. This makes it suitable for clients that support local stdio MCP servers.

The package can be started with the scoped npm package on macOS and Linux. Windows uses a framework-dependent distribution and requires the .NET 10 runtime when installed through the npm path; a global .NET tool installation is also available. A Dockerfile is provided for Linux x64 container deployments, and Docker clients must keep standard input open for the stdio transport.

## Setup and configuration

Configure `MSSQL_CONNECTION_STRING` in the MCP client's server environment. The README's example uses SQL Server, database, username, password, encryption, and certificate settings in the connection string. Keep credentials out of command-line arguments and use a least-privilege database identity.

A typical launch command is `npx -y @codegiveness/mssql-mcp`. Windows users can instead install `codegiveness.mssql-mcp` as a global .NET tool and run `mssql-mcp`. The `--validate` option checks the database connection and reports whether validation succeeded. The server can also be built into a Docker image and started with `docker run --rm -i`, passing `MSSQL_CONNECTION_STRING` into the container.

## Tools and capabilities

The @codegiveness/mssql-mcp MCP server provides tools for querying and interacting with Microsoft SQL Server through MCP. The supplied material does not enumerate individual tool names, so tool-level behavior should be confirmed from the repository version being deployed.

Supported authentication includes SQL password authentication and Windows Integrated Authentication. The README states that `Authentication=Active Directory ...` modes are not supported in the current distribution. The npm package selects a platform-specific binary automatically for supported macOS and Linux targets, while Windows uses the .NET 10 runtime or the .NET tool path.

## Limitations and notes

Use the server with an MCP client that supports stdio. The README includes configuration examples for Claude Desktop, Cursor, VS Code/Copilot, Windsurf, Cline/Roo Code, and Continue, but identifies those examples as unverified integrations rather than manual compatibility tests. It reports user-reported production use with Oh My Pi and OpenCode, which are not included in the compatible-client list here.

The server's default restricted mode does not by itself replace database permissions. Configure the connection with only the access the agent needs. Windows npm installations require .NET 10, and Entra authentication modes are unavailable. The package may download a matching binary when an optional platform dependency is missing; `MSSQL_MCP_NO_DOWNLOAD=1` disables that fallback download behavior.

_Full upstream README: https://allmcps.com/mcp/codegiveness-mssql-mcp/readme_

