
SQL Server MCP (macOS)
io.github.TharanaBope由 GitHub 账号 TharanaBope 发布v1.0.4更新于 Oct 24, 2026
SQL Server MCP with RAG capabilities for macOS (Docker SQL Server support)
概览
让 AI 助手探索和查询 Microsoft SQL Server 数据库结构,并执行只读 SELECT 查询。
- 可以做什么
- 提供十二个 SQL Server 探索工具:列出数据库、表、视图和存储过程,描述表结构,获取存储过程定义和数据库概览。可映射外键关系和关联表,在表、列、视图和存储过程中搜索结构,并查找某列在哪些表中使用。查询工具以超时和行数限制执行只读 SELECT 语句,结构查询结果可缓存。
- 适用场景
- 适合助手需要了解不熟悉的 SQL Server 数据库、回答表与关系相关问题,或在不离开对话的情况下运行简单的只读查询。更偏向结构研究与探索,而非应用开发。
- 运行要求
- 通过 npx 以 stdio 在本地运行,需要 Node.js。macOS 版本需要可通过 Docker 访问的 SQL Server 并使用 SQL 身份验证;配置使用 SQL_SERVER、SQL_DATABASE、SQL_PORT、SQL_USERNAME、SQL_PASSWORD 等环境变量。需要能访问数据库服务器的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 SQL Server MCP (macOS),将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
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
来源:README.md,提交 9d80105
工具
0版本历史
1- v1.0.4最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分