MCPSqlServer
This project provides a standalone Model Context Protocol server to integrate SQL Server capabilities within Windsurf IDE. It supports database schema exploration, query execution, integration with Windsurf, and handles requests through a JSON protocol, enhancing SQL development workflows.
SQL Server MCP Server for Windsurf IDE
A standalone MCP server written in C# for SQL Server integration with Windsurf IDE.
Features
- SQL Server connectivity
- Database schema exploration
- Table and view inspection
- Column metadata retrieval
- Stored procedure enumeration
- SQL and stored procedure execution
- Debugging and configurable logging
Prerequisites
- .NET 9.0 SDK or higher
- SQL Server instance
- SQL Server client tools
Setup
- Build the project.
- Configure the application with a connection string and other settings.
- Configure the MCP server for Windsurf.
- Set up GitHub integration.
Configuration Options
Configure connection strings, log paths, and debug mode in appsettings.json
.
Publishing
Create a self-contained executable using .NET publish.
Protocol
MCP server uses a JSON-based protocol for communication.
Supported Actions
- Connect to SQL Server
- List databases
- List tables in a database
- Get table columns
- List stored procedures
- Execute database and system queries
- Execute stored procedures
Integration with Windsurf
Enables schema browsing, query execution, code completion, stored procedure execution, and database analysis.
Code Structure
Main components: Program.cs, JsonRpcHandler.cs, configuration files, and logging.
Contributing
- Fork the repository
- Create a feature branch
- Commit and push your changes
- Open a Pull Request
License
Licensed under the MIT License.
Error Handling
Common error codes include invalid_request
, connection_failed
, missing_parameter
, query_execution_error
, database_not_found
, table_not_found
.