mssql_mcp_server
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
claude mcp add --transport stdio jexinsam-mssql_mcp_server python -m mssql_mcp_server \ --env MSSQL_HOST="localhost" \ --env MSSQL_USER="your_username" \ --env MSSQL_DRIVER="mssql_driver" \ --env MSSQL_DATABASE="your_database" \ --env MSSQL_PASSWORD="your_password" \ --env Trusted_Connection="no (optional)" \ --env TrustServerCertificate="yes or no (optional)"
How to use
This MSSQL MCP Server provides a controlled interface for AI assistants to interact with a Microsoft SQL Server database. It exposes capabilities to list available tables, read table contents, and execute SQL queries with enforced permissions and logging. By using MCP, you can safely explore data schemas and fetch data without granting broad database access. The server reads configuration from environment variables to connect to your MSSQL instance and can be run as a standalone Python process or integrated into tooling that supports MCP-compatible servers. The included environment variables let you specify the MSSQL connection details and can be extended with optional TLS or certificate settings as needed.
To use the server with Claude Desktop or similar tooling, configure the MCP server entry to point to the Python module as shown in the example configuration. The server will accept requests to list tables, fetch rows from a table, or execute SQL queries with results returned in a structured format while logging operations for auditing.
How to install
Prerequisites:
- Python 3.8+ installed on your system
- Access to a running Microsoft SQL Server instance
- Internet access to install Python packages (optional if offline)
Install the package (if you have a distribution package) and dependencies:
pip install mssql-mcp-server
If you are developing or running from source, install development dependencies as needed and then start the server:
# Install dependencies (if a requirements file is provided)
pip install -r requirements.txt
# Run the MCP server (standalone)
python -m mssql_mcp_server
Verify the server starts and is listening on the expected host/port (default MCP may listen on a configured port).
Additional notes
Environment variables control access to the MSSQL database. Use a dedicated user with the least privileges necessary for the operations you intend to perform (e.g., read-only access for listing and reading data). Avoid embedding credentials in code; prefer environment variables as shown. Ensure the MSSQL_HOST, MSSQL_USER, MSSQL_PASSWORD, and MSSQL_DATABASE values are correct for your target database. If you enable TrustServerCertificate, be aware of the security implications in production. Regularly review and rotate credentials and monitor query activity through the server logs.
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