Provides MCP-based access to SQL Server data, schema discovery, and stored procedure management via configurable tools.
Configuration
View docs{
"mcpServers": {
"akashcf-dotnet-mssql-mcp": {
"command": "docker",
"args": [
"run",
"-d",
"--name",
"mssql-mcp",
"-e",
"MSSQL_CONNECTIONSTRING=Server=your_server;Database=your_db;User Id=your_user;Password=your_password;TrustServerCertificate=True;",
"-e",
"EnableExecuteQuery=true",
"-e",
"EnableExecuteStoredProcedure=true",
"akashcf/dotnet-mssql-mcp:latest"
],
"env": {
"EnableExecuteQuery": "true",
"MSSQL_CONNECTIONSTRING": "Server=your_server;Database=your_db;User Id=your_user;Password=your_password;TrustServerCertificate=True;",
"EnableExecuteStoredProcedure": "true"
}
}
}
}You have a Microsoft SQL Server MCP client that lets you run queries, discover schemas, and manage stored procedures through a unified MCP interface. It supports both server-wide operations and database-scoped actions, making it practical to query, explore, and automate SQL Server tasks from your MCP client applications.
Connect your MCP client to the SQL Server MCP client to access tooling for querying data, inspecting schemas, listing databases and tables, and managing stored procedures. You can operate in two modes: server mode, which covers all databases on the server, and database mode, which confines actions to a specific database. Choose the mode based on your connection string: include a database in the connection string for database mode, or omit it for server mode.
Once connected, you can perform practical tasks such as executing ad hoc queries, retrieving table schemas, listing stored procedures, and obtaining parameter details for procedures. Enable or disable potentially sensitive tools to balance security and functionality. For server-wide operations, you can list all databases and all tables across databases. For a targeted database, you can execute queries, view table schemas, and run stored procedures within that database.
Prerequisites you need before installing or running the MCP server.
1) Install .NET 8.0 for local development and deployment.
2) Install Docker if you plan to run the MCP server in a container.
3) Obtain the MCP server image or build locally according to your deployment preference.
Security is layered to protect sensitive operations. By default, SQL query execution and stored procedure execution tools are disabled. You can enable them by setting EnableExecuteQuery and EnableExecuteStoredProcedure to true in your environment or configuration.
Environment variables control the server behavior and connection settings. The MSSQL_CONNECTIONSTRING variable must contain a valid SQL Server connection string. Adjust EnableExecuteQuery and EnableExecuteStoredProcedure as needed to meet your security requirements.
Example environment setup for running in a container.
# Run the MCP server in a container with both execution tools enabled
docker run \
-d \
--name mssql-mcp \
-e "EnableExecuteQuery=true" \
-e "EnableExecuteStoredProcedure=true" \
-e "MSSQL_CONNECTIONSTRING=Server=your_server;Database=your_db;User Id=your_user;Password=your_password;TrustServerCertificate=True;" \
akashcf/dotnet-mssql-mcp:latestIf you want to run in server mode (no specific database in the connection string), provide only the server details in MSSQL_CONNECTIONSTRING. For database mode, include the Database parameter and connect to a single database.
Remember that integrated security may not work from a Docker container, so prefer explicit user credentials in the connection string when running in containerized environments.
The MCP server supports common MCP client workflows via a range of tools. You can prepare for large results with paginated queries or streaming, export and import data to CSV, and explore metadata such as functions, views, and indexes. Access to more sensitive operations can be controlled per tool to maintain security while enabling automation.
Returns detailed information about the capabilities and features of the connected SQL Server instance.
Provides guidance for navigating large result sets using cursors.
Executes a query and returns results in pages.
Streams large query results in chunks.
Exports a table to CSV format.
Imports data from a CSV file into a table.
Executes a SQL script.
Discovers schema, tables, and metadata.
Lists all tables in all databases (server mode).
Lists all databases on the server (server mode).
Gets the schema for a table in a specific database (server mode).
Lists all stored procedures in a database (server mode).
Gets the SQL definition of a stored procedure (server mode).
Gets parameter info for a stored procedure (server mode).
Executes a query in a specific database (server mode).
Executes a stored procedure in a specific database (server mode).
Returns metadata about functions in a database.
Returns metadata about views in a database.
Returns metadata about indexes in a database.
Lists all tables in the connected database (database mode).
Gets the schema for a table in the connected database.
Lists all stored procedures in the connected database.
Gets the SQL definition of a stored procedure in the connected database.
Gets parameter info for a stored procedure in the connected database.
Executes a query in the connected database.
Executes a stored procedure in the connected database.