0
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?

IBM BobにMCPサーバーを設定する: D2 MCP接続方法

0
Posted at

簡単な接続のメモを記する。

D2で図を作ると格好いいので、D2 MCPサーバーを入れてみた。
理由は、cheat sheetをAI Agentに知ってほしいし、コンパイルしてチェックしてほしいからである。Markdownに入れ込んでレンダリングするとエラーになることを避けたい。生成する時点でAIに直してほしいわけ。

手順

1. IBM Bobで設定

プロジェクト毎に設定する場合:

.bob/mcp.json
{
  "mcpServers": {
    "d2": {
      "type": "stdio",
      "command": "podman",
      "args": [
        "run",
        "--rm",
        "-i",
        "--platform",
        "linux/amd64",
        "ghcr.io/h0rv/d2-mcp:main",
        "--image-type",
        "svg"
      ],
      "alwaysAllow": [
        "render-d2",
        "fetch_d2_cheat_sheet",
        "compile-d2"
      ]
    }
  }
}
  • 公式ガイドと異なる点 "--platform", "linux/amd64" である。なぜならば、ARM64のイメージが公開されていないので linuxのものを使う。少し遅いらしいけど互換性あり。自分の用途には十分である
  • 元のファイルを変更できない設定:-v "$(pwd)":/data \--write-filesを与えないこと。
  • "render-d2", "fetch_d2_cheat_sheet", "compile-d2"ツールを許可

IBM BobのUIでも確認できる。

Command Pallete > MCP Servers

Screenshot 2026-03-18 at 1.15.13.png

2. 利用してみる

プロンプトの例

Fetch d2 cheat sheet from d2 mcp

以上

See you later🐊

0
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
0
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?