SQL Server MCP Server
@Popplywop
SQL Server MCP Server - Provides SQL Server database access via Model Context Protocol
Overview
What is SQL Server MCP Server?
SQL Server MCP Server is a Model Context Protocol (MCP) server that provides tools for interacting with SQL Server databases. It allows Large Language Models (LLMs) to query and inspect SQL Server databases through a standardized protocol.
How to use SQL Server MCP Server?
Install the .NET 8.0 SDK, clone the repository, and run dotnet build. The server can be run with a direct connection string using --dsn or by referencing an environment variable with --env-var. Configure the server in your MCP client (e.g., Claude) using the provided JSON configuration, specifying the path to the executable and connection arguments.
Key features of SQL Server MCP Server
- Execute SQL queries and retrieve results
- List tables, views, and stored procedures
- Get schema of a specific table
- Get information about the connected database
- Support for direct or environment variable connection strings
- Command timeout and row limit options
Use cases of SQL Server MCP Server
- Query data from SQL Server using natural language via an LLM
- Inspect database schema to understand table structures
- List available views and stored procedures for documentation
- Retrieve database metadata for troubleshooting or analysis
FAQ from SQL Server MCP Server
What are the prerequisites for running SQL Server MCP Server?
You need the .NET 8.0 SDK or later and a SQL Server instance (local or remote).
How do I provide the database connection string?
You can provide it directly using the --dsn argument or reference an environment variable with the --env-var argument (e.g., SQL_CONNECTION_STRING).
What MCP tools does the server expose?
The server exposes tools for querying (ExecuteQuery), schema inspection (ListTables, GetTableSchema, ListViews, ListStoredProcedures), and database information (GetDatabaseInfo).
What security recommendations are given?
Use a SQL Server account with least privilege, store connection strings securely (avoid source control), prefer environment variables, and enable TLS/SSL for database connections.
What license is SQL Server MCP Server released under?
It is licensed under the MIT License, which permits reuse with minimal restrictions.