MCP.so
Sign In

SQL Server MCP (MCP) Server

@MCPRUNNER

Basic information

Category

Databases

Transports

stdio

Author

MCPRUNNER

About SQL Server MCP (MCP) Server

MCP Server for MSSQL (Microsoft SQL Server)

SQL Server MCP (MCP) Server config

No standard config provided

This server doesn't expose a parseable MCP config block in its README. See the repository for install instructions.

Repository

SQL Server MCP (MCP) Server tools

4

Initializes the SQL Server connection

Executes a SQL query and returns results as JSON

Retrieves metadata about database tables, columns, keys, etc. You can filter by schema or get all schemas.

Retrieves metadata about tables, views, stored procedures and functions, including schemas, columns, and relationships.

Overview

What is SQL Server MCP Server?

This is a Model Context Protocol (MCP) server that connects to one or more SQL Server databases. It is designed to be used by Visual Studio Code as a Copilot Agent, enabling LLM‑driven SQL query execution and database metadata retrieval.

How to use SQL Server MCP Server?

The server requires .NET 9.0 SDK and a running SQL Server instance (local or remote). Set mandatory environment variables MSSQL_MCP_KEY and MSSQL_MCP_API_KEY before starting. Use the provided PowerShell script Start-MCP-Encrypted.ps1 or run the Docker image from mcprunner/mssqlmcp. Client applications authenticate via the API key in HTTP headers and interact using MCP tools such as connectionManager/list, GetTableMetadata, and GetDatabaseObjectsMetadata.

Key features of SQL Server MCP Server

  • SQL query execution through MCP tools
  • Comprehensive database metadata retrieval (tables, views, stored procedures, functions)
  • Detailed schema information including primary/foreign keys
  • Connection string encryption with AES‑256
  • Key rotation and security management support
  • Persistent connection storage via SQLite database
  • Robust logging with Serilog and clean architecture

Use cases of SQL Server MCP Server

  • Enable Visual Studio Code Copilot to query SQL Server databases
  • Retrieve database schema for code generation or documentation
  • Securely manage multiple database connections in one place
  • Automate database operations through MCP tool calls

Frequently asked questions

1

What runtime dependencies are required?

Requires .NET 9.0 SDK and a SQL Server instance (local or remote). Visual Studio Code with the Copilot extension is recommended for the intended use case.

2

How are connection strings secured?

Connection strings are encrypted using AES‑256 with a master key provided via the `MSSQL_MCP_KEY` environment variable. Key rotation is supported through dedicated PowerShell scripts.

3

Where are database connections stored?

Connections are stored persistently in a local SQLite database at `Data/connections.db`. The data directory location can be overridden with the `MSSQL_MCP_DATA` environment variable.

4

How do I authenticate to the server?

API key authentication is used via HTTP headers. The API key is set using the `MSSQL_MCP_API_KEY` environment variable or generated and configured with the `Set-Api-Key.ps1` script.

5

What database objects can the server retrieve metadata for?

Metadata can be retrieved for tables, views, stored procedures, and functions. Objects can be filtered by type (TABLE, VIEW, PROCEDURE, ALL) and by schema.

Comments

More Databases MCP servers