mssql MCP server
2026년 11월 13일 커밋기본적으로 읽기 전용 모드, AST 검증 및 트랜잭션 롤백을 지원하여 AI 에이전트가 Microsoft SQL Server를 안전하게 쿼리할 수 있도록 합니다.
다른 이름 codegiveness/mssql-mcp, @codegiveness/mssql-mcp
- 스타
- 7
- Tools
- 18
- 다운로드, 30일
- 698
- 최신 버전
- —
- 마지막 커밋
- 2026년 11월 13일
- 라이선스
- MIT
mssql MCP란?
기본적으로 읽기 전용 모드, AST 검증 및 트랜잭션 롤백을 지원하여 AI 에이전트가 Microsoft SQL Server를 안전하게 쿼리할 수 있도록 합니다. 18개 도구를 제공합니다. 예: list_databases, list_schemas, list_objects.
프로젝트 README에서 생성된 요약
mssql MCP server 정보
mssql-mcp를 사용하면 AI 에이전트를 통해 Microsoft SQL Server 데이터베이스를 더욱 안전하게 쿼리할 수 있습니다. 이 MCP server는 LLM이 SQL 데이터베이스와 상호작용할 수 있는 보안 브릿지를 제공하며, 의도치 않은 명령을 방지하기 위해 읽기 전용 기본 설정과 AST 검증을 사용합니다. 실수로 데이터가 수정되는 위험 없이 AI 클라이언트에 제어된 데이터베이스 접근 권한을 부여하려는 개발자와 데이터 팀을 위해 설계되었습니다.
사용자는 MSSQL_CONNECTION_STRING 환경 변수를 통해 연결 문자열을 제공하여 서버를 설정합니다. macOS 및 Linux를 위한 npx 또는 Windows를 위한 .NET 10 global tool을 포함한 다양한 배포 방식을 지원합니다. 또한 격리된 환경을 위해 Docker 컨테이너 내에서 실행할 수도 있습니다. stdio를 통해 통신하며 Claude Desktop, Cursor, Windsurf와 같은 MCP 클라이언트와 함께 작동합니다.
보안을 최우선으로 고려하여 트랜잭션 롤백 지원 및 타임아웃 관리를 특징으로 합니다. 최소 권한 원칙에 따른 연결 문자열을 사용하면 에이전트가 특정 데이터베이스에서 SELECT 작업만 수행하도록 제한할 수 있습니다. 이를 통해 에이전트가 쓰기 작업을 시도하더라도 제한 모드와 검증 레이어가 보호 역할을 수행합니다.
활용 사례
- 1안전한 데이터베이스 탐색읽기 전용 액세스를 사용하여 AI 에이전트가 데이터베이스 스키마를 조사하거나 특정 행을 검색하도록 요청합니다.
- 2악성 쿼리 방지AST 검증을 사용하여 AI 에이전트가 승인되지 않았거나 잘못된 SQL 명령을 실행하지 않도록 보장합니다.
- 3안전한 자격 증명 관리명령줄 인수가 아닌 환경 변수를 사용하여 AI 클라이언트가 SQL Server에 연결하도록 구성합니다.
- 4컨테이너화된 데이터베이스 액세스의존성 관리 및 격리를 위해 Docker 컨테이너 내에 MCP server를 배포합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
mssql MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 mssql MCP 설치
$ claude mcp add mssql-mcp -- npx -y @codegiveness/mssql-mcpCursor에 mssql MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": [
"-y",
"@codegiveness/mssql-mcp"
]
}
}
}VS Code에 mssql MCP 설치
.vscode/mcp.json
{
"servers": {
"mssql-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codegiveness/mssql-mcp"
]
}
}
}VS Code CLI에 mssql MCP 설치
$ code --add-mcp '{"name":"mssql-mcp","type":"stdio","command":"npx","args":["-y","@codegiveness/mssql-mcp"]}'Claude Desktop에 mssql MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": [
"-y",
"@codegiveness/mssql-mcp"
]
}
}
}Codex에 mssql MCP 설치
$ codex mcp add mssql-mcp -- npx -y @codegiveness/mssql-mcpCodex config.toml에 mssql MCP 설치
~/.codex/config.toml
[mcp_servers.mssql-mcp] command = "npx" args = ["-y", "@codegiveness/mssql-mcp"]
Gemini CLI에 mssql MCP 설치
$ gemini mcp add -s user mssql-mcp npx -- -y @codegiveness/mssql-mcpGemini settings.json에 mssql MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": [
"-y",
"@codegiveness/mssql-mcp"
]
}
}
}mssql MCP 도구 18
README에서 감지됨list_databaseslist_schemaslist_objectsget_object_detailsexecute_sqlexplain_queryanalyze_indexesget_top_queriesanalyze_db_healthdatabaseschematype
| list_databases | — | |
| list_schemas | — | |
| list_objects | — | |
| get_object_details | — | |
| execute_sql | — | |
| explain_query | — | |
| analyze_indexes | — | |
| get_top_queries | — | |
| analyze_db_health | — | |
| database | — | |
| schema | — | |
| type | — |
도구 18개 모두 보기도구 수 줄이기
limitnamesqlformatqueryorder_by
| limit | — | |
| name | — | |
| sql | — | |
| format | — | |
| query | — | |
| order_by | — |
구성
MSSQL_ACCESS_MODEMSSQL_CONNECTION_STRING
| 이름 | 설명 | 유형 |
|---|---|---|
| MSSQL_ACCESS_MODE | — | |
| MSSQL_CONNECTION_STRING | — |
자동 검사
2026년 11월 13일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음@codegiveness/mssql-mcp looks like @benborla29/mcp-server-mysql결함 발견
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 모델에 대한 숨겨진 지침 없음통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
README
GitHub에서 보기mssql-mcp
An MCP server that lets AI agents safely query Microsoft SQL Server — read-only by default, with AST validation, transaction rollback, and timeouts.
Security & trust. The server runs in Restricted mode (read-only) by default. Provide a least-privilege connection string — a SQL login that can only SELECT from the databases you want the agent to see. Secrets are passed via the
MSSQL_CONNECTION_STRINGenvironment variable, never command-line arguments. See SECURITY.md and docs/security-posture.md for the full security posture (OpenSSF Scorecard, SBOM, branch protection, supply-chain attestation).
Contents
- Quick start
- Installation
- Supported clients
- Validate it works
- Why this exists
- Access modes
- Tools
- Examples
- Authentication
- Configuration
- Troubleshooting
- Security
- Development
- Trademarks & licensing
- Contributing
- Stability
- Architecture & decisions
Quick start
1. Verify the binary runs on your machine.
macOS / Linux:
npx -y @codegiveness/mssql-mcp --version
Windows (requires .NET 10 runtime):
dotnet tool install -g codegiveness.mssql-mcp
mssql-mcp --version
You should see the mssql-mcp version printed. If it prints, the install is good. If it fails, see Troubleshooting.
2. Add the server to your MCP client.
For example, a Claude Desktop configuration uses ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows). This is a configuration example, not a recorded manual verification; confirm the location/schema for your client version:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Replace every <...> placeholder with your real SQL Server details. For other clients, see Supported clients below.
3. Validate the connection.
npx -y @codegiveness/mssql-mcp --validate
Prints [startup] Connection validated successfully. — you're done. See Validate it works for what to do if it fails.
Installation
The Quick start above covers the common path. This section covers platform details, Docker, and Windows-specific notes.
Platform matrix
| RID | Self-contained | Archive | Notes |
|---|---|---|---|
linux-x64 |
yes | .tar.gz |
npx -y @codegiveness/mssql-mcp just works |
linux-arm64 |
yes | .tar.gz |
npx -y @codegiveness/mssql-mcp just works |
osx-x64 |
yes | .tar.gz |
Intel Macs |
osx-arm64 |
yes | .tar.gz |
Apple Silicon |
win-x64 |
no (framework-dependent) | .zip |
Requires .NET 10 runtime; dotnet tool install is the recommended path |
Windows retains the existing framework-dependent distribution and requires .NET 10. All platforms now use managed SNI; native SNI assets are explicitly excluded even from framework-dependent and NuGet tool packages. Windows selects SqlClient's managed networking switch. See Architecture & decisions.
The Entra authentication extension was removed from unreleased builds because its
native broker dependency prohibits redistribution. SQL password and Windows
Integrated Authentication remain supported; Authentication=Active Directory ...
modes are no longer supported. See Authentication.
How the binary is delivered
The npm package uses per-platform optionalDependencies (@codegiveness/mssql-mcp-<rid>) — npm's dependency resolution installs the matching package automatically, no postinstall script involved. This works even with --ignore-scripts.
The shim (npm/bin/mssql-mcp.js) runs on every invocation:
- Resolves the per-platform optional dependency via
require.resolveand execs the binary directly (happy path). - If the optional dependency is absent (
--no-optional, corporate mirrors), checks the cache at~/.mssql-mcp/bin/<version>/<rid>/. If cached, execs it. - If not cached, downloads the flat archive from the matching GitHub Release, verifies the
.sha256sidecar, extracts,chmod 755(Unix), caches, and execs. SetMSSQL_MCP_NO_DOWNLOAD=1to skip the download attempt.
Every failure mode prints the RID, the GitHub Releases URL for manual download, and the dotnet tool install -g codegiveness.mssql-mcp fallback.
Docker
A Dockerfile is included for containerized deployments (Linux x64, self-contained):
docker build -t mssql-mcp .
docker run --rm -e MSSQL_CONNECTION_STRING="Server=...;Database=...;User Id=...;Password=...;Encrypt=True;TrustServerCertificate=True;" mssql-mcp --validate
To point your MCP client at the Docker image, use docker as the command:
{
"mcpServers": {
"mssql-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "MSSQL_CONNECTION_STRING", "mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
The -i flag keeps stdin open for the MCP stdio transport. The image must be built first: docker build -t mssql-mcp .
Windows note
npx -y @codegiveness/mssql-mcp on Windows delivers a framework-dependent build via optionalDependencies. The build requires the .NET 10 runtime to be installed. If the runtime is missing, the shim prints a clear error with the download URL and the dotnet tool install fallback. If you don't want to install the runtime, install the .NET tool instead:
dotnet tool install -g codegiveness.mssql-mcp
Supported clients
mssql-mcp uses MCP over stdio and is designed to work with compatible harnesses (MCP client applications). The user reports successful production use with Oh My Pi and OpenCode. This is user-reported evidence, not a dated 30-day usage log or a recorded verification of specific OS versions, client versions, configuration paths, or logs.
Evidence limits: the automated MCP stdio smoke check exercises initialization, tool discovery, and a real SQL Server tool call. It does not verify each GUI harness. In particular, the six historical examples—Claude Desktop, Cursor, VS Code/Copilot, Windsurf, Cline/Roo Code, and Continue—are configuration examples, not claimed manually verified integrations. The other snippets below are examples as well. Confirm your installed client's current configuration schema and file location, then replace the <...> placeholders with your SQL Server details. Manual six-harness verification is no longer a release gate; see ADR-0036.
The placeholder connection string used throughout is:
Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;
Windows / dotnet tool users: If you installed via
dotnet tool install -g codegiveness.mssql-mcp, replace"command": "npx"and"args": ["-y", "@codegiveness/mssql-mcp"]with"command": "mssql-mcp"(noargs) in any snippet below.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Claude Code
Edit ~/.claude.json (user-level) or .mcp.json in your project root:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Cursor
Edit ~/.cursor/mcp.json (macOS/Linux) or %USERPROFILE%\.cursor\mcp.json (Windows):
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
VS Code / GitHub Copilot
Edit .vscode/mcp.json in your workspace (or ~/.vscode/mcp.json for global):
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Windsurf
Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Cline / Roo Code
Edit ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json (VS Code extension path):
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Continue
Edit ~/.continue/config.json:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
OpenCode
Edit ~/.config/opencode/opencode.json (user-level) or opencode.json in your project root. opencode uses a "mcp" key (not "mcpServers"), "command" as an array, and "environment" (not "env"):
{
"mcp": {
"mssql-mcp": {
"type": "local",
"command": ["npx", "-y", "@codegiveness/mssql-mcp"],
"enabled": true,
"environment": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Codex CLI
Edit ~/.codex/config.toml:
[mcp_servers.mssql-mcp]
command = "npx"
args = ["-y", "@codegiveness/mssql-mcp"]
[mcp_servers.mssql-mcp.env]
MSSQL_CONNECTION_STRING = "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
Gemini CLI
Edit ~/.gemini/settings.json:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Antigravity IDE
Edit ~/.gemini/antigravity/mcp_config.json:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Hermes Agent
Edit ~/.hermes/config.yaml:
mcp_servers:
mssql-mcp:
command: npx
args:
- "-y"
- "@codegiveness/mssql-mcp"
env:
MSSQL_CONNECTION_STRING: "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
Kiro
Edit ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
Zed
Edit ~/.config/zed/settings.json (macOS/Linux) or %APPDATA%\Zed\settings.json (Windows). The mssql-mcp server goes under assistant.mcp_servers:
{
"assistant": {
"mcp_servers": {
"mssql-mcp": {
"command": "npx",
"args": ["-y", "@codegiveness/mssql-mcp"],
"env": {
"MSSQL_CONNECTION_STRING": "Server=<your-server>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;Encrypt=True;TrustServerCertificate=True;"
}
}
}
}
}
Validate it works
After adding the config, run --validate from your terminal. This proves the server can start and connect to SQL Server — without needing the harness at all:
npx -y @codegiveness/mssql-mcp --validate
What success looks like:
[startup] Connection validated successfully.
Exit code 0. The binary runs, the connection string is valid, and SQL Server accepted it.
What failure looks like:
[startup] Connection validation failed [tag]: <obfuscated error>
Exit code 1. The tag tells you the category:
| Tag | Meaning | Next step |
|---|---|---|
timeout |
Server didn't respond in time | Check the hostname/port, firewall rules, and that SQL Server accepts TCP connections. |
connection |
Network-level failure (refused, DNS, etc.) | Verify the Server= value, that SQL Server is running, and that port 1433 (or your custom port) is reachable. |
auth |
Login failed | Double-check User Id and Password, or the Windows identity and database grants for Integrated Authentication. |
certificate |
TLS/SSL handshake failed | See Troubleshooting: connection / login failed below — usually TrustServerCertificate=True is needed for self-signed certs. |
If --validate passes but your harness can't see the server, the problem is in the harness config — see Troubleshooting: agent can't see the server.
Why this exists
mssql-mcp gives AI agents a small, well-typed tool surface backed by AST validation, rollback wrappers, timeouts, and a byte-size transport safety net. Use a least-privilege SQL login: application checks are not a database authorization boundary.
| Feature | mssql-mcp |
|---|---|
| Guardrails | AST validation + transaction rollback |
| Destructive SQL | Rejected by the Guard by default |
| Tool surface | 9 typed tools |
| Transport safety | Byte-size limit on stdio |
| Language | C#/.NET 10 |
| Target DB | SQL Server |
Access modes
mssql-mcp ships in two modes, selected at startup via --access-mode or MSSQL_ACCESS_MODE. Only the case-insensitive names restricted and unrestricted are accepted; numeric and combined enum values are rejected:
- Restricted (default) — read-only. The Guard enforces an AST allowlist, wraps every query in
BEGIN TRAN ... ROLLBACK, applies a per-query command timeout, and truncates oversized results with a notice. All tools carryreadOnlyHint=true. This is the mode to use with AI agents. - Unrestricted (opt-in) — full DML/DDL via
execute_sql. The Guard is bypassed forexecute_sql, destructive operations carrydestructiveHint=true, and the default query timeout is unlimited. Use this only when the human operator has explicitly authorized schema changes or writes.explain_queryis still Guarded in both modes (it never executes the query).
mssql-mcp --access-mode unrestricted
# or
MSSQL_ACCESS_MODE=unrestricted mssql-mcp
Tools
Nine tools, all readOnlyHint=true in Restricted mode. execute_sql gains destructiveHint=true in Unrestricted mode.
| Tool | Description |
|---|---|
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. |
For full input schemas and return shapes, see ADR-0016.
list_databases
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (none) |
Returns: JSON array of {name, is_current} objects (system DBs excluded).
list_schemas
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
database |
string | no | current db | Database to list schemas in (cross-DB-validated) |
Returns: JSON array of {name, schema_id} objects.
list_objects
| Parameter | Type | Required | Default | Max | Description |
|---|---|---|---|---|---|
database |
string | no | current db | — | Cross-DB-validated |
schema |
string | no | all | — | Filter by schema name |
type |
enum | no | all | — | TABLE, VIEW, PROCEDURE, FUNCTION |
limit |
int | no | 1000 | 5000 | Protects agent context window |
Returns: JSON array of {name, schema, type} objects. Truncation notice prepended if limit hit.
get_object_details
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
database |
string | no | current db | Cross-DB-validated |
schema |
string | yes | ||
name |
string | yes | ||
type |
enum | no | auto | Same enum as list_objects |
Returns: Columns, parameters, indexes, and triggers for the object. Returns OBJECT_NOT_FOUND error if no match.
execute_sql
| Parameter | Type | Required | Description |
|---|---|---|---|
sql |
string | yes | Single T-SQL batch. Guard validates in Restricted mode. |
Returns: JSON array of row objects (SELECT) or status objects (DML/DDL in Unrestricted mode).
explain_query
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sql |
string | yes | The query to get an execution plan for | |
format |
enum | no | summary |
summary or xml |
Returns: summary — JSON object with estimated cost, missing indexes, warnings, top 5 ops. xml — raw SHOWPLAN_XML. Never executes the query.
analyze_indexes
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
database |
string | no | current db | Cross-DB-validated |
query |
string | no | none | If provided, per-query analysis; if omitted, workload-wide |
Returns: JSON array of missing-index recommendations from sys.dm_db_missing_index_* DMVs.
get_top_queries
| Parameter | Type | Required | Default | Max | Description |
|---|---|---|---|---|---|
database |
string | no | current db | — | Cross-DB-validated |
order_by |
enum | no | avg_cpu |
— | avg_cpu, total_cpu, avg_duration, total_duration, total_logical_reads, execution_count |
limit |
int | no | 10 | 100 |
Returns: JSON array of top queries from sys.dm_exec_query_stats.
analyze_db_health
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
database |
string | no | current db | Cross-DB-validated |
Returns: JSON array of 5 summary objects (size, VLF count, fragmentation, stats staleness, blocking).
Examples
list_databases
Agent calls:
{"method": "tools/call", "params": {"name": "list_databases"}}
Server returns:
[
{"name": "mydb", "is_current": true},
{"name": "reporting", "is_current": false}
]
execute_sql
Agent calls:
{"method": "tools/call", "params": {"name": "execute_sql", "arguments": {"sql": "SELECT TOP 5 id, name FROM Users"}}}
Server returns:
[
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"},
{"id": 3, "name": "Carol"},
{"id": 4, "name": "Dave"},
{"id": 5, "name": "Eve"}
]
explain_query
Agent calls:
{"method": "tools/call", "params": {"name": "explain_query", "arguments": {"sql": "SELECT * FROM Orders WHERE customer_id = 42"}}}
Server returns:
{
"estimatedTotalCost": 0.0033,
"missingIndexes": [],
"warnings": [],
"topOperations": [
{"operation": "Index Seek", "estimatedCost": 0.0033, "estimatedRows": 1, "object": "AppDb.dbo.Orders.PK_Orders"}
]
}
mssql MCP 질문
mssql MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add mssql-mcp -- npx -y @codegiveness/mssql-mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
mssql MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
mssql MCP는 어떤 도구를 제공하나요?
18개 도구를 제공합니다. 예: list_databases, list_schemas, list_objects, get_object_details, execute_sql.
기본적으로 서버가 안전한가요?
네, 안전을 보장하기 위해 서버는 기본적으로 Restricted mode(읽기 전용)로 실행됩니다.
데이터베이스 자격 증명은 어떻게 제공하나요?
비밀 정보는 명령줄 인수가 아닌 MSSQL_CONNECTION_STRING 환경 변수를 통해 전달해야 합니다.
Windows Integrated Authentication를 지원하나요?
네, Windows Integrated Authentication를 지원합니다. 단, Entra 인증은 제거되었습니다.
연결이 잘 작동하는지 어떻게 확인하나요?
검증 명령을 실행하여 연결 성공 여부를 확인할 수 있습니다.