Skip to main content
Glama
amornpan

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. プルリクエストを開く

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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.
    454
    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.
    18
    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.
    454
  • 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.
    6

Latest Blog Posts

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/amornpan/py-mcp-mysql'

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