DM

daobataotie/mssql-mcp

Database management

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

39 stars 11 forks Качество 84 Тренд 8MIT

daobataotie/mssql-mcp - кандидат на сервер MCP, импортированный из https://github.com/daobataotie/mssql-mcp.

Обзор

daobataotie/mssql-mcp - кандидат на сервер MCP, импортированный из https://github.com/daobataotie/mssql-mcp.

Обзор (машинный перевод)

Английский | 中

Обзор

MSSQL MCP Сервер обеспечивает взаимодействие с базой данных и возможности бизнес-аналитики. Этот сервер позволяет запускать SQL-запросы, анализировать бизнес-данные и автоматически генерировать бизнес-памятки. Обратитесь к официальному сайту SQLite для модификаций, чтобы адаптироваться к MSSQL.

Построенный на официальном MCP Python SDK (FastMCP), поддерживающий спецификацию MCP 2025-06-18: вывод структурированных инструментов ([T0]), аннотации инструментов, шаблоны ресурсов и подтверждение записи на основе вызывания.

Основные моменты:

Мульти-база данных — установка соединений dev/staging/prod в одном сервере; каждый инструмент принимает необязательный database параметр, каждое соединение со своими readonly/query_timeout/max_rows/confirm_writes настройками -Хранимые процедуры - списки подписей и выполнение процедур с полным многорезультатным сбором урожая Материалы ресурсов — schema://{database}/{schema}/{table} обслуживают структуры таблиц по требованию без сжигания токенов схемы инструмента на каждом шагу Охранные ограждения безопасности — SQL-белый список, режим только для чтения, ограничения строк, тайм-ауты запросов, дополнительное подтверждение вызывания перед записью

Компоненты

  • [[Т7]]

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

MSSQL MCP Server

English | 中文

Overview

MSSQL MCP Server, provides database interaction and business intelligence capabilities. This server enables running SQL queries, analyzing business data, and automatically generating business insight memos.
Refer to the official website’s SQLite for modifications to adapt to MSSQL.

Built on the official MCP Python SDK (FastMCP), supporting the MCP 2025-06-18 specification: structured tool output (structuredContent), tool annotations, resource templates, and elicitation-based write confirmation.

Highlights:

  • Multi-database — mount dev/staging/prod connections in one server; every tool takes an optional database parameter, each connection with its own readonly / query_timeout / max_rows / confirm_writes settings
  • Stored procedures — list signatures and execute procedures with full multi-result-set harvesting
  • Resource templates — schema://{database}/{schema}/{table} serves table structures on demand without burning tool-schema tokens every turn
  • Safety guardrails — SQL whitelisting, read-only mode, row limits, query timeouts, optional elicitation confirmation before writes

Components

  • read_query
    • Execute SELECT / WITH queries with structured output (columns / rows / row_count / truncated), limited by max_rows
  • write_query
    • Execute INSERT, UPDATE, DELETE or MERGE queries, returns affected row count
  • create_table
    • Create new tables in the database
  • list_tables
    • Get a list of all tables in the database (schema + table name)
  • list_views
    • Get a list of all views in the database
  • describe_table
    • View full schema for a specific table (type, nullable, default, primary key, identity, foreign keys, indexes)
  • list_databases
    • List configured database connections (name, readonly, is_default)
  • list_procedures
    • List stored procedures with parameter signatures
  • execute_procedure
    • Execute a stored procedure (supports multiple result sets)
  • append_insight
    • Add new business insights to the memo resource

Resources

  • memo://insights — a living business-insights memo, updated in real time via append_insight
  • schema://{schema}/{table} — table structure of the default database (JSON: columns / PK / identity / FKs / indexes)
  • schema://{database}/{schema}/{table} — table structure of a named database connection

Resource templates are fetched on demand: unlike tool schemas they are not resent to the LLM every turn, which keeps long conversations lean.

Security

All SQL goes through static validation before execution:

  • read_query only accepts a single SELECT / WITH statement and rejects any write or EXEC keyword (blocks e.g. WITH c AS (...) DELETE FROM t)
  • write_query uses a whitelist (INSERT / UPDATE / DELETE / MERGE only); EXEC, DROP, TRUNCATE, ALTER are rejected
  • Multi-statement batches (separated by ;) are rejected
Открыть полный README на GitHub

Установка

npx -y @modelcontextprotocol/inspector python C:\\mssql-mcp\\src\\server.py
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

# add to claude_desktop_config.json. Note:use your path { "mcpServers": { "mssql": { "command": "python", "args": [ # your path,e.g.:"C:\\mssql-mcp\\src\\server.py" "~/server.py" ] } } }