mssql-mcp-server

ddonathan/mssql-mcp-server

3.2

If you are the rightful owner of mssql-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MSSQL MCP Server is a Model Context Protocol server designed for Microsoft SQL Server, providing SQL authentication and a range of database management features.

Tools
3
Resources
0
Prompts
0

MSSQL MCP Server

Model Context Protocol (MCP) server for Microsoft SQL Server with SQL authentication.

Features

  • Full SQL Support: Execute SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, and more
  • Automatic .env Loading: Loads database credentials from your project's .env file
  • Cross-Database Queries: Query multiple databases on the same server
  • Schema Exploration: List tables and describe table structures
  • Connection Pooling: Efficient connection management

Installation

Install directly from GitHub:

npm install github:ddonathan/mssql-mcp-server

Or with pnpm:

pnpm add github:ddonathan/mssql-mcp-server

Configuration

1. Add to your .env file:

DB_SERVER=your-server.com
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
DB_PORT=1433
DB_TRUST_CERT=true

2. Configure in .claude/.mcp.json:

{
  "mcpServers": {
    "mssql": {
      "command": "node",
      "args": [
        "./node_modules/mssql-mcp-server/dist/index.js"
      ],
      "env": {}
    }
  }
}

The server automatically loads credentials from your project's .env file based on the current working directory.

Available Tools

mcp__mssql__query

Execute any SQL statement and return results or status.

Examples:

-- SELECT query (returns data)
SELECT * FROM users WHERE status = 'active'

-- CREATE VIEW (returns success message)
CREATE VIEW migration.MyView AS
SELECT id, name FROM users

-- INSERT (returns rows affected)
INSERT INTO users (name, email) VALUES ('John', 'john@example.com')

-- Cross-database query
SELECT * FROM other_database.dbo.table1

mcp__mssql__list_tables

List all tables and views in the database.

mcp__mssql__describe_table

Get the schema (columns, types, constraints) of a specific table.

Response Formats

SELECT queries:

[
  {"id": 1, "name": "John"},
  {"id": 2, "name": "Jane"}
]

DDL/DML operations:

{
  "success": true,
  "rowsAffected": [1],
  "message": "Query executed successfully. Rows affected: 1"
}

Version History

v1.1.0

  • Added support for DDL operations (CREATE, ALTER, DROP)
  • Added support for DML operations (INSERT, UPDATE, DELETE)
  • Automatic .env loading from project directory
  • Added dotenv dependency

v1.0.0

  • Initial release with SELECT query support
  • Table listing and description
  • Connection pooling

License

ISC