0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Docker MCP Toolkitをdocker Desktopなしで使いたい!【Docker MCP Gateway】

Last updated at Posted at 2025-07-26

概要

MCPサーバ、いろんなものが出てきて、試してみたいものもどんどん増えています。
ただ毎回調べて設定追記するのって結構めんどくさい...複数のAIエージェント使うのもちょっとめんどくさいし...
それを解決するサービスがDockerから出ているそうです。DockerコンテナとしてMCPサーバを1つ用意すれば、複数のAIエージェントで使いまわせるらしい!

導入が簡単なのはDokcer Desktopらしいですが、うちは宗派により使えません。Linuxに直で導入したDockerEngineでもどうにか使えないか...

それを満たしてくれる、Docker MCP Gatewayというサービスがあるみたいなので、それを用いて簡単MCPサーバ導入環境を構築していこうと思います!

Docker MCP Gatewayとは?

以下の記事がわかりやすかったです。

イメージとしてはこんな感じ。Docker MCP Gatewayが文字通りGatewayとなって、いろんなクライアントからのMCP呼び出しを一元管理してくれます。
なので、Docker MCP Gateway側にMCPサーバの情報を登録して、MCPクライアントにはGatewayの情報だけを登録しておけば、簡単にいろんなMCPサーバを使いまわせます!

image.png

Docker MCP Gatewayの導入

前提

DockerエンジンがWSL2上に導入されているものとします。導入方法は以下。
また下記コマンドは基本WSL2上で実行するものとします。

ダウンロード&インストール

dockerのプラグインの形で公開されているので、ダウンロードして導入します。

公式のやり方ではgoが必要になるので、直接wgetでダウンロードしてきます

# ダウンロード 2025/07/26時点ではv0.13.0が最新
wget https://github.com/docker/mcp-gateway/releases/download/v0.13.0/docker-mcp-linux-amd64.tar.gz

# 解凍
tar zxvf docker-mcp-linux-amd64.tar.gz

# dockerのプラグインディレクトリに移動
mv docker-mcp ~/.docker/cli-plugins

# 実行権限の付与
chmod +x ~/.docker/cli-plugins/docker-mcp

以上でOK!導入が完了しているか確認するために、バージョンを確認しましょう

バージョン確認

docker mcp --version

v0.13.0

以上で導入は完了です!

実際の利用まで

MCPサーバのカタログ確認

実際に使いたいMCPサーバをインストールしていきます。
デフォルトではDocker MCP Catalogというものが導入されており、以下コマンドで導入可能なMCPサーバのリストを確認できます。

docker mcp catalog show

Ref: Ref powerful search tool connets your coding tools with documentation context. It includes an up-to-date index of public documentation and it can ingest your private documentation (eg. GitHub repos, PDFs) as well.
SQLite: Database interaction and business intelligence capabilities.
arxiv-mcp-server: The ArXiv MCP Server provides a comprehensive bridge between AI assistants and arXiv's research repository through the Model Context Protocol (MCP).   Features: • Search arXiv papers with advanced filtering • Download and store papers locally as markdown • Read and analyze paper content • Deep research analysis prompts • Local paper management and storage  Perfect for researchers, academics, and AI assistants conducting literature reviews and research analysis.
astra-db: An MCP server for Astra DB workloads.
...

以下のサイトでも確認できます。

MCPサーバのインストール

例えばplaywrightを有効にしたければ、次のコマンドを打つだけ!

docker mcp server enable playwright

その他、お好きなMCPサーバを有効にしてみてください。

Github Copilotからの呼び出し(WSL2上)

WSL2のVSCodeから、Gatewayを呼び出すための設定を行います。

  1. Ctrl + Shift + Pからコマンドパレットを開く

  2. MCP:Add Serverを選択
    image.png

  3. Commandを選択
    image.png

  4. mcpサーバ起動用のコマンドを登録
    今回はdocker mcp gateway run
    image.png

  5. mcpサーバIDを登録
    今回は適当にdocker-mcp-gatewayと登録
    image.png

  6. 登録する範囲を選択
    今回はWSL2上ではどこでも扱えるようにしたいので、Remoteを選択
    image.png
    成功すれば、こんな感じでMCP起動用の設定が記述されるはずです。
    image.png

  7. MCPサーバの確認
    チャットから設定マークをクリックすれば、現在有効になっているMCPツールが一覧で確認できます!しっかり先ほどインストールしたplaywrightやdockerなどが有効になっていることが確認できます。
    image.png

使ってみる

こんな感じで、MCPが利用できています!
image.png

ローカルサーバとして起動

このままだとDockerが呼び出せる環境、つまりWSL2でしか呼び出せずホストのWindows側から呼び出せないので、呼び出せるように起動の仕方を変更します。

WSL2上で次のコマンドで、streamingHTTPモードでMCPサーバを起動します

docker mcp gateway run --transport streaming --port 8080

- Reading configuration...
  - Reading registry from registry.yaml
  - Reading catalog from [docker-mcp.yaml]
  - Reading config from config.yaml
- Configuration read in 9.507008ms
- Using images:
  - docker@sha256:5415fccf3da3aed821efb2258cb7dcf52fb9bb0627b02d45338e887c352c4bce
  - mcp/git@sha256:ad6af958e79466a14b895891e772fdda28fdc12c06fff4a70637b66773303a2c
  - mcp/playwright@sha256:668a6c8f5deb0b50abd21cff145d81a06b6695d77672410f204e2f12ae870944
> Images pulled in 849.11µs
- Those servers are enabled: docker, git, playwright
- Listing MCP tools...
  - Running mcp/playwright with [run --rm -i --init --security-opt no-new-privileges --cpus 1 --memory 2Gb --pull never -l docker-mcp=true -l docker-mcp-tool-type=mcp -l docker-mcp-name=playwright -l docker-mcp-transport=stdio]
  - Running mcp/git with [run --rm -i --init --security-opt no-new-privileges --cpus 1 --memory 2Gb --pull never -l docker-mcp=true -l docker-mcp-tool-type=mcp -l docker-mcp-name=git -l docker-mcp-transport=stdio]
  > git: (12 tools)
  > playwright: (24 tools)
> 37 tools listed in 601.401533ms
- Watching for configuration updates...
> Initialized in 616.024432ms
> Start streaming server on port 8080

同じようにVSCode側でこのMCPサーバを登録します。
コマンドパレット > MCP:Add Server
image.png

起動時に指定したポート番号のURLを登録
image.png

適当にサーバのIDも登録すれば、同じように使えるようになります。

Gemini CLIでも使えるように設定してみる

ホームディレクトリの/.gemini/settings.jsonに、以下MCPサーバ用の設定を追記します。

/.gemini/settings.json
{
  "theme": "Default",
  "selectedAuthType": "oauth-personal",
  // 下記を追加
  "mcpServers": {
    "docker-mcp-gateway": {
      "httpUrl": "http://localhost:8080"
    }
  }
}

この状態でGeminiを起動し、/mcpを実行すると、しっかり認識されていました!
image.png

感想

使ってみて、いいところは以下二つだと思います。

  • 追加のMCPサーバを導入するときはコマンド1行でできるので楽
  • もしAIエージェントツールを変えても同じMCPサーバ構成で実行できる

MCPサーバって種類増えてきているので、セキュリティがある程度担保されたものを一覧として確認でき、簡単に試せるってところが結構いいところな気がします。
またリモートサーバとしても構築できるみたいなので、だれか一人が構築すれば同じものを使える、というのも素晴らしい。
ぜひMCPサーバ活用していきましょう!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?