MySql MCP Server
MySQL MCP サーバー
AI モデルが構造化インターフェースを介して MySQL データベースと対話できるようにする、MySQL データベース用のモデル コンテキスト プロトコル (MCP) サーバー。
概要
MySQL MCPサーバーは、AIモデルとMySQLデータベース間のブリッジを提供し、AIエージェントがMySQLデータをクエリおよび分析できるようにします。この実装はモデルコンテキストプロトコル仕様に準拠しており、WebサーバーとCLIの両方のモードで動作します。
Related MCP server: MySQL MCP Server
特徴
MySQLデータベース接続管理
SQLクエリ実行
テーブルリストと構造検査
データベースの一覧表示と選択
SSE (Server-Sent Events) によるリアルタイムステータス監視
MCPツールをテストするためのWebインターフェース
stdioとSSEトランスポート方式の両方をサポート
Docker デプロイメント準備完了
インストール
# Global installation
npm install -g mysql-mcp
# Local installation
npm install mysql-mcpAIアシスタントと併用する
Smithery.ai の公開サーバーを使用する
MySQL MCP サーバーは Smithery.ai で公開されており、さまざまな AI アシスタントで簡単に使用できます。
サーバーにアクセスする: https://smithery.ai/server/@sussa3007/mysql-mcpにアクセスしてください
サーバーを設定します:
MySQL データベース接続の詳細を設定します。
MYSQL_HOST
MYSQL_ポート
MYSQL_ユーザー
MYSQL_パスワード
MYSQL_データベース
MYSQL_READONLY(オプション、読み取り専用アクセスの場合はTrueに設定)
サポートされている AI プラットフォームに接続します。
人類学的なクロード
カーソルAI
ウィンドサーフィン
クライン
ウィッツィー
エンコンボ
ガチョウ
認証: Smithery.ai にログインして設定を保存し、認証トークンを生成します。
AI プロンプトでの使用: 接続すると、アシスタントにデータベース操作の実行を依頼することで、AI 会話で MySQL ツールを利用できます。
ローカルインストール後の使用
ローカルで開発されたバージョンを使用するには:
プロジェクトディレクトリで
npm linkを実行します。設定ファイルを次のように構成します。
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["mysql-mcp"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database",
"MYSQL_READONLY": "true"
}
}
}
}ツール
状態
現在のデータベース接続ステータスを確認します。
入力: パラメータは不要
戻り値: 接続されている場合はホスト、ポート、データベース、ユーザー名などの接続ステータス情報。
接続する
MySQL データベースに接続します。
入力:
ホスト(オプションの文字列):データベースサーバーのホスト名またはIPアドレス
port (オプションの文字列): データベースサーバのポート
user (オプションの文字列): データベースのユーザー名
パスワード(オプションの文字列):データベースのパスワード
データベース(オプションの文字列):接続するデータベース名
戻り値: 接続成功メッセージまたはエラーの詳細。
切断する
現在の MySQL データベース接続を閉じます。
入力: パラメータは不要
戻り値: 切断成功メッセージまたはエラーの詳細。
クエリ
接続されたデータベースで SQL クエリを実行します。
入力:
sql (文字列): 実行するSQLクエリ
params (オプション配列): 準備されたステートメントのパラメータ
戻り値: JSON またはエラー メッセージとしてクエリ結果を返します。
リストテーブル
現在のデータベース内のテーブルのリストを取得します。
入力: パラメータは不要
戻り値: 現在のデータベース内のテーブル名のリスト。
テーブルの説明
特定のテーブルの構造を取得します。
入力:
テーブル (文字列): 記述するテーブルの名前
戻り値: 列、タイプ、キー、その他の属性を含むテーブル構造の詳細。
データベース一覧
サーバー上のアクセス可能なすべてのデータベースのリストを取得します。
入力: パラメータは不要
戻り値: サーバー上で使用可能なデータベース名のリスト。
データベースの使用
別のデータベースに切り替えます。
入力:
database (文字列): 切り替え先のデータベースの名前
戻り値: 確認メッセージまたはエラーの詳細。
キーワード
mysql、mcp、データベース、ai、モデルコンテキストプロトコル
ライセンス
マサチューセッツ工科大学
Available Tools
9 toolsconnectC
Connect to a MySQL database.
Inputs: database, host, password, port, +1 more.
describe_tableA
Get the structure of a specific table.
Inputs: table (required).
disconnectB
Close the current MySQL database connection.
Inputs: random_string (required).
list_databasesB
Get a list of all accessible databases on the server.
Inputs: random_string (required).
list_tablesB
Get a list of tables in the current database.
Inputs: random_string (required).
queryC
Execute an SQL query on the connected database.
Inputs: sql (required), params.
set_readonlyB
Enable or disable read-only mode
Inputs: readonly (required).
statusC
Check the current database connection status.
Inputs: random_string (required).
use_databaseB
Switch to a different database.
Inputs: database (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose with no ambiguity: connection management (connect, disconnect, status), database navigation (list_databases, use_database), table operations (list_tables, describe_table), query execution (query), and mode control (set_readonly). The descriptions reinforce non-overlapping functionality.
All tool names follow a consistent snake_case pattern with clear verb_noun combinations (e.g., list_databases, describe_table, use_database). The naming is predictable and readable throughout the set.
With 9 tools, the count is well-scoped for a MySQL database server, covering essential operations like connection management, database/table listing, query execution, and configuration. Each tool earns its place without redundancy.
The tool set provides strong coverage for core MySQL operations, including CRUD-like functionality via the query tool and lifecycle management. A minor gap is the lack of explicit tools for schema modification (e.g., create/alter/drop tables), but agents can work around this using SQL queries.
Related MCP Connectors
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Query, explore, and manage your databases through natural conversation.
Store, query, and update structured data from any AI agent
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI models to perform MySQL database operations through a standardized interface, supporting secure connections, query execution, and comprehensive schema management.779 npm33MIT
- FlicenseNot gradedqualityDmaintenanceEnables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.-
- AlicenseNot gradedqualityDmaintenanceProvides secure access to MySQL databases for AI assistants, enabling safe SQL queries, table information retrieval, and data insertion with built-in security protections.2MIT
- AlicenseAqualityDmaintenanceA tool service that enables AI agents to interact with MySQL databases through natural language, supporting SQL queries, table structure retrieval, and connection testing.732Apache 2.0