mcpField
M
MSSQL MCP Server

MSSQL MCP Server

Local
github.com/ConnorDaytonaHolmesDatabases0Updated 74w ago

About MSSQL MCP Server

MSSQL MCP Server provides read-only access to Microsoft SQL Server databases through MCP. It combines schema and index exploration with validated queries that prohibit data-changing statements.

Key features

  1. 01Read-only SQL operations
  2. 02Explore schemas, tables, columns, and indexes
  3. 03Validate queries and guard against injection
  4. 04Manage database connections

Use cases

  1. 01Inspect database structure before querying
  2. 02Run read-only SQL queries from an MCP client
  3. 03List accessible databases and tables

MCP support

Exposes database schema resources and tools to MCP clients, including database and table listing. Query access is limited to SELECT, DECLARE, and SET statements for local variables.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MSSQL MCP Server

A Model Context Protocol (MCP) server for read-only Microsoft SQL Server interactions. This server provides safe, read-only access to MSSQL databases through the MCP protocol.

Features

  • Read-only operations: Only SELECT, DECLARE, and SET (for local variables) queries are allowed
  • Schema exploration: Browse databases, tables, columns, and indexes
  • Safe querying: SQL injection protection and query validation
  • Connection management: Secure connection handling with proper cleanup

Installation

  1. Clone this repository:
git clone <repository-url>
cd mssql-mcp
  1. Install dependencies:
pip install -e .
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your database connection details

Important: The server automatically loads environment variables from a .env file in the current directory. Make sure to create this file with your database connection details.

Configuration

Create a .env file with your MSSQL connection details:

MSSQL_SERVER=localhost
MSSQL_DATABASE=your_database
MSSQL_USERNAME=your_username
MSSQL_PASSWORD=your_password
MSSQL_PORT=1433
MSSQL_TIMEOUT=30
MSSQL_CHARSET=UTF-8
MSSQL_AUTOCOMMIT=true

Usage

Development Mode
mcp dev src/mssql_mcp/server.py
Claude Desktop Integration
mcp install src/mssql_mcp/server.py --name "MSSQL Server"
Direct Execution
python -m mssql_mcp.server

Available Resources

  • db://schemas - List all schemas in the current database
  • db://tables/{database} - List all tables in the current database
  • db://schema_tables/{schema_name} - List tables in a specific schema
  • db://columns/{schema_name}/{table_name} - Get column information for a table
  • db://indexes/{database}/{schema_name}/{table_name} - Get index information for a table

Available Tools

  • list_databases - List all accessible databases
  • list_tables - List tables in the current database

Security

This server implements several security measures:

  • Only SELECT, DECLARE, and SET (for local variables) statements are allowed
  • SQL parsing and validation
  • Parameterized queries where possible
  • Connection string security
  • No DDL or DML operations permitted

Requirements

  • Python 3.9+
  • Access to a Microsoft SQL Server instance
  • pymssql library (automatically installed with dependencies)

License

MIT License

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.