MySQL MCP Server

Integrations

  • Uses .ENV files for configuration of MySQL connection details including host, username, password, and database name

  • Provides direct access to MySQL databases, allowing execution of SQL queries, table management, and storage of notes with title and content in a MySQL database

  • Runs on Node.js runtime (version 18 or higher) as the execution environment for the MCP server

MySQL MCP サーバー

MySQLデータベースへの直接アクセスを提供する強力なMCPサーバー。このサーバーにより、AIエージェントはMySQLデータベースと対話し、SQLクエリを実行し、シンプルなインターフェースを通じてデータベースコンテンツを管理できるようになります。

特徴

リソース

  • データベースに保存されているノートにnote:///{id} URI 経由でアクセスします。
  • 各メモにはタイトルと内容があります
  • シンプルなコンテンツアクセスのためのプレーンテキスト MIME タイプ

ツール

  • create_note - データベースに新しいテキストノートを作成する
    • タイトルとコンテンツを必須パラメータとして受け取ります
    • MySQLデータベースにメモを保存する
  • list_tables - 接続されたデータベース内のすべてのテーブルを一覧表示します
  • count_tables - データベース内のテーブルの合計数を取得します
  • search_tables - LIKEパターンを使用してテーブルを検索する
  • describe_table - 特定のテーブルの構造を取得する
  • execute_sql - カスタムSQLクエリを実行する

前提条件

  • Node.js 18以上
  • MySQLサーバーがインストールされ、実行中
  • 適切な権限を持つデータベース

設定

  1. このリポジトリをクローンします:
    git clone git@github.com:LeonMelamud/mysql-mcp.git cd mysql-mcp
  2. 依存関係をインストールします:
    npm install
  3. MySQL 接続の詳細を含む.envファイルをルート ディレクトリに作成します。
    MYSQL_HOST=localhost MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=your_database
  4. サーバーを構築します。
    npm run build

インストール

クロードデスクトップ向け

Claude Desktop 構成ファイルにサーバー構成を追加します。

MacOS の場合: ~/Library/Application Support/Claude/claude_desktop_config.json Windows の場合: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "mysql": { "command": "node", "args": ["/path/to/mysql-server/build/index.js"], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" } } } }

クラインのために

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

MacOS の場合: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json Windows の場合: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

{ "mcpServers": { "mysql": { "command": "node", "args": ["/path/to/mysql-server/build/index.js"], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" }, "disabled": false, "autoApprove": [] } } }

使用例

インストールが完了すると、Claude との会話で MySQL MCP サーバーを使用できるようになります。

データベース内のすべてのテーブルを一覧表示する

Please list all the tables in my MySQL database.

SQLクエリを実行する

Run this SQL query: SELECT * FROM users LIMIT 5

メモを作成する

Create a note titled "Meeting Notes" with the content "Discussed project timeline and assigned tasks."

発達

自動リビルドを使用した開発の場合:

npm run watch

デバッグ

MCP Inspector を使用してサーバーをデバッグします。

npm run inspector

インスペクターは、ブラウザでデバッグ ツールにアクセスするための URL を提供します。

ライセンス

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

-
security - not tested
F
license - not found
-
quality - not tested

AI エージェントが MySQL データベースと対話し、SQL クエリを実行し、シンプルなインターフェースを通じてデータベース コンテンツを管理できるようにする強力なサーバーです。

  1. Features
    1. Resources
    2. Tools
  2. Prerequisites
    1. Setup
      1. Installation
        1. For Claude Desktop
        2. For Cline
      2. Usage Examples
        1. List all tables in the database
        2. Execute a SQL query
        3. Create a note
      3. Development
        1. Debugging
      4. License
        ID: cp6c716buh