mcp-dotnet-mssql

little-fort/mcp-dotnet-mssql

3.3

If you are the rightful owner of mcp-dotnet-mssql and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

mcp-dotnet-mssql is a Model Context Protocol server implementation for Microsoft SQL Server, built on .NET 9.

.NET MCP Server for Microsoft SQL Server

mcp-dotnet-mssql is a Model Context Protocol (MCP) server implementation for Microsoft SQL Server, built on .NET 9. It enables clients to interact with SQL Server databases via the MCP JSON-RPC API, providing schema introspection, query execution, and data streaming capabilities for agentic LLM tools.

Features

  • Support for direct connections to Microsoft SQL Server
  • Dynamic schema and metadata introspection
  • CSV export of query results for improved performance over JSON
  • Configurable permissions for write access and database visibility

Usage

Release Package

Begin by downloading the latest version from the Releases page and extract the archive into a directory of your choice.

Connect any MCP-compatible client to the server binary like so:

"mcp-dotnet-mssql": {
    "type": "stdio",
    "command": "C:/download/mcp-dotnet-mssql-win-x64/mcp-dotnet-mssql.exe",
    "env": {
        "DB_DATASOURCE": "localhost",
        "DB_INITIAL_CATALOG": "MyDatabase",
        "DB_USER": "user",
        "DB_PASSWORD": "password",
        "DB_ALLOW_MULTI": "false",
        "DB_ALLOW_WRITE": "false"
    }
}

Use the client to send MCP requests for schema listing, query execution, and data retrieval.

Source

Begin by downloading the source directly, or by using git to clone the repository:

# Clone the repository
git clone https://github.com/littlefort/mcp-dotnet-mssql.git
cd mcp-dotnet-mssql/src/mcp-dotnet-mssql

# Restore dependencies and build
dotnet restore
dotnet build --configuration Release

You can then connect your MCP-compatible client to the project like so:

"mcp-dotnet-mssql": {
    "type": "stdio",
    "command": "dotnet",
    "args": [
        "run",
        "--project",
        "C:\\download\\mcp-dotnet-mssql\\src\\mcp-dotnet-mssql\\mcp-dotnet-mssql.csproj"
    ],
    "env": {
        "DB_DATASOURCE": "localhost",
        "DB_INITIAL_CATALOG": "MyDatabase",
        "DB_USER": "user",
        "DB_PASSWORD": "password",
        "DB_ALLOW_MULTI": "false",
        "DB_ALLOW_WRITE": "false"
    }
}

NOTE: Running the source locally requires the .NET 9 SDK to be installed.

Docker

The server is also available as a Docker image:

"mcp-dotnet-mssql": {
    "command": "docker",
    "args": [
        "run",
        "-i",
        "--rm",
        "littlefort/mcp-dotnet-mssql"
    ],
    "env": {
        "DB_DATASOURCE": "localhost",
        "DB_INITIAL_CATALOG": "MyDatabase",
        "DB_USER": "user",
        "DB_PASSWORD": "password",
        "DB_ALLOW_MULTI": "false",
        "DB_ALLOW_WRITE": "false"
    }
}

Options

The server makes use of the following environment variables:

  • DB_DATASOURCE - The machine name, IP address, or host URL of your target MS SQL Server instance.
  • DB_INITIAL_CATALOG - The default database that should be used when opening a connection.
  • DB_USER - The username used to open the database connection.
  • DB_PASSWORD - The password used to open the database connection.
  • DB_ALLOW_MULTI - (Optional) If set to true, will allow the agent to query other databases on the target server.
  • DB_ALLOW_WRITE - (Optional) If set to true, will allow the agent to execute write operations (e.g. INSERT, UPDATE, DELETE, etc.).

Contributing

Contributions are welcome! Please fork the repository and submit pull requests.

License

This project is licensed under the MIT License. See the file for details.

Third-Party References