The SQL Server MCP enables AI assistants to interact with Microsoft SQL Server databases through natural language queries and standardized tools.
Connection Management: Connect, disconnect, list active connections, switch between databases, and list available databases with automatic recovery from hung connections via watchdog
Schema Exploration: Browse tables, views, and stored procedures with schema filtering and pattern matching; get detailed information about columns, data types, primary keys, foreign keys, and indexes
Data Querying: Execute read-only SELECT queries with safety validation and automatic row limits
CRUD Operations: Insert new rows with automatic identity column handling, read rows by primary key or custom filters, update existing rows, and delete rows
Stored Procedures: List, describe parameters, and execute stored procedures with input parameters and result sets
Data Export: Export query results to JSON or CSV files with custom delimiters
Transaction Control: Begin, commit, and rollback database transactions
Knowledge Management: Save, retrieve, and search learned information about database interactions
Safety Features: Read-only mode, command blocking (DROP, TRUNCATE, etc.), schema/database restrictions, query validation, parameterized queries to prevent SQL injection, and row limits
Deployment Options: Local Claude Desktop integration, HTTP/SSE server, or OAuth-enabled Claude.ai integration
pymssql-mcp
An MCP (Model Context Protocol) server for Microsoft SQL Server databases. Enables AI assistants like Claude to interact with SQL Server through a standardized protocol.
Features
Natural Language Queries: Ask Claude about your data in plain English
Schema Discovery: Explore tables, views, columns, and relationships
CRUD Operations: Read, insert, update, and delete rows safely
Stored Procedures: Execute stored procedures with parameters
Multi-Database Support: List and switch between databases
Data Export: Export query results to JSON or CSV files
Transaction Support: Begin, commit, and rollback transactions
Knowledge Persistence: Claude remembers what it learns about your database
Safety Controls: Read-only mode, command blocking, row limits, schema restrictions
Connection Watchdog: Automatic recovery from hung connections
OAuth Integration: Deploy as a Claude.ai Custom Connector with SSO
Documentation
Guide | Description |
Understanding MCP and pymssql-mcp | |
Complete installation guide | |
Get running in 10 minutes | |
All configuration options | |
Detailed tool documentation | |
Common usage patterns | |
Claude.ai integration with SSO |
Quick Start
1. Install
2. Configure Claude Desktop
Edit your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
3. Restart Claude Desktop
Quit and reopen Claude Desktop. You'll see a hammer icon indicating tools are available.
4. Start Chatting
Ask Claude about your database:
"What tables are available?"
"Describe the Customers table"
"Show me the top 10 orders by total amount"
"How many customers do we have in each state?"
Available Tools
Connection & Database
Tool | Description |
| Connect to the database |
| Close all connections |
| List available databases |
| Switch database context |
Queries & Schema
Tool | Description |
| Run a SELECT query |
| Check if a query is safe |
| List tables and views |
| Get column information |
CRUD Operations
Tool | Description |
| Read rows by ID or filter |
| Insert a new row |
| Update an existing row |
| Delete a row |
Stored Procedures
Tool | Description |
| List available procedures |
| Get procedure parameters |
| Execute a procedure |
Export & Transactions
Tool | Description |
| Export results to JSON |
| Export results to CSV |
| Start a transaction |
| Commit changes |
| Rollback changes |
Knowledge Persistence
Tool | Description |
| Save learned information |
| Retrieve all knowledge |
| Search saved knowledge |
Configuration
Required Variables
Variable | Description |
| SQL Server hostname |
| Database username |
| Database password |
| Database name |
Safety Settings
Variable | Default | Description |
|
| Block all write operations |
|
| Maximum rows per query |
|
| Commands to block |
| (all) | Restrict to specific schemas |
| (none) | Hide specific databases |
See Configuration Reference for all options.
Deployment Modes
Local (Default)
Run as a local process with Claude Desktop:
HTTP/SSE Server
Run as a shared HTTP server for multiple users:
Streamable HTTP (Claude.ai Integration)
Run with OAuth authentication for Claude.ai:
See OAuth Setup for complete integration instructions.
Development
Security
pymssql-mcp includes multiple safety features:
Read-only mode: Prevent all write operations
Command blocking: Block dangerous SQL commands (DROP, TRUNCATE, etc.)
Schema restrictions: Limit access to specific schemas
Database blocklist: Hide sensitive databases
Row limits: Cap query results to prevent memory issues
Query validation: Analyze queries before execution
Parameterized queries: Prevent SQL injection
See SECURITY.md for security policy and best practices.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
License
Apache-2.0. See LICENSE for details.