MCP ExplorerExplorer

Mcp Sqlserver

@RodrigoPAmlon a year ago
8 MIT
FreeCommunity
AI Systems
#llm#mcp-server#sql-server
A MCP Server implementation in C# for LLM integration with SQL Server tested with Claude Desktop

Overview

What is Mcp Sqlserver

MCP-SqlServer is a C# implementation of a MCP Server designed for integrating Large Language Models (LLMs) with Microsoft SQL Server, tested specifically with Claude Desktop.

Use cases

Use cases include checking database connectivity, retrieving schema information, executing read queries, and performing database modifications through LLMs.

How to use

To use MCP-SqlServer, fill in the connection string for your SQL Server in the env.database file, compile the project, configure MCP settings in Claude Desktop, and restart the application.

Key features

Key features include HealthCheck for verifying database connections, GetTablesWithColumnsAndTypes for retrieving table schemas, and a Query tool for executing SQL queries and returning results in JSON format.

Where to use

MCP-SqlServer is suitable for applications that require interaction between LLMs and SQL databases, particularly in data analysis, reporting, and automated database management.

Content

MCP-SqlServer

A MCP Server (STDIO) implementation in C# for LLM integration with SQL Server tested with Claude Desktop

The server register logs into a mcp_server.log file

Caution, the LLM can modify your database

Tools

List of tools provided to the LLM

  • HealthCheck: Tests if the Microsoft SQL Server Database connection is good and alive.
  • GetSchema: Get a list of all tables with their respective schema, columns and types.
  • Query: Execute a query into the Microsoft SQL Server database and return the result as a JSON.

Setup with Claude

  1. Fill the env.database with the connection string from your SQL Server
  2. Compile the project
  3. In the Claude Destkop Go File->Configurations->Developer and edit the MCP configuration (claude_desktop_config.json)
  4. Paste the json as:
{
  "mcpServers": {
    "database": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "C:\\Users\\{USER}\\Desktop\\MCP-SqlServer",
        "--no-build"
      ]
    }
  }
}
  1. Restart Claude Desktop

Testing

Open Claude Desktop and if everything is configured well you should be able to see this

image

Click on the icon and you should be able to see the tools

image

Asking for connection check

image

Asking for schema/table informations

image

Asking for read query

image

Asking for modifications

image

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers