SQL Server MCP
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
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SQL Server MCPshow me the top 5 customers by total orders"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
pip install pymssql-mcp2. 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
{
"mcpServers": {
"mssql": {
"command": "pymssql-mcp",
"env": {
"MSSQL_HOST": "your-server.example.com",
"MSSQL_USER": "your-username",
"MSSQL_PASSWORD": "your-password",
"MSSQL_DATABASE": "your-database",
"MSSQL_READ_ONLY": "true"
}
}
}
}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:
pymssql-mcpHTTP/SSE Server
Run as a shared HTTP server for multiple users:
pymssql-mcp --http --host 0.0.0.0 --port 8080Streamable HTTP (Claude.ai Integration)
Run with OAuth authentication for Claude.ai:
pymssql-mcp --streamable-http --host 0.0.0.0 --port 8080See OAuth Setup for complete integration instructions.
Development
# Clone repository
git clone https://github.com/bpamiri/pymssql-mcp.git
cd pymssql-mcp
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check .
ruff format .
# Type check
mypy src/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.
Links
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bpamiri/pymssql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server