MSSQL MCP Server

by c0h1b4
MIT License
10
  • Apple
  • Linux

MSSQL MCP サーバー

Microsoft SQL Server データベースに接続するためのモデルコンテキストプロトコル (MCP) サーバー。このサーバーは、SQL クエリの実行とデータベース接続の管理のためのツールを提供します。

**バージョンに関するお知らせ:**このプロジェクトは、Model Context Protocol SDK 1.9.0を使用するようにアップグレードされました。詳細はUPGRADE.mdをご覧ください。

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の MSSQL MCP Server を自動的にインストールするには:

npx -y @smithery/cli install @c0h1b4/mssql-mcp-server --client claude

手動インストール

npm install mssql-mcp-server

使用法

MCP 設定構成ファイルにサーバーを追加します。

{ "mcpServers": { "mssql": { "command": "mssql-mcp-server", "env": { "MSSQL_CONNECTION_STRING": "Server=localhost;Database=master;User Id=sa;Password=yourpassword;", // Or individual connection parameters: "MSSQL_HOST": "localhost", "MSSQL_PORT": "1433", "MSSQL_DATABASE": "master", "MSSQL_USER": "sa", "MSSQL_PASSWORD": "yourpassword", "MSSQL_ENCRYPT": "false", "MSSQL_TRUST_SERVER_CERTIFICATE": "true" } } } }

ツール

クエリ

MSSQL データベースで SQL クエリを実行します。

パラメータ
  • connectionString (文字列、オプション): 完全な接続文字列 (個々のパラメータの代替)
  • host (文字列、オプション): データベースサーバーのホスト名
  • port (数値、オプション): データベースサーバのポート (デフォルト: 1433)
  • database (文字列、オプション): データベース名 (デフォルト: master)
  • username (文字列、オプション): データベースのユーザー名
  • password (文字列、オプション): データベースのパスワード
  • query (文字列、必須): 実行するSQLクエリ
  • encrypt (ブール値、オプション): 暗号化を有効にする (デフォルト: false)
  • trustServerCertificate (ブール値、オプション): 信頼サーバー証明書 (デフォルト: true)

connectionStringまたは ( host + username + password ) のいずれかを指定する必要があります。

const result = await use_mcp_tool({ server_name: 'mssql', tool_name: 'query', arguments: { host: 'localhost', username: 'sa', password: 'yourpassword', query: 'SELECT * FROM Users', }, });

サーバーの実行

地域開発

# Install dependencies npm install # Run in development mode npm run dev # Build npm run build # Run the built server npm start

Dockerの使用

# Build and start services (SQL Server + MCP server) docker-compose up # Or just build the Docker image docker build -t mssql-mcp-server .

テスト

# Run tests npm test # Run tests with coverage npm run test:coverage

安全

サーバーには、危険な SQL 操作に対する安全策が組み込まれています。

  • DROP、TRUNCATE、ALTER、CREATE、EXEC などの潜在的に有害なコマンドをブロックします。
  • すべての入力パラメータとデータベース名を検証します
  • クエリの長さとタイムアウトに適切な制限を設定します
  • パフォーマンスとセキュリティを向上させるために接続プールを使用します

ライセンス

マサチューセッツ工科大学

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

モデル コンテキスト プロトコルを通じて SQL クエリの実行と Microsoft SQL Server データベース接続の管理を可能にします。

  1. Installation
    1. Installing via Smithery
    2. Manual Installation
  2. Usage
    1. Tools
      1. query
    2. Running the Server
      1. Local Development
      2. Using Docker
    3. Testing
      1. Security
        1. License

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            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.
            Last updated -
            12
            Python
            MIT License
            • Linux
            • Apple
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that enables SQL query execution, database management, and business intelligence capabilities through MySQL connections.
            Last updated -
            JavaScript
          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
            Last updated -
            1
            30
            Python
            MIT License
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.
            Last updated -
            3
            TypeScript
            MIT License

          View all related MCP servers

          ID: fo0ki6yhge