mssql_mcp_server
A Model Context Protocol (MCP) server for Microsoft SQL Server that enables secure database interactions through a controlled interface. Allows AI assistants to safely list tables, read data, and execute SQL queries while maintaining security and structure.
claude mcp add --transport stdio richardhan-mssql_mcp_server uvx microsoft_sql_server_mcp \ --env MSSQL_USER="your_username" \ --env MSSQL_SERVER="localhost" \ --env MSSQL_DATABASE="your_database" \ --env MSSQL_PASSWORD="your_password"
How to use
This MCP server provides secure access to a Microsoft SQL Server database through Claude Desktop. It exposes capabilities to list database tables and execute SQL statements (SELECT, INSERT, UPDATE, DELETE) against configured databases. It supports multiple authentication methods, including SQL authentication, Windows authentication, and Azure AD, and can connect to LocalDB or Azure SQL databases. You can configure a custom port if needed. Use the provided environment variables to point to your database and credentials, and then run the server through the uvx command so Claude Desktop can query and interact with your SQL data.
How to install
Prerequisites:\n- Python (and pip) installed on your system\n- Claude Desktop and MCP setup where you want to run the server\n\nInstallation steps (via pip):\n1) Install the MCP package from PyPI:\nbash\npip install microsoft_sql_server_mcp\n\n2) Configure your Claude Desktop MCP entry (example shown in Quick Start):\njson\n{\n "mcpServers": {\n "mssql": {\n "command": "uvx",\n "args": ["microsoft_sql_server_mcp"],\n "env": {\n "MSSQL_SERVER": "localhost",\n "MSSQL_DATABASE": "your_database",\n "MSSQL_USER": "your_username",\n "MSSQL_PASSWORD": "your_password"\n }\n }\n }\n}\n\n3) Alternatively, install directly and run using uvx with your environment variables set:bash\n# Example (UNIX-style shells)\nexport MSSQL_SERVER=localhost\nexport MSSQL_DATABASE=your_database\nexport MSSQL_USER=your_username\nexport MSSQL_PASSWORD=your_password\nuvx microsoft_sql_server_mcp\n\nOptional: Development: clone repository, install in editable mode, and run tests as described in the repository's docs.
Additional notes
Tips and common issues:\n- Create a dedicated SQL user with minimal permissions; avoid using admin/sa accounts.\n- If you plan to use Windows Authentication, ensure the host supports Windows auth and the appropriate credentials are available to the MCP process.\n- Azure SQL connections typically require encryption; the server can be configured to enforce encryption through MSSQL_ENCRYPT or secure connection settings.\n- If you need to change the connection port, set MSSQL_PORT (default is 1433).\n- For local development with LocalDB, ensure the SQL Server LocalDB instance is accessible by the MCP user.\n- When using Azure AD, you may need additional token-based authentication setup depending on your environment.\n- Review security best practices: use least-privilege accounts and avoid exposing credentials in logs or config files.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP