MCP HubMCP Hub
daobataotie

mssql-mcp

by: daobataotie

mssql mcp server

23created 13/03/2025
Visit
mssql
sql

πŸ“ŒOverview

Purpose: To provide robust database interaction and business intelligence capabilities for users, enabling efficient data analysis and insight generation.

Overview: MSSQL MCP Server facilitates the execution of SQL queries, the analysis of business data, and the automatic generation of business insights. It serves as a seamless interface for database management and insight delivery.

Key Features:

  • Database Interaction: Allows executing SELECT, INSERT, UPDATE, and DELETE queries to manage database records effectively, catering to varying data manipulation needs.

  • Insight Generation: Automatically compiles business insights and memo generation, streamlining the process of data analysis and reporting.


MSSQL MCP Server

Overview

MSSQL MCP Server provides database interaction and business intelligence capabilities. This server enables running SQL queries, analyzing business data, and automatically generating business insight memos.
Refer to the official website's SQLite for modifications to adapt to MSSQL.

Components

  • read_query
    Execute SELECT queries to read data from the database.
  • write_query
    Execute INSERT, UPDATE, or DELETE queries.
  • create_table
    Create new tables in the database.
  • list_tables
    Get a list of all tables in the database.
  • describe-table
    View schema information for a specific table.
  • append_insight
    Add new business insights to the memo resource.

Operating Environment

  • Python 3.x
  • Packages:
    • pyodbc>=4.0.39
    • pydantic>=2.0.0
    • mcp>=0.1.0
  • ODBC Driver 17 for SQL Server

Usage

Install packages

CD /d ~/mssql-mcp  
pip install -r requirements.txt  

Configuration

Create config.json in the same folder as server.py, and add:

{
    "database": {
        "driver": "ODBC Driver 17 for SQL Server",
        "server": "server ip",
        "database": "db name",
        "username": "username",
        "password": "password",
        "trusted_connection": false
    },
    "server": {
        "name": "mssql-manager",
        "version": "0.1.0"
    }
}

Claude Desktop and Windsurf

Add to claude_desktop_config.json (use your path):

{
    "mcpServers": {
        "mssql": {
            "command": "python",
            "args": [
                "~/server.py"
            ]
        }
    }
}

Cursor

Add configuration for Cursor MCP according to your setup.

MCP Inspector

Run with your path:

npx -y @modelcontextprotocol/inspector python C:\\mssql-mcp\\src\\server.py

Project Structure

mssql-mcp
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ README_en.md
β”œβ”€β”€ README_zh.md
β”œβ”€β”€ requirements.txt
└── src
    β”œβ”€β”€ __init__.py
    └── server.py

License

MIT License