MSSQL MCP Server

MSSQL MCP Server

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.

Category
Visit Server

Tools

insert_data

Inserts data into an MSSQL Database table. Supports both single record insertion and multiple record insertion using standard SQL INSERT with VALUES clause. FORMAT EXAMPLES: Single Record Insert: { "tableName": "Users", "data": { "name": "John Doe", "email": "john@example.com", "age": 30, "isActive": true, "createdDate": "2023-01-15" } } Multiple Records Insert: { "tableName": "Users", "data": [ { "name": "John Doe", "email": "john@example.com", "age": 30, "isActive": true, "createdDate": "2023-01-15" }, { "name": "Jane Smith", "email": "jane@example.com", "age": 25, "isActive": false, "createdDate": "2023-01-16" } ] } GENERATED SQL FORMAT: - Single: INSERT INTO table (col1, col2) VALUES (@param1, @param2) - Multiple: INSERT INTO table (col1, col2) VALUES (@param1, @param2), (@param3, @param4), ... IMPORTANT RULES: - For single record: Use a single object for the 'data' field - For multiple records: Use an array of objects for the 'data' field - All objects in array must have identical column names - Column names must match the actual database table columns exactly - Values should match the expected data types (string, number, boolean, date) - Use proper date format for date columns (YYYY-MM-DD or ISO format)

read_data

Executes a SELECT query on an MSSQL Database table. The query must start with SELECT and cannot contain any destructive SQL operations for security reasons.

describe_table

Describes the schema (columns and types) of a specified MSSQL Database table.

update_data

Updates data in an MSSQL Database table using a WHERE clause. The WHERE clause must be provided for security.

create_table

Creates a new table in the MSSQL Database with the specified columns.

create_index

Creates an index on a specified column or columns in an MSSQL Database table

drop_table

Drops a table from the MSSQL Database.

list_table

Lists tables in an MSSQL Database, or list tables in specific schemas

README

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

Option 1: Use directly from GitHub with npx (Recommended)

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

Variable Description Default
SERVER_NAME SQL Server hostname Required
DATABASE_NAME Database name Required
SQL_USERNAME SQL username Required
SQL_PASSWORD SQL password Required
TRUST_SERVER_CERTIFICATE Trust self-signed certificates false
CONNECTION_TIMEOUT Connection timeout in seconds 30
READONLY Enable read-only mode false

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured