MCP SQL Server
Click on "Deploy 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., "@MCP SQL ServerShow me the schema of the Users table"
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.
MCP SQL Server
A Model Context Protocol (MCP) server for SQL Server integration with Claude Code. Query, monitor, and analyze your SQL Server databases directly from Claude.
Features
Query Execution - Execute SELECT queries with parameterized inputs
Schema Exploration - Browse tables, columns, procedures, and indexes
Database Monitoring - Track active queries, blocking sessions, wait stats, and connections
Performance Analysis - Identify missing indexes, unused indexes, and fragmentation
Write Operations - INSERT, UPDATE, DELETE when enabled (READONLY=false)
Related MCP server: MSSQL MCP Server
Installation
Option 1: From npm (recommended)
npx @fabriciofs/mcp-sql-serverOption 2: Global installation
npm install -g @fabriciofs/mcp-sql-serverOption 3: Clone and build locally
git clone https://github.com/fabriciofs/mcp-sql-server.git
cd mcp-sql-server
npm install
npm run buildConfiguration
Claude Code Integration
Add to your Claude Code MCP settings (~/.claude/settings.json or project .claude/settings.json):
{
"mcpServers": {
"sqlserver": {
"command": "npx",
"args": ["-y", "@fabriciofs/mcp-sql-server"],
"env": {
"SQL_CONNECTION_URL": "sqlserver://user:password@localhost:1433/database",
"READONLY": "true"
}
}
}
}Or with individual connection parameters:
{
"mcpServers": {
"sqlserver": {
"command": "npx",
"args": ["-y", "@fabriciofs/mcp-sql-server"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "mydb",
"SQL_USER": "sa",
"SQL_PASSWORD": "yourpassword",
"SQL_PORT": "1433",
"SQL_TRUST_CERT": "true",
"READONLY": "true"
}
}
}
}Environment Variables
Connection (choose one method)
Method 1: Connection URL
SQL_CONNECTION_URL=sqlserver://user:password@host:port/database?TrustServerCertificate=trueMethod 2: Individual Parameters
SQL_SERVER=localhost
SQL_DATABASE=mydb
SQL_USER=sa
SQL_PASSWORD=yourpassword
SQL_PORT=1433 # Optional, default: 1433
SQL_ENCRYPT=true # Optional, default: true
SQL_TRUST_CERT=false # Optional, default: falseRequired Settings
Variable | Description |
| Required. Set to |
Optional Settings
Variable | Default | Description |
|
| Query timeout in milliseconds (max: 120000) |
|
| Maximum rows to return (max: 5000) |
|
| Minimum connection pool size |
|
| Maximum connection pool size |
|
| Log level: debug, info, warn, error |
Available Tools
Query Tools
Tool | Description |
| Execute SELECT queries with parameterized inputs |
Schema Tools
Tool | Description |
| List all tables and views in the database |
| Get detailed table information (columns, indexes, foreign keys) |
| Search for columns across all tables |
| List stored procedures |
| List indexes with usage statistics |
Monitor Tools
Tool | Description |
| Monitor currently running queries |
| Monitor blocking sessions and lock chains |
| Monitor wait statistics for performance bottlenecks |
| Monitor database size and file usage |
| Monitor active connections |
| Monitor SQL Server performance counters |
Analysis Tools
Tool | Description |
| Analyze query execution plan and statistics |
| Suggest missing indexes based on query patterns |
| Find indexes that are not being used |
| Find duplicate or overlapping indexes |
| Analyze index fragmentation levels |
| Analyze table statistics for stale data |
Write Tools (READONLY=false only)
Tool | Description |
| Insert a row into a table |
| Update rows in a table |
| Delete rows from a table |
Usage Examples
Once configured, you can ask Claude to interact with your database:
"List all tables in the database"
"Describe the Users table"
"Show me active queries running for more than 5 seconds"
"Find unused indexes in the Orders table"
"Analyze the fragmentation of all indexes"
"What are the top wait statistics?"Security Considerations
Always use READONLY=true in production unless write access is explicitly required
Store credentials securely using environment variables
Use SQL Server accounts with minimal required permissions
Consider network security (VPN, firewall rules) for remote connections
Requirements
Node.js >= 20.0.0
SQL Server 2016 or later
Appropriate SQL Server permissions for the operations you want to perform
Development
# Install dependencies
npm install
# Build
npm run build
# Development mode (watch)
npm run dev
# Type check
npm run typecheck
# Run MCP Inspector
npm run inspectorLicense
MIT License - see LICENSE file for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA 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.-
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides comprehensive access to Microsoft SQL Server databases, enabling Language Models to inspect schemas, execute queries, manage database objects, and perform advanced database operations.8-
- AlicenseAqualityDmaintenanceA 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.82,592 npmMIT
- AlicenseNot gradedqualityFmaintenanceAn MCP server for Microsoft SQL Server integration that enables users to query, monitor, and analyze databases directly through Claude. It supports schema exploration, performance analysis, and optional write operations via natural language commands.3 npm1MIT