Skip to main content
Glama

MSSQL MCP Server

by EvilPhatBoi

MSSQL MCP Server

A Model Context Protocol (MCP) server that enables LLMs like Claude to interact with Microsoft SQL Server databases through natural language.

Features

  • 🔍 Query your SQL Server database using natural language
  • 📊 Read, insert, update, and delete data
  • 🏗️ Create and manage tables and indexes
  • 🔒 Secure connection handling with optional read-only mode
  • ⚡ Direct TypeScript execution with tsx - no build step required

Quick Start

No installation needed! Just configure Claude Desktop:

Windows

Add to %APPDATA%\Claude\claude_desktop_config.json:

{ "mcpServers": { "mssql": { "type": "stdio", "command": "cmd", "args": ["/c", "npx", "-y", "github:EvilPhatBoi/McpSqlServer"], "env": { "SERVER_NAME": "your-server.database.windows.net", "DATABASE_NAME": "your-database", "SQL_USERNAME": "your-username", "SQL_PASSWORD": "your-password", "TRUST_SERVER_CERTIFICATE": "false", "CONNECTION_TIMEOUT": "30", "READONLY": "false" } } } }
macOS/Linux

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{ "mcpServers": { "mssql": { "type": "stdio", "command": "npx", "args": ["-y", "github:EvilPhatBoi/McpSqlServer"], "env": { "SERVER_NAME": "your-server.database.windows.net", "DATABASE_NAME": "your-database", "SQL_USERNAME": "your-username", "SQL_PASSWORD": "your-password", "TRUST_SERVER_CERTIFICATE": "false", "CONNECTION_TIMEOUT": "30", "READONLY": "false" } } } }

Option 2: Clone and run locally

  1. Clone the repository:
git clone https://github.com/EvilPhatBoi/McpSqlServer.git cd McpSqlServer
  1. Install dependencies:
npm install
  1. Create .env file:
cp .env.example .env # Edit .env with your database credentials
  1. Configure Claude Desktop to point to your local installation:
{ "mcpServers": { "mssql": { "type": "stdio", "command": "npx", "args": ["tsx", "C:/path/to/McpSqlServer/src/index.ts"], "env": { "SERVER_NAME": "your-server.database.windows.net", "DATABASE_NAME": "your-database", "SQL_USERNAME": "your-username", "SQL_PASSWORD": "your-password" } } } }

Environment Variables

VariableDescriptionDefault
SERVER_NAMESQL Server hostnameRequired
DATABASE_NAMEDatabase nameRequired
SQL_USERNAMESQL usernameRequired
SQL_PASSWORDSQL passwordRequired
TRUST_SERVER_CERTIFICATETrust self-signed certificatesfalse
CONNECTION_TIMEOUTConnection timeout in seconds30
READONLYEnable read-only modefalse

Usage Examples

Once configured, you can interact with your database using natural language in Claude:

  • "Show me all customers from New York"
  • "Create a table called products with columns for id, name, and price"
  • "Update the price of product with id 5 to 29.99"
  • "List all tables in the database"
  • "Describe the structure of the orders table"

Development

Running locally with tsx:

npm run start # Run the server npm run dev # Run with watch mode

Type checking:

npm run typecheck

Security Notes

  • Never commit .env files with real credentials
  • Use read-only mode (READONLY=true) in production for safety
  • The server requires WHERE clauses for updates to prevent accidental mass updates
  • Consider using environment-specific credentials

Troubleshooting

Connection issues

  • Ensure your SQL Server allows remote connections
  • Check firewall rules for SQL Server port (usually 1433)
  • Verify credentials and server name

Authentication errors

  • This server uses SQL authentication, not Windows authentication
  • Ensure SQL authentication is enabled on your server
  • Check that the SQL user has appropriate permissions

License

MIT

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A 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.

  1. Features
    1. Quick Start
      1. Option 1: Use directly from GitHub with npx (Recommended)
      2. Option 2: Clone and run locally
    2. Environment Variables
      1. Usage Examples
        1. Development
          1. Running locally with tsx:
          2. Type checking:
        2. Security Notes
          1. Troubleshooting
            1. Connection issues
            2. Authentication errors
          2. License

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol Server that enables LLMs to interact with Oracle Database by providing database tables/columns as context, allowing users to generate SQL statements and retrieve results using natural language prompts.
              Last updated -
              27
              Python
              Apache 2.0
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.
              Last updated -
              1
              121
              5
              TypeScript
              MIT License
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables LLMs like Claude to interact with SQLite and SQL Server databases, allowing for schema inspection and SQL query execution.
              Last updated -
              807
              134
              TypeScript
              MIT License
              • Linux
              • Apple
            • -
              security
              F
              license
              -
              quality
              A 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.
              Last updated -
              TypeScript

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/EvilPhatBoi/McpSqlServer'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server