The MSSQL MCP Server enables natural language interaction with Microsoft SQL Server databases through LLMs like Claude, facilitating comprehensive data manipulation and schema management.
Query Data: Execute SELECT queries to retrieve data from tables
Insert Data: Add single or multiple records to database tables
Update Data: Modify existing table data with mandatory WHERE clause for security
Create Tables: Define new tables with custom columns and data types
Drop Tables: Remove entire tables from the database
Create Indexes: Add indexes on columns for improved query performance
Describe Tables: Retrieve schema information including columns and data types
List Tables: View all available tables, with optional schema filtering
Secure Connections: Handle database connections securely with optional read-only mode
Enables querying, reading, and modifying Microsoft SQL Server databases (part of the .NET ecosystem) through natural language, including executing SQL operations, managing tables and indexes, and performing CRUD operations on data.
MSSQL MCP Server
A Model Context Protocol (MCP) server that enables LLMs like Claude to interact with Microsoft SQL Server databases through natural language.
Features
- 🔍 Query your SQL Server database using natural language
- 📊 Read, insert, update, and delete data
- 🏗️ Create and manage tables and indexes
- 🔒 Secure connection handling with optional read-only mode
- ⚡ Direct TypeScript execution with tsx - no build step required
Quick Start
Option 1: Use directly from GitHub with npx (Recommended)
No installation needed! Just configure Claude Desktop:
Windows
Add to %APPDATA%\Claude\claude_desktop_config.json
:
macOS/Linux
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
:
Note for legacy SQL Servers: If you experience SSL/TLS connection issues with older SQL Server versions, try:
"ENCRYPT": "false"
to disable TLS/SSL encryption"TRUST_SERVER_CERTIFICATE": "true"
to trust self-signed certificates"CONNECTION_TIMEOUT": "60"
or higher for slower connections"DEBUG": "true"
to see detailed connection logs
Option 2: Clone and run locally
- Clone the repository:
- Install dependencies:
- Create
.env
file:
- Configure Claude Desktop to point to your local installation:
Environment Variables
Variable | Description | Default |
---|---|---|
SERVER_NAME | SQL Server hostname | Required |
DATABASE_NAME | Database name | Required |
SQL_USERNAME | SQL username | Required |
SQL_PASSWORD | SQL password | Required |
PORT | SQL Server port | 1433 |
ENCRYPT | Enable TLS/SSL encryption | true |
TRUST_SERVER_CERTIFICATE | Trust self-signed certificates | false |
CONNECTION_TIMEOUT | Connection timeout in seconds | 30 |
READONLY | Enable read-only mode | false |
DEBUG | Enable debug logging | false |
Usage Examples
Once configured, you can interact with your database using natural language in Claude:
- "Show me all customers from New York"
- "Create a table called products with columns for id, name, and price"
- "Update the price of product with id 5 to 29.99"
- "List all tables in the database"
- "Describe the structure of the orders table"
Development
Running locally with tsx:
Type checking:
Security Notes
- Never commit
.env
files with real credentials - Use read-only mode (
READONLY=true
) in production for safety - The server requires WHERE clauses for updates to prevent accidental mass updates
- Consider using environment-specific credentials
Troubleshooting
Connection issues
- Ensure your SQL Server allows remote connections
- Check firewall rules for SQL Server port (default 1433, or your custom PORT setting)
- Verify credentials and server name
- Enable debug logging by setting
DEBUG=true
in your environment variables
SSL/TLS connection issues
- For older SQL Server versions that don't support modern TLS, set
ENCRYPT=false
- If using self-signed certificates, set
TRUST_SERVER_CERTIFICATE=true
- For connection timeout issues, increase
CONNECTION_TIMEOUT
to 60 or higher - Check that your SQL Server accepts the TLS version your Node.js supports
Debug mode
To enable detailed logging for troubleshooting:
Authentication errors
- This server uses SQL authentication, not Windows authentication
- Ensure SQL authentication is enabled on your server
- Check that the SQL user has appropriate permissions
License
MIT
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server that enables LLMs like Claude to interact with Microsoft SQL Server databases through natural language, supporting queries, data manipulation, and table management.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol Server that enables LLMs to interact with Oracle Database by providing database tables/columns as context, allowing users to generate SQL statements and retrieve results using natural language prompts.Last updated -29Apache 2.0
- AsecurityAlicenseAqualityA Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.Last updated -1565MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs like Claude to interact with SQLite and SQL Server databases, allowing for schema inspection and SQL query execution.Last updated -480180MIT License
- -securityFlicense-qualityA Model Context Protocol server that allows Large Language Models like Claude to execute SQL queries, explore database schemas, and maintain persistent connections to SQL Server databases.Last updated -