SQL Server MCP (Windows) MCP Server
SQL Server MCP with RAG capabilities for macOS (Docker SQL Server support)
SQL Server MCP (Windows) scores 52 (Fair), licensed MIT and written in TypeScript. It installs as a local process. It declares 12 tools. Filed under Databases, Developer tools, AI and memory. GitHub shows 1 stars. Package registries report about 56 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Fair trust
52 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade B
82/100 for listing completeness. Lost points: 5 of 12 tools barely described, short summary, no docs link.
How quality is graded
Where the 52 comes from
22 + 5 + 1 + 10 + 4 + 10 = 52. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 5 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 1 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 10 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "tharanabope-sql-mcp-mac-windows": { "command": "npx", "args": [ "-y", "@tharanabopearachchi/sql-server-mcp-macos@1.0.4" ] } }}
Environment variables
This server does not declare environment variables.
Tools12Tool docs quality grade C
All capabilitiesdescribe_tabletoolGet detailed schema (columns, types, constraints, indexes)
execute_querytoolExecute read-only SELECT queries safely
Find all tables containing a specific column
High-level statistics
Get full SQL definition
Find directly connected tables
Get foreign key relationships (incoming & outgoing)
list_databasestoolDiscover all available databases
List stored procedures with metadata
list_tablestoolView tables with row counts
list_viewstoolList all views
search_schematoolSearch across tables, columns, views, procedures
About
SQL Server MCP - Cross-Platform Database Integration for AI
A Model Context Protocol (MCP) server implementation for SQL Server that enables AI assistants to explore and query SQL Server databases through natural language. Built as a RAG (Retrieval-Augmented Generation) system optimized for database knowledge exploration.
๐ Features
- ๐ Schema Exploration - List databases, tables, views, stored procedures
- ๐ Relationship Mapping - Discover foreign key relationships and table dependencies
- ๐ Search & Discovery - Global schema search across tables, columns, procedures
- โก Safe Query Execution - Read-only SELECT queries with automatic timeouts and row limits
- ๐๏ธ Schema Caching - Fast retrieval with configurable TTL (default: 60 minutes)
- ๐ Security First - Read-only by default, SQL injection prevention, query validation
- ๐ฅ๏ธ Cross-Platform - Native Windows Authentication & macOS Docker support
๐ฅ Demo
See SQL Server MCP in action with AI assistant integration:

Note: Watch how natural language queries instantly explore database schemas, find relationships, and retrieve data - all without leaving your AI assistant!
๐ Quick Start
This repository contains two platform-specific implementations:
Windows Version โ sql-server-mcp/
- โ Windows Authentication (ODBC Driver 17)
- โ SQL Server Authentication
- โ
Native
msnodesqlv8driver for optimal performance - ๐ Windows Setup Guide
macOS Version โ sql-server-mcp-mac/
- โ SQL Server Authentication (Docker required)
- โ
Pure JavaScript
mssqldriver (no native dependencies) - ๐ macOS Setup Guide
๐ฆ Installation
๐ Now Available on MCP Registry!
This server is officially published in the Model Context Protocol Registry:
- Windows:
io.github.TharanaBope/sql-server-mcp - macOS:
io.github.TharanaBope/sql-server-mcp-macos
๐ Quick Start (Recommended)
No installation needed! Just add to your AI assistant's configuration:
Claude Desktop (Windows)
Config Location: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"sql-server": {
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp@latest"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "true"
}
}
}
}
Claude Desktop (macOS)
Config Location: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"sql-server": {
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp-macos@latest"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "false",
"SQL_USERNAME": "sa",
"SQL_PASSWORD": "your_password"
}
}
}
}
Config Location: Varies by platform
- Windows:
%USERPROFILE%\.lmstudio\config.json - macOS:
~/.lmstudio/config.json
{
"mcpServers": {
"sql-server": {
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp@latest"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "true",
"SQL_USERNAME": "",
"SQL_PASSWORD": ""
}
}
}
}
Config Location: ~/.continue/config.json
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp@latest"]
},
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "true"
}
}
]
}
}
Config Location: Cursor Settings โ Features โ Model Context Protocol
{
"mcpServers": {
"sql-server": {
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp@latest"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "true"
}
}
}
}
Config Location: VS Code Settings โ Cline โ MCP Settings
{
"mcpServers": {
"sql-server": {
"command": "npx",
"args": ["-y", "@tharanabopearachchi/sql-server-mcp@latest"],
"env": {
"SQL_SERVER": "localhost",
"SQL_DATABASE": "master",
"SQL_USE_WINDOWS_AUTH": "true"
}
}
}
}
Restart your AI assistant and you're ready to go!
๐ ๏ธ Development Setup
For development or local modifications:
Windows
cd sql-server-mcp
npm install
npm run build
๐ Complete Windows Setup Instructions
macOS
cd sql-server-mcp-mac
npm install
npm run build
๐ Complete macOS Setup Instructions
๐ ๏ธ Available MCP Tools
The server provides 12 powerful tools for database exploration:
Schema Exploration
list_databases- Discover all available databaseslist_tables- View tables with row countsdescribe_table- Get detailed schema (columns, types, constraints, indexes)list_views- List all viewslist_stored_procedures- List stored procedures with metadataget_procedure_definition- Get full SQL definitionget_database_overview- High-level statistics
Relationship Mapping
get_table_relationships- Get foreign key relationships (incoming & outgoing)get_related_tables- Find directly connected tables
Search & Discovery
search_schema- Search across tables, columns, views, proceduresfind_column_usage- Find all tables containing a specific column
Query Execution
execute_query- Execute read-only SELECT queries safely
๐ฌ Example Usage
Once configured, you can ask your AI assistant:
"What databases are available on this server?"
"Show me all tables in the Sales database"
"What's the schema of the Orders table?"
"Find all tables that reference the Customers table"
"Search for any columns related to 'email'"
"Execute: SELECT TOP 10 * FROM Products ORDER BY Price DESC"
โ๏ธ Configuration
Both versions use environment variables for configuration:
SQL_SERVER=localhost
SQL_DATABASE=master
SQL_PORT=1433
SQL_USE_WINDOWS_AUTH=true # Windows only
SQL_USERNAME= # For SQL Auth
SQL_PASSWORD= # For SQL Auth
QUERY_TIMEOUT=30
MAX_RESULT_ROWS=1000
ENABLE_SCHEMA_CACHE=true
CACHE_TTL_MINUTES=60
See platform-specific READMEs for detailed configuration instructions.
๐ Security Features
- โ Read-only by default - Write operations disabled unless explicitly enabled
- โ Query validation - Only SELECT statements allowed by default
- โ Automatic timeouts - Prevents long-running queries
- โ Row limits - Prevents memory exhaustion
- โ SQL injection prevention - Query sanitization and validation
- โ Database whitelisting - Optional restriction to specific databases
๐๏ธ Architecture
MCP/
โโโ sql-server-mcp/ # Windows implementation
โ โโโ src/
โ โ โโโ index.ts # MCP server entry point
โ โ โโโ database/ # Connection, caching, queries
โ โ โโโ tools/ # 12 MCP tools
โ โ โโโ types/ # TypeScript interfaces
โ โโโ dist/ # Compiled output
โ โโโ package.json
โ โโโ README.md # Windows documentation
โ
โโโ sql-server-mcp-mac/ # macOS implementation
โ โโโ src/ # Same structure as Windows
โ โโโ README.md # macOS documentation
โ
โโโ LICENSE # MIT License
โโโ README.md # This file
๐ฏ Use Cases
Database Exploration
- "What tables exist in this database?"
- "Show me the structure of the Users table"
- "List all stored procedures"
Schema Research
- "Find all tables with an 'email' column"
- "Search for anything related to 'invoice'"
- "What views are available?"
Relationship Analysis
- "How are Orders and Customers related?"
- "Show me all tables that reference Products"
- "What are the foreign key relationships for this table?"
Data Queries
- "Get the top 10 most expensive products"
- "Show me recent orders"
- "What's the total count of records in each table?"
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built on Model Context Protocol SDK
- Uses mssql and msnodesqlv8 drivers
- Inspired by the need for better AI-database integration
๐ Resources
- Windows Setup Guide:
sql-server-mcp/README.md - macOS Setup Guide:
sql-server-mcp-mac/README.md - Troubleshooting: Check platform-specific
TROUBLESHOOTING.mdfiles - MCP Documentation: https://github.com/modelcontextprotocol
- Report Issues: https://github.com/TharanaBope/SQL-MCP-Mac-Windows/issues
๐ Platform-Specific Documentation
| Platform | Directory | Key Features |
|---|---|---|
| Windows | sql-server-mcp/ | Windows Auth, ODBC Driver, Native performance |
| macOS | sql-server-mcp-mac/ | Docker SQL Server, Pure JS, No native deps |
Made with โค๏ธ for the MCP community
โญ Star this repo if you find it useful! ๐ Report bugs via Issues ๐ฌ Questions? Check the Discussions
Frequently asked questions
What is SQL Server MCP (Windows) MCP Server?
SQL Server MCP with RAG capabilities for macOS (Docker SQL Server support)
How do I install SQL Server MCP (Windows) MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. SQL Server MCP (Windows) MCP Server runs locally from the npm package @tharanabopearachchi/sql-server-mcp-macos with the command npx -y @tharanabopearachchi/sql-server-mcp-macos@1.0.4.
Is SQL Server MCP (Windows) MCP Server free and open source?
Yes. SQL Server MCP (Windows) MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does SQL Server MCP (Windows) MCP Server support remote (HTTP) connections?
No remote endpoint is listed for SQL Server MCP (Windows) MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does SQL Server MCP (Windows) MCP Server provide?
SQL Server MCP (Windows) MCP Server provides 12 tools, including describe_table, execute_query, find_column_usage, and get_database_overview. See the full tool list for descriptions and parameters.
How is SQL Server MCP (Windows) MCP Server's trust score calculated?
SQL Server MCP (Windows) MCP Server scores 52 out of 100 (Fair). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yetโBe the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.