Claude MCPのCommandは絶対パスを書くのが無難

技術

※2026/03時点での見解です。

Claude Desktopでgoogle caldender MCPを動かそうとしたところ、つまづいたので解決方法をメモ

今回使ったMCP

https://github.com/nspady/google-calendar-mcp

ローカルに手軽に建てられるのでおすすめです。
GCPのプロジェクトを作成する必要がありますが、無課金で問題なく動作します。

詰まった部分

上記RepoのReadme通りにClaude Desktopの設定をしたところ以下のエラーが発生。

[google-calendar] [info] Using MCP server command: /usr/local/bin/npx with args and path: {
metadata: {
args: [ '@cocal/google-calendar-mcp', [length]: 1 ],
paths: [
'/usr/local/bin',
'/opt/homebrew/bin',
'/usr/bin',
'/bin',
'/usr/sbin',
'/sbin',
[length]: 6
]
}
}
[google-calendar] [info] Server started and connected successfully { metadata: undefined }
env: node: No such file or directory

解消方法

MCPを定義する際にcommandで実行方法を定義しますが、何も指定しないとClaudeデフォのパスから実行するようです。おそらく今回は、’/usr/local/bin’から実行され、npxの環境に不具合がありうまく立ち上げられませんでした。なので、commandには絶対パスを書いた方が良さそうです。また、絶対パスを書いた場合でも、npx経由の場合はnpxのパスも定義した方が確実です。

google-caldenderの設定例

"mcpServers": {
"google-calendar": {
"command": "/Users/yu00sasaki/.nodebrew/current/bin/npx",
"args": ["@cocal/google-calendar-mcp"],
"env": {
"GOOGLE_OAUTH_CREDENTIALS": "gcp-oauth.keys.json",
"ENABLED_TOOLS": "list-events,create-event,get-current-time,update-event",
"PATH": "/Users/yu00sasaki/.nodebrew/current/bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
}

今回はMCPの話ですが、ファイルリソースも相対パスではなく、絶対パスを参照させた方が、デバッグしやすいので良さそうです。

とはいえ、まだ勉強中の身なので今後考え方を改めるかもしれません。

他のMCPとも組み合わせてTODOアプリを作りたい

コメント

タイトルとURLをコピーしました