↑の記事で公式チュートリアルのMCPサーバーも読み込めなかったので調査した(以下がエラー画面)
結論から
Node Version Managerを使っていたので、npxを見つけられなかった模様。
なので、zsh上でwhich npx
をして出力される文字列をclaude_desktop_config.json
のcommand
に書き込む必要があった。(私の場合はnodenv
を使用していたので、以下のように修正した)
{
"mcpServers": {
"filesystem": {
- "command": "npx",
+ "command": "/Users/username/.nodenv/shims/npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/Users/username/Downloads"
]
}
}
}
調査の過程
↑に従って進めた。
Nodeバージョン調査
MCP Inspector
ずっと気になっていた調査用ツールをいよいよ使ってみた
Connect
してみると、特にエラーもなく接続できた。
List Tools
からツール一覧が表示され、各機能を使えるようになっている。
問題なく使えているようだ。
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を再起動したら読み込まれていた。
動作確認
Can you write a poem and save it to my desktop?
確認画面が出るのはありがたい。
テキストファイルが出力された模様。
What are some work-related files in my downloads folder?
Can you take all the images on my desktop and move them to a new folder called “Images”?
一つずつツールを呼び出して実現して行っている様子。
Desktop
フォルダ内のすべての画像ファイルがImages
フォルダに移動された。
まとめ
チュートリアルのMCPサーバーをClaude Desktopに読み込めないのはさすがに凹んでいたので、解決できてよかった。InspectorはMCPサーバーを自作した際にもそのでき栄えを簡単にチェックできるので、今後も活用したい。