Claude Desktop で MCPサーバを使う

設定

開発者モードにする

Claude Desktop を開発者モードにする必要があります。
※初回のみ設定。
(開発者モードへ変更すると自動でアプリが終了します)
Claude Desktop Developer Mode

設定ファイル編集

Claude Desktop の claude_desktop_config.json ファイルを編集します。
※要アプリ再起動。
(常駐している場合は、タスクバーから Quit する必要あり)。

例えば、Filesystem MCP サーバの場合、公式サイトにサンプルがあります。
※各 MCP サーバの GitHub にも同様にサンプルあり。

For Claude Desktop Users – Model Context Protocol (MCP)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop",
        "/Users/username/Downloads"
      ]
    }
  }
}

This configuration file tells Claude for Desktop which MCP servers to start up every time you start the application. In this case, we have added one server called “filesystem” that will use the Node npx command to install and run @modelcontextprotocol/server-filesystem.

この設定ファイルは、Claude for Desktop に対し、アプリケーションの起動時にどの MCP サーバーを起動するかを指定します。今回の場合は、「filesystem」というサーバーを 1 つ追加し、Node.js の npx コマンドを使用して @modelcontextprotocol/server-filesystem をインストールして実行します。

こちらの場合は、説明にあるとおり node が必要。

前述の通り、各 MCP サーバの GitHub にもサンプルありますが、こちらには Docker 版の記載もあります。

servers/src/filesystem at main · modelcontextprotocol/servers

{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
        "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
        "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
        "mcp/filesystem",
        "/projects"
      ]
    }
  }
}

複数指定する場合

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop",
        "/Users/username/Downloads"
      ]
    },
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"]
    }
  }
}

uvx は Python のパッケージマネージャ uv に付属するツールなので、未導入であれば要導入。
command はフルパス記述も OK.