IC

ian-cowley/mcpsqlserver

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

19 stars 8 forks 品質 69 トレンド 26MIT

SQL Server MCP Server - A standalone MCP server providing SQL Server integration capabilities

概要

A standalone MCP (Model Context Protocol) server written in C# that provides SQL Server integration capabilities for any MCP-compliant IDE or client. - SQL Server connectivity - Database schema exploration - Table and view inspection - Column metadata retrieval - Stored procedure enumeration - SQL query execution - Stored procedure execution - Debug mode for troubleshooting - Configurable logging path - : Automatically resolves and overrides database connection strings dynamically based on the active file in the editor - .NET 10.0 SDK or higher - SQL Server instance (local or remote) - SQL Server client tools 2. Configure the application: - Copy appsettings.example.json to appsettings.json - Update the connection string and other settings in appsettings.json with your SQL Server details 3. Configure the MCP server in your IDE / client: - Add the server configuration to your IDE's MCP config file (e.g., Windsurf, Claude Desktop config, or Cline/Cursor settings).

README

以下は原文 README の抜粋です。原文を見る。

SQL Server MCP Server

A standalone MCP (Model Context Protocol) server written in C# that provides SQL Server integration capabilities for any MCP-compliant IDE or client.

Features

  • SQL Server connectivity
  • Database schema exploration
  • Table and view inspection
  • Column metadata retrieval
  • Stored procedure enumeration
  • SQL query execution
  • Stored procedure execution
  • Debug mode for troubleshooting
  • Configurable logging path
  • Dynamic Project Connection Resolver: Automatically resolves and overrides database connection strings dynamically based on the active file in the editor

Prerequisites

  • .NET 10.0 SDK or higher
  • SQL Server instance (local or remote)
  • SQL Server client tools

Setup

  1. Build the project:
dotnet build
  1. Configure the application:

    • Copy appsettings.example.json to appsettings.json
    • Update the connection string and other settings in appsettings.json with your SQL Server details
    {
      "ConnectionStrings": {
        "DefaultConnection": "Server=your-server;Database=master;User ID=your-username;Password=your-password;TrustServerCertificate=True"
      },
      "LogPath": "C:\\Path\\To\\Your\\LogDirectory\\",
      "DebugMode": "false"
    }
    
  2. Configure the MCP server in your IDE / client:

    • Add the server configuration to your IDE’s MCP config file (e.g., Windsurf, Claude Desktop config, or Cline/Cursor settings).
    • Point the command to the path of your built executable:
    {
      "mcpServers": {
        "sqlMcpService": {
          "command": "path/to/your/MCPSqlServer.exe",
          "args": [],
          "description": "SQL Server MCP Service"
        }
      }
    }
    
  3. Set up GitHub integration:

    • Create a new GitHub repository for your project
    • Initialize a new Git repository in your project directory using git init
    • Add your GitHub repository as a remote using git remote add origin
    • Push your changes to the remote repository using git push -u origin master

Configuration Options

The appsettings.json file contains the following configuration options:

  • ConnectionStrings:DefaultConnection: The SQL Server connection string
  • LogPath: Directory where log files will be stored
  • DebugMode: Set to “true” to enable detailed debug logging
  • AllowWorkspaceOverride: Set to “false” to disable dynamic project connection overrides (defaults to “true”)

Dynamic Project Connection Resolver

In multi-project workspaces where different folders or subprojects connect to different databases, you can avoid updating the main configuration constantly:

  1. All database tools accept an optional currentFilePath parameter (typically automatically populated by the IDE client with the active file’s path).
  2. The server walks up the directory tree from the file’s parent folder looking for the nearest appsettings.json.
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "sqlMcpService": { "command": "path/to/your/MCPSqlServer.exe", "args": [], "description": "SQL Server MCP Service" } } }