Skip to main content
Glama
MySQL MCP Server

MySQL MCP Server

by amornpan

テスト

MySQL MCP サーバー

MySQLデータベースとの安全なやり取りを可能にするモデルコンテキストプロトコル(MCP)サーバー。このサーバーにより、AIアシスタントは制御されたインターフェースを介してテーブルの一覧表示、データの読み取り、SQLクエリの実行が可能になり、データベースの探索と分析をより安全かつ構造化できます。

特徴

  • 利用可能な MySQL テーブルをリソースとして一覧表示する

  • 表の内容を読む

  • 適切なエラー処理でSQLクエリを実行する

  • 環境変数による安全なデータベースアクセス

  • 包括的なログ記録

Related MCP server: MCP MySQL Server

構成

次の環境変数を設定します。

MYSQL_HOST=localhost     # Database host
MYSQL_PORT=3306         # Optional: Database port (defaults to 3306 if not specified)
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database

使用法

クロード・デスクトップ

これをclaude_desktop_config.jsonに追加します:

{
  "mcpServers": {
    "mysql": {
      "command": "python",
      "args": [
        "-m", 
        "src.mysql_mcp_server.server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

スタンドアロンサーバーとして

# Clone the repository
git clone https://github.com/designcomputer/mysql_mcp_server.git
cd mysql_mcp_server

# Install dependencies
pip install -r requirements.txt

# Run the server
python -m src.mysql_mcp_server.server

発達

# Clone the repository
git clone https://github.com/designcomputer/mysql_mcp_server.git
cd mysql_mcp_server

# Create virtual environment
python -m venv py-mcp-mysql_venv
source py-mcp-mysql_venv/bin/activate  # or `py-mcp-mysql_venv\Scripts\activate` on Windows

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
pytest

セキュリティに関する考慮事項

  • 環境変数や資格情報をコミットしないでください

  • 必要最小限の権限を持つデータベースユーザーを使用する

  • 本番環境での使用にクエリホワイトリストを実装することを検討する

  • すべてのデータベース操作を監視して記録する

セキュリティのベストプラクティス

このMCPサーバーは機能するためにデータベースへのアクセスが必要です。セキュリティのため:

  1. 最小限の権限を持つ専用のMySQLユーザーを作成する

  2. ルート認証情報や管理者アカウントは使用しないでください

  3. 必要な操作のみにデータベースアクセスを制限する

  4. 監査目的でログを有効にする

  5. データベースアクセスの定期的なセキュリティレビュー

詳細な手順については、 MySQL セキュリティ構成ガイドを参照してください。

  • 制限付きMySQLユーザーの作成

  • 適切な権限の設定

  • データベースアクセスの監視

  • セキュリティのベストプラクティス

⚠️ 重要: データベース アクセスを構成するときは、常に最小権限の原則に従ってください。

ライセンス

MIT ライセンス - 詳細については LICENSE ファイルを参照してください。

貢献

  1. リポジトリをフォークする

  2. 機能ブランチを作成します( git checkout -b feature/amazing-feature )

  3. 変更をコミットします ( git commit -m 'Add some amazing feature' )

  4. ブランチにプッシュする ( git push origin feature/amazing-feature )

  5. プルリクエストを開く

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides secure access to MySQL databases for AI assistants, enabling safe SQL queries, table information retrieval, and data insertion with built-in security protections.
    794 npm
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to safely query MySQL databases with read-only access by default, supporting table listing, structure inspection, and SQL queries with optional write operation control.
    11 npm
    MIT
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to securely interact with MySQL databases through tools for query execution, schema inspection, and transaction management. It features built-in safety controls like row limits and query validation to ensure safe and standardized database access.
    794 npm
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to securely interact with MySQL databases, including listing tables, viewing schemas, and executing read-only SQL queries through natural language.
    7
    -