Skip to main content
Glama

MCP MySQL Server

by kevinbin

@enemyrr/mcp-mysql-server

MySQLデータベース操作を提供するモデルコンテキストプロトコルサーバー。このサーバーにより、AIモデルは標準化されたインターフェースを介してMySQLデータベースと対話できるようになります。

カーソルIDEのインストールとセットアップ

Smithery経由でインストール

Smithery経由で Claude Desktop 用の MySQL データベース サーバーを自動的にインストールするには:

npx -y @smithery/cli install @enemyrr/mcp-mysql-server --client claude

手動でインストールする

  1. プロジェクトをクローンしてビルドします。
git clone https://github.com/enemyrr/mcp-mysql-server.git cd mcp-mysql-server npm install npm run build
  1. Cursor IDE 設定にサーバーを追加します。
    • コマンドパレットを開く (Cmd/Ctrl + Shift + P)
    • 「MCP: サーバーの追加」を検索
    • 以下のフィールドに入力します:
      • 名前: mysql
      • タイプ: command
      • コマンド: node /absolute/path/to/mcp-mysql-server/build/index.js

: /absolute/path/to/プロジェクトをクローンしてビルドした実際のパスに置き換えます。

データベース構成

データベース接続は次の 3 つの方法で構成できます。

  1. .env 内のデータベース URL (推奨):
DATABASE_URL=mysql://user:password@host:3306/database
  1. .env 内の個々のパラメータ:
DB_HOST=localhost DB_USER=your_user DB_PASSWORD=your_password DB_DATABASE=your_database
  1. ツール経由の直接接続:
use_mcp_tool({ server_name: "mysql", tool_name: "connect_db", arguments: { url: "mysql://user:password@host:3306/database" // OR workspace: "/path/to/your/project" // Will use project's .env // OR host: "localhost", user: "your_user", password: "your_password", database: "your_database" } });

利用可能なツール

1. connect_db

URL、ワークスペース パス、または直接の資格情報を使用して MySQL データベースに接続します。

2. クエリ

オプションの準備されたステートメント パラメータを使用して SELECT クエリを実行します。

use_mcp_tool({ server_name: "mysql", tool_name: "query", arguments: { sql: "SELECT * FROM users WHERE id = ?", params: [1] } });

3. 実行する

オプションの準備されたステートメント パラメータを使用して、INSERT、UPDATE、または DELETE クエリを実行します。

use_mcp_tool({ server_name: "mysql", tool_name: "execute", arguments: { sql: "INSERT INTO users (name, email) VALUES (?, ?)", params: ["John Doe", "john@example.com"] } });

4. list_tables

接続されたデータベース内のすべてのテーブルを一覧表示します。

use_mcp_tool({ server_name: "mysql", tool_name: "list_tables" });

5. テーブルの説明

特定のテーブルの構造を取得します。

use_mcp_tool({ server_name: "mysql", tool_name: "describe_table", arguments: { table: "users" } });

6. テーブルを作成する

指定されたフィールドとインデックスを持つ新しいテーブルを作成します。

use_mcp_tool({ server_name: "mysql", tool_name: "create_table", arguments: { table: "users", fields: [ { name: "id", type: "int", autoIncrement: true, primary: true }, { name: "email", type: "varchar", length: 255, nullable: false } ], indexes: [ { name: "email_idx", columns: ["email"], unique: true } ] } });

7. 列の追加

既存のテーブルに新しい列を追加します。

use_mcp_tool({ server_name: "mysql", tool_name: "add_column", arguments: { table: "users", field: { name: "phone", type: "varchar", length: 20, nullable: true } } });

特徴

  • 複数の接続方法(URL、ワークスペース、直接)
  • 自動クリーンアップによる安全な接続処理
  • クエリパラメータの準備済みステートメントのサポート
  • スキーマ管理ツール
  • 包括的なエラー処理と検証
  • TypeScriptサポート
  • 自動ワークスペース検出

安全

  • SQLインジェクションを防ぐために準備されたステートメントを使用する
  • 環境変数による安全なパスワード処理をサポート
  • 実行前にクエリを検証します
  • 完了すると自動的に接続が閉じられます

エラー処理

サーバーは、次の詳細なエラー メッセージを提供します。

  • 接続失敗
  • 無効なクエリまたはパラメータ
  • 構成がありません
  • データベースエラー
  • スキーマ検証エラー

貢献

貢献を歓迎します!お気軽にhttps://github.com/enemyrr/mcp-mysql-serverにプルリクエストを送信してください。

ライセンス

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

-
security - not tested
-
license - not tested
-
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.

標準化されたインターフェースを介して AI モデルが MySQL データベースと対話できるようにし、クエリ、コマンドの実行、データベース スキーマの管理のためのツールを提供するモデル コンテキスト プロトコル サーバー。

  1. カーソルIDEのインストールとセットアップ
    1. Smithery経由でインストール
    2. 手動でインストールする
  2. データベース構成
    1. 利用可能なツール
      1. connect\_db
      2. クエリ
      3. 実行する
      4. list\_tables
      5. テーブルの説明
      6. テーブルを作成する
      7. 列の追加
    2. 特徴
      1. 安全
        1. エラー処理
          1. 貢献
            1. ライセンス

              Related MCP Servers

              • -
                security
                -
                license
                -
                quality
                A Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.
                Last updated -
                MIT License
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server that enables AI models to interact with both MySQL and MongoDB databases through a standardized interface, supporting comprehensive database operations including queries, schema management, and CRUD operations.
                Last updated -
                14
                6
                JavaScript
                MIT License
              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.
                Last updated -
                2
                Python
                • Linux
                • Apple
              • A
                security
                F
                license
                A
                quality
                A Model Context Protocol server that allows AI agents to execute SQL queries against a MySQL database, supporting operations like reading data, creating tables, inserting, updating, and deleting records.
                Last updated -
                6
                419
                1
                JavaScript
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/kevinbin/mcp-mysql-server'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server