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

MCPサーバーをClaude Desktopに読み込めない問題を解決した

Posted at

↑の記事で公式チュートリアルのMCPサーバーも読み込めなかったので調査した(以下がエラー画面)

image.png

結論から

Node Version Managerを使っていたので、npxを見つけられなかった模様。
なので、zsh上でwhich npxをして出力される文字列をclaude_desktop_config.jsoncommandに書き込む必要があった。(私の場合はnodenvを使用していたので、以下のように修正した)

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

調査の過程

↑に従って進めた。

Nodeバージョン調査

node_version.jpg

MCP Inspector

ずっと気になっていた調査用ツールをいよいよ使ってみた

open_inspector.jpg

Connectしてみると、特にエラーもなく接続できた。

connect_mcp_server.jpg

スクリーンショット 2025-04-22 9.01.04.png

List Toolsからツール一覧が表示され、各機能を使えるようになっている。

スクリーンショット 2025-04-22 9.02.00.png

問題なく使えているようだ。

Claude Desktopでデバッグする

Checking server status

該当のアイコンが表示されなかったので、ログを見てみることにする。

Viewing logs

mcp-server-filesystem.logの中身を見てみる

2025-04-22T00:15:39.736Z [filesystem] [info] Initializing server...
2025-04-22T00:15:39.772Z [filesystem] [info] Server started and connected successfully
2025-04-22T00:15:39.774Z [filesystem] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
env: node: No such file or directory
2025-04-22T00:15:39.779Z [filesystem] [info] Server transport closed
2025-04-22T00:15:39.779Z [filesystem] [info] Client transport closed
2025-04-22T00:15:39.779Z [filesystem] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-04-22T00:15:39.779Z [filesystem] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-04-22T00:15:39.780Z [filesystem] [info] Client transport closed

env: node: No such file or directoryこれが怪しい。

Claudeに聞いてみたところ、npxの場所を見つけられていない可能性があるとのこと。
which nodeした結果をcommandに指定してClaude Desktopを再起動したら読み込まれていた。

image.png

動作確認

Can you write a poem and save it to my desktop?

スクリーンショット 2025-04-22 9.55.06.png
確認画面が出るのはありがたい。
スクリーンショット 2025-04-22 9.56.25.png
テキストファイルが出力された模様。

スクリーンショット 2025-04-22 9.57.36.png
ポエムができた。

What are some work-related files in my downloads folder?

スクリーンショット 2025-04-22 9.59.44.png

Can you take all the images on my desktop and move them to a new folder called “Images”?

スクリーンショット 2025-04-22 10.03.01.png
一つずつツールを呼び出して実現して行っている様子。
スクリーンショット 2025-04-22 10.03.36.png
スクリーンショット 2025-04-22 10.04.07.png
Desktopフォルダ内のすべての画像ファイルがImagesフォルダに移動された。

まとめ

チュートリアルのMCPサーバーをClaude Desktopに読み込めないのはさすがに凹んでいたので、解決できてよかった。InspectorはMCPサーバーを自作した際にもそのでき栄えを簡単にチェックできるので、今後も活用したい。

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