sql-server-mcp

AhmedElhoceny/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 dayong@mcphub.com.

A Model Context Protocol (MCP) server for SQL Server integration with GitHub Copilot.

Tools
3
Resources
0
Prompts
0

SQL Server MCP Server

A Model Context Protocol (MCP) server for SQL Server integration with GitHub Copilot.

Features

  • Execute SQL queries directly from GitHub Copilot
  • List all tables in your database
  • Get table schema information
  • Secure connection using environment variables

Installation

pip install -r requirements.txt
pip install -e .

Configuration

  1. Copy .env.example to .env:
cp .env.example .env
  1. Update .env with your SQL Server connection string:
SQL_SERVER_CONNECTION_STRING=DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=YourDatabase;UID=your_user;PWD=your_password;TrustServerCertificate=yes;
  1. Add to VS Code settings.json:
{
  "github.copilot.chat.mcp.enabled": true,
  "github.copilot.chat.mcp.servers": {
    "sql-server": {
      "command": "python",
      "args": ["-m", "sql_server_mcp.server"],
      "env": {
        "SQL_SERVER_CONNECTION_STRING": "YOUR_CONNECTION_STRING_HERE"
      }
    }
  }
}
  1. Restart VS Code

Usage

Ask GitHub Copilot:

  • "List all tables in SQL Server"
  • "Show me the schema for the Users table"
  • "Query the top 10 records from Customers"

Tools Available

  • query_sql_server - Execute SQL queries
  • list_tables - List all database tables
  • get_table_schema - Get table schema details

License

MIT