Python MSSQL MCP Server is an open source Model Context Protocol server that connects AI clients to Microsoft SQL Server databases. Built with Python, pyodbc, and FastAPI, the server enables database administrators, software developers, and data analysts to inspect schemas and run queries through conversational interfaces. It integrates with clients like Claude Desktop by exposing tools and resources that handle both read and write database operations. The server exposes database tables as Model Context Protocol resources formatted with custom URI schemes, allowing language models to review table structures and fetch preview rows in CSV format. Additionally, it provides execution tools for issuing custom SELECT queries as well as modification statements such as inserts and updates, returning row counts for write operations. Using environment-based configuration, connection pooling, and ODBC Driver 17 for SQL Server, the implementation standardizes how AI agents communicate with enterprise relational databases while maintaining structured error handling and result size safeguards.
Category: Databases & Data Stores
Tags: database, mssql, python, SQL, sql server
bash git clone https://github.com/amornpan/py-mcp-mssql.git cd py-mcp-mssql 3. Install the dependencies: bash pip install -r requirements.txt 4. Configure database credentials in your Claude Desktop configuration file (claude_desktop_config.json): json { "mcpServers": { "mssql": { "command": "python", "args": ["server.py"], "env": { "MSSQL_SERVER": "your_server", "MSSQL_DATABASE": "your_database", "MSSQL_USER": "your_username", "MSSQL_PASSWORD": "your_password", "MSSQL_DRIVER": "{ODBC Driver 17 for SQL Server}" } } } } 5. Restart Claude Desktop to start using the server.Part of MCP Servers
Clone the repository using git, install the dependencies from requirements.txt using pip, and make sure ODBC Driver 17 for SQL Server is installed. Then, configure your server script path and MSSQL environment variables in your client configuration.
The server exposes Microsoft SQL Server databases to Model Context Protocol clients. It lists available database tables as resources, reads the first 100 rows of tables in CSV format, and executes custom SELECT or data modification queries.
Python MSSQL MCP Server works with any client supporting the Model Context Protocol over standard input and output. The project provides specific setup instructions and configuration examples for Claude Desktop on Windows and macOS.
Yes, Python MSSQL MCP Server is open source software published under the MIT License on GitHub, allowing free usage, modification, and integration into custom environments.