sql-server-mcp

muhammad-shameel-ks/sql-server-mcp

3.2

If you are the rightful owner of sql-server-mcp 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.

A simple MCP server for connecting to Microsoft SQL Server, with a configurable read-only option.

MSSQL MCP Server

A simple MCP server for connecting to Microsoft SQL Server, with a configurable read-only option.

Installation

1. Install the Microsoft ODBC Driver

This server requires the Microsoft ODBC Driver for SQL Server.

For Debian/Ubuntu:

A. Add the Microsoft Package Repository

sudo su -c "curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && curl -sSL https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list && apt-get update"

B. Install the Driver

sudo apt-get install -y msodbcsql18 unixodbc-dev

Note: You will be prompted to accept the End-User License Agreement during the installation.

2. Install the MCP Server

You can install this server directly from your Git repository:

pipx install git+https://github.com/muhammad-shameel-ks/sql-server-mcp.git

Configuration

Create or edit the .roo/mcp.json file in your project's root directory to configure the server connection.

{
  "mcpServers": {
    "mssql": {
      "command": "mssql-mcp-server",
      "env": {
        "MSSQL_HOST": "YOUR_SERVER_IP\\INSTANCE_NAME",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password",
        "MSSQL_DATABASE": "your_database_name",
        "MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
        "MSSQL_READ_ONLY": "true"
      },
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Configuration Options

  • MSSQL_HOST: The IP address and instance name of your SQL Server.
  • MSSQL_USER: The username for your database.
  • MSSQL_PASSWORD: The password for your database.
  • MSSQL_DATABASE: The name of the database to connect to.
  • MSSQL_DRIVER: The name of the ODBC driver to use.
  • MSSQL_READ_ONLY: Set to "true" to enforce read-only access. Any other value will allow read-write access.

Important:

  • The double backslash \\ in MSSQL_HOST is required to correctly escape the backslash in the JSON file.
  • After changing any of these settings, you must restart the MCP server for the changes to take effect.