2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AIがワイのためにER図を書いて分析レポートを保存してくれるなんて

Last updated at Posted at 2025-06-09

AIがワイのためにER図を書いて分析レポートを保存してくれるなんて

人から引き継いだアプリのデータ構造が不明...
ドキュメントもない...このデータベースは一体なんなんだ!
そんな"あるある"に苦しむあなたに贈る、Claude × MCP × Mermaid × MySQL の“可視化爆速レシピ”。


✅ やること

  1. リモートMySQLを mysqldump で取得
  2. ローカルにMySQL復元
  3. ClaudeでER図を生成
  4. filesystemサーバ経由で ローカル保存

1. 前提

項目 内容例
リモートDB MySQL 8.x系、SSHで接続可
ローカル環境 macOS + Homebrew MySQL 9.x
MCPクライアント Claude Sonnet4
MCPサーバ MySQL用, filesystem用
Claude拡張 Model Context Protocol プラグインが有効であること

2. mysqldump でリモートDBをバックアップ

mysqldump -u <remote_user> -p <remote_db> > dump.sql
gzip dump.sql

3. scpでローカルへ

scp <remote_user>@<remote_host>:~/dump.sql.gz ~/Downloads/
cd ~/Downloads && gunzip dump.sql.gz

4. ローカルMySQLに復元

mysql -u <local_user> -p -e "CREATE DATABASE <local_db>;"
mysql -u <local_user> -p <local_db> < dump.sql

5. .mcp.json の設定(Claudeで使う)

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@benborla29/mcp-server-mysql",
        "--dsn",
        "mysql://<user>:<password>@127.0.0.1:3306/<your_db_name>"
      ],
      "env": {
        "MYSQL_ENABLE_LOGGING": "false",
        "MYSQL_LOG_LEVEL": "info"
      },
      "disabled": false,
      "autoApprove": []
    },
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/your/directory"
      ]
    }
  }
}

6. Claude へのプロンプト例

Claudeに以下の指示を送信:

<<your_db_name>> MySQLデータベース構造分析した上でER図を作成して保存してください

→ 出力例:
スクリーンショット 2025-06-09 21.54.11.png
スクリーンショット 2025-06-09 21.54.36.png
ER図を作成するだけでなく、なぜか分析レポートまで書いてローカルに保存してくれました。


✅ おわりに:データ構造の把握・修正、サクッと可視化から始めませんか?

Claude × MCP では、ノーコードで設計図を生成、保存のすべてが簡単になります。良い時代に生まれたもので、データ構造の把握と修正に力を入れられます。

見える化したいDB、Claudeに見せよう


ちょこっと宣伝

ワークスタープロは40代~60代以上のエンジニア&IT経験者向けの、
シニアIT人材のためのフリーランスマッチングサービスを運営し始めました。

☑ ご興味がある方は → https://workstarpro.com


🔗 参考リンク

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?