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
:
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 |
TRUST_SERVER_CERTIFICATE | Trust self-signed certificates | false |
CONNECTION_TIMEOUT | Connection timeout in seconds | 30 |
READONLY | Enable read-only mode | 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 (usually 1433)
- Verify credentials and server name
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 -27PythonApache 2.0
- AsecurityAlicenseAqualityA Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.Last updated -11215TypeScriptMIT 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 -807134TypeScriptMIT 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 -TypeScript