
SQL Server MCP (Windows)
io.github.TharanaBopePublished by GitHub account TharanaBopev1.0.4Updated Oct 27, 2026
SQL Server MCP with RAG capabilities for Windows (native ODBC support)
Overview
A local MCP server that lets an AI assistant explore and query Microsoft SQL Server databases on Windows, with schema search and read-only SELECT execution.
- What you can do
- List and describe databases, tables, views, stored procedures and database statistics
- Map foreign key relationships and find tables connected to a given table
- Search the schema across tables, columns, views and procedures, and find where a column is used
- Run read-only SELECT queries with timeouts and row limits
- Cache schema metadata for faster repeat lookups
- When to use it
- Useful when you work with a SQL Server instance and want an assistant to answer questions about its structure, relationships and contents without writing queries by hand. Best suited to exploration and read-only reporting rather than schema changes.
- Requirements
- Runs as a local process via npx on Windows, with the native ODBC driver and msnodesqlv8 driver. Needs a reachable SQL Server instance and connection settings supplied as environment variables: SQL_SERVER, SQL_DATABASE, SQL_PORT, SQL_USE_WINDOWS_AUTH, and SQL_USERNAME and SQL_PASSWORD for SQL authentication. Optional settings include QUERY_TIMEOUT, MAX_RESULT_ROWS, ENABLE_SCHEMA_CACHE and CACHE_TTL_MINUTES.
Installation
In SourceWeft
- Open SQL Server MCP (Windows) in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
SQL Server MCP - Cross-Platform Database Integration for AI
[License: MIT] [TypeScript] [MCP] [npm version] [npm downloads]
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
Claude Desktop (macOS)
Config Location: ~/Library/Application Support/Claude/claude_desktop_config.json
LM Studio Configuration
Config Location: Varies by platform
- Windows:
%USERPROFILE%\.lmstudio\config.json - macOS:
~/.lmstudio/config.json
VS Code with Continue Extension
Config Location: ~/.continue/config.json
Cursor IDE
Config Location: Cursor Settings → Features → Model Context Protocol
Cline (VS Code Extension)
Config Location: VS Code Settings → Cline → MCP Settings
Restart your AI assistant and you're ready to go!
🛠️ Development Setup
For development or local modifications:
Windows
👉 Complete Windows Setup Instructions
macOS
👉 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:
⚙️ Configuration
Both versions use environment variables for configuration:
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
🎯 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
Made with ❤️ for the MCP community
⭐ Star this repo if you find it useful! 🐛 Report bugs via Issues 💬 Questions? Check the Discussions
Source: README.md at commit 9d80105
Tools
0Version history
1- v1.0.4LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts