home / mcp / sql server express mcp server

SQL Server Express MCP Server

MCP server for interacting with SQLExpress

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hanweg-mcp-sqlexpress": {
      "command": "uv",
      "args": [
        "venv",
        "run",
        "mcp-server-sqlexpress",
        "--server",
        "server\\\\instance",
        "--auth",
        "windows",
        "--trusted-connection",
        "yes",
        "--trust-server-certificate",
        "yes",
        "--allowed-databases",
        "database1,database2"
      ]
    }
  }
}

This MCP server lets you interact with a Microsoft SQL Server Express instance by exposing a programmable interface for common database actions. It supports both Windows and SQL Server authentication, making it flexible for local development and secure enterprise use.

How to use

You run the server locally and connect to it from an MCP client. The server accepts standard database operations such as reading data, writing data, and managing tables. Use an MCP client to execute queries, list databases, and describe table schemas through the provided endpoints. When you configure a client, point it to the local server started by the MCP tooling and use the authentication method that matches your SQL Server setup. Ensure your client’s database permissions align with the operations you plan to perform.

How to install

Prerequisites before installing the MCP server:

  • Python 3.10 or higher
  • Microsoft ODBC Driver 18 for SQL Server
  • A SQL Server Express instance with appropriate permissions

Install steps you will follow exactly as shown here to set up the MCP server locally.

cd mcp-sqlexpress

# Create and activate virtual environment
uv venv
.venv\Scripts\activate

# Install dependencies
uv pip install --editable .

Configuration and usage with Claude Desktop

You can configure the Claude Desktop integration to run the MCP server as a local process. Use the following configuration snippet in your Claude Desktop settings to load the server, pointing to the local project and the server instance.

{
    "mcpServers": {
        "sqlexpress": {
            "command": "uv",
            "args": [
                "--directory",
                "PATH\\TO\\PROJECT\\mcp-sqlexpress",
                "run",
                "mcp-server-sqlexpress",
                "--server",
                "server\\instance",
                "--auth",
                "windows",
                "--trusted-connection",
                "yes",
                "--trust-server-certificate",
                "yes",
                "--allowed-databases",
                "database1,database2"
            ]
        }
    }
}

Authentication options

Choose the authentication mode that matches your SQL Server configuration.

For Windows Authentication: - Set --auth windows - Set --trusted-connection yes

For SQL Server Authentication: - Set --auth sql - Add --username and --password

Available tools

get_allowed_databases

Retrieves the list of databases that the MCP server is allowed to access.

read_query

Executes SELECT queries against the connected SQL Server database.

write_query

Executes INSERT, UPDATE, and DELETE queries against the connected database.

create_table

Creates new tables in the connected database.

list_tables

Lists all tables in the connected database.

describe_table

Shows the schema for a specified table.