Skip to main content
Glama
RichardHan

Microsoft SQL Server MCP Server

by RichardHan

Microsoft SQL Server MCP-Server

Ein Model Context Protocol (MCP)-Server, der eine sichere Interaktion mit Microsoft SQL Server-Datenbanken ermöglicht. Dieser Server ermöglicht KI-Assistenten das Auflisten von Tabellen, das Lesen von Daten und die Ausführung von SQL-Abfragen über eine kontrollierte Schnittstelle. Dadurch wird die Datenbankerkundung und -analyse sicherer und strukturierter.

Merkmale

  • Auflisten der verfügbaren SQL Server-Tabellen als Ressourcen

  • Tabelleninhalt lesen

  • Ausführen von SQL-Abfragen mit ordnungsgemäßer Fehlerbehandlung

  • Sicherer Datenbankzugriff durch Umgebungsvariablen

  • Umfassende Protokollierung

  • Automatische Installation von Systemabhängigkeiten

Related MCP server: SQL Server MCP

Installation

Das Paket installiert automatisch erforderliche Systemabhängigkeiten (wie FreeTDS), wenn es über MCP installiert wird:

pip install mssql-mcp-server

Konfiguration

Legen Sie die folgenden Umgebungsvariablen fest:

MSSQL_SERVER=localhost
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DATABASE=your_database

Verwendung

Mit Claude Desktop

Fügen Sie dies zu Ihrer claude_desktop_config.json hinzu:

{
  "mcpServers": {
    "mssql": {
      "command": "uv",
      "args": [
        "--directory", 
        "path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
      ],
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password",
        "MSSQL_DATABASE": "your_database"
      }
    }
  }
}

Als eigenständiger Server

# Install dependencies
pip install -r requirements.txt

# Run the server
python -m mssql_mcp_server

Entwicklung

# Clone the repository
git clone https://github.com/RichardHan/mssql_mcp_server.git
cd mssql_mcp_server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
pytest

Sicherheitsüberlegungen

  • Übernehmen Sie niemals Umgebungsvariablen oder Anmeldeinformationen.

  • Verwenden Sie einen Datenbankbenutzer mit den minimal erforderlichen Berechtigungen

  • Erwägen Sie die Implementierung einer Abfrage-Whitelist für den Produktionseinsatz

  • Überwachen und protokollieren Sie alle Datenbankvorgänge

Bewährte Sicherheitspraktiken

Dieser MCP-Server benötigt Datenbankzugriff. Aus Sicherheitsgründen:

  1. Erstellen Sie eine dedizierte SQL Server-Anmeldung mit minimalen Berechtigungen

  2. Verwenden Sie niemals SA-Anmeldeinformationen oder Administratorkonten

  3. Beschränken Sie den Datenbankzugriff auf die unbedingt erforderlichen Vorgänge

  4. Aktivieren Sie die Protokollierung für Prüfzwecke

  5. Regelmäßige Sicherheitsüberprüfungen des Datenbankzugriffs

Ausführliche Anweisungen zu folgenden Themen finden Sie im SQL Server-Sicherheitskonfigurationshandbuch :

  • Erstellen einer eingeschränkten SQL Server-Anmeldung

  • Festlegen geeigneter Berechtigungen

  • Überwachen des Datenbankzugriffs

  • Bewährte Sicherheitsmethoden

⚠️ WICHTIG: Befolgen Sie beim Konfigurieren des Datenbankzugriffs immer das Prinzip der geringsten Privilegien.

Lizenz

MIT-Lizenz – Einzelheiten finden Sie in der Datei LICENSE.

Beitragen

  1. Forken Sie das Repository

  2. Erstellen Sie Ihren Feature-Zweig ( git checkout -b feature/amazing-feature )

  3. Übernehmen Sie Ihre Änderungen ( git commit -m 'Add some amazing feature' )

  4. Pushen zum Zweig ( git push origin feature/amazing-feature )

  5. Öffnen einer Pull-Anfrage

Available Tools

1 tool
execute_sqlC

Execute an SQL query on the SQL Server

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL query to execute

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description fails to disclose whether queries are read-only or can modify data, potential risks like SQL injection, or result formats. This is a significant gap for a tool that can execute arbitrary SQL.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise at one sentence, but it lacks structure and does not front-load key information beyond the basic action. It could include more detail without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description is incomplete. It does not explain what the tool returns (e.g., result sets, affected rows), error behavior, or any constraints. Critical context for safe usage is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has high coverage (100%) and describes the 'query' parameter sufficiently. The description adds no extra meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'execute' and the resource 'SQL query on the SQL Server', making the purpose straightforward. However, it restates the tool name without adding depth beyond stating it runs queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool or when to avoid it. No mention of prerequisites, security considerations, or alternatives. The description provides no contextual usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedexecute_sql

TDQS

B3/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no risk of confusion or overlap.

Naming Consistency5/5

With a single tool, naming is trivially consistent to itself.

Tool Count2/5

A single SQL execution tool is insufficient for the typical scope of SQL Server operations, which usually requires multiple tools for schema exploration, query execution, and data manipulation.

Completeness2/5

The tool set is severely incomplete; it lacks fundamental operations such as listing tables, describing schemas, or managing databases, limiting useful agent workflows.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

  • Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.

  • Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema

  • The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.

  • The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A Model Context Protocol server that enables secure and structured interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries with controlled access.
    59
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants (Cursor, Windsurf, Claude Code) to interact with Microsoft SQL Server databases by providing connectivity through environment-configurable connections.
    8
    585 npm
    8
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides AI assistants with comprehensive access to SQL databases, enabling schema inspection, query execution, and database operations with enterprise-grade security.
    25 npm
    9
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides comprehensive access to Microsoft SQL Server databases, enabling Language Models to inspect schemas, execute queries, manage database objects, and perform advanced database operations.
    8
    -