SQL Server MCP (macOS)

Registre officiel Données et bases de données

SQL Server MCP with RAG capabilities for macOS (Docker SQL Server support)

Que pouvez-vous faire avec SQL Server MCP (macOS) ?

  • 🔍 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

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package @tharanabopearachchi/sql-server-mcp-macos
Claude Code
claude mcp add sql-server-mcp-macos -- npx -y @tharanabopearachchi/sql-server-mcp-macos@1.0.4
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "sql-server-mcp-macos": {
            "command": "npx",
            "args": [
                "-y",
                "@tharanabopearachchi/sql-server-mcp-macos@1.0.4"
            ]
        }
    }
}

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. SQL Server MCP - Cross-Platform Database Integration for AI
  2. 🌟 Features
  3. 🎥 Demo
  4. 🚀 Quick Start
  5. 📦 Installation
  6. 🛠️ Available MCP Tools
  7. 💬 Example Usage
  8. ⚙️ Configuration
  9. 🔐 Security Features
  10. 🏗️ Architecture
  11. 🎯 Use Cases
  12. 🤝 Contributing
  13. 📄 License
  14. 🙏 Acknowledgments
  15. 📚 Resources
  16. 🌐 Platform-Specific Documentation

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 msnodesqlv8 driver for optimal performance
  • 📖 Windows Setup Guide
macOS Version → sql-server-mcp-mac/
  • ✅ SQL Server Authentication (Docker required)
  • ✅ Pure JavaScript mssql driver (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

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"
      }
    }
  }
}

LM Studio Configuration

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": ""
      }
    }
  }
}

VS Code with Continue Extension

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"
        }
      }
    ]
  }
}

Cursor IDE

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"
      }
    }
  }
}

Cline (VS Code Extension)

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 databases
  • list_tables - View tables with row counts
  • describe_table - Get detailed schema (columns, types, constraints, indexes)
  • list_views - List all views
  • list_stored_procedures - List stored procedures with metadata
  • get_procedure_definition - Get full SQL definition
  • get_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, procedures
  • find_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

📚 Resources

🌐 Platform-Specific Documentation

PlatformDirectoryKey Features
Windowssql-server-mcp/Windows Auth, ODBC Driver, Native performance
macOSsql-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

Questions fréquentes

Qu'est-ce que SQL Server MCP (macOS) ?

SQL Server MCP with RAG capabilities for macOS (Docker SQL Server support)

Comment installer SQL Server MCP (macOS) ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add sql-server-mcp-macos -- npx -y @tharanabopearachchi/sql-server-mcp-macos@1.0.4. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour SQL Server MCP (macOS) ?

Son entrée au registre n'indique aucune clé ni secret obligatoire. Certaines fonctions peuvent tout de même demander un compte auprès du service auquel il se connecte.

SQL Server MCP (macOS) est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient SQL Server MCP (macOS) ?

Il est publié par TharanaBope. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.