SQL Server MCP Server logo

SQL Server MCP Server

by ian-cowley

A standalone MCP server written in C# that provides SQL Server integration capabilities as an addon to Windsurf IDE. It allows Windsurf to interact with SQL Server databases for schema exploration and query execution.

View on GitHub

Last updated: N/A

What is SQL Server MCP Server?

This is a standalone MCP (Model Context Protocol) server written in C# designed to integrate SQL Server with the Windsurf IDE. It enables Windsurf to interact with SQL Server databases, explore schemas, execute queries, and more.

How to use SQL Server MCP Server?

  1. Build the project using dotnet build. 2. Configure the appsettings.json file with your SQL Server connection details. 3. Configure the MCP server in Windsurf by copying the contents of windsurf_mcp_config.json to your Windsurf MCP configuration file and updating the path to the built executable. 4. Start the server and use Windsurf to interact with your SQL Server instance.

Key features of SQL Server MCP Server

  • SQL Server connectivity

  • Database schema exploration

  • SQL query execution

  • Stored procedure execution

  • Configurable logging

  • Debug mode for troubleshooting

Use cases of SQL Server MCP Server

  • Browsing database schemas within Windsurf IDE

  • Executing SQL queries and viewing results directly in Windsurf

  • Getting code completion for table and column names in Windsurf

  • Running stored procedures from Windsurf

  • Generating SQL code snippets

  • Analyzing database structures

FAQ from SQL Server MCP Server

What is an MCP server?

MCP stands for Model Context Protocol. It's a protocol that allows different tools and IDEs to communicate with each other and share information about models and contexts.

What are the prerequisites for running this server?

You need .NET 9.0 SDK or higher, a SQL Server instance (local or remote), and SQL Server client tools.

How do I configure the connection string?

The connection string is configured in the appsettings.json file under the ConnectionStrings:DefaultConnection setting. Make sure to update it with your SQL Server details.

How do I enable debug logging?

Set the DebugMode setting to true in the appsettings.json file.

What actions are supported by the MCP server?

The server supports actions like connecting to a SQL Server, listing databases, listing tables, getting table columns, listing stored procedures, and executing database queries and stored procedures.