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?

Claude DesktopのMCPがうまくいかないとき

Posted at

Mac環境でClaude DesktopのMCPを試そうとしましたが,npxコマンド周りでうまくいかずつまづいてしまった.
うまくいった方法をメモしておく.

つまづいたこと

例えば,公式この記事を参考にすると,Node.jsをインストールした上で,

~/Library/Application Support/Claude/claude_desktop_config.json
の設定ファイルに,以下を書く.

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

しかし,Claude Desktopを再起動しても,エラーメッセージが出てうまくいかない.
node -vnpm -vで確認して,npmやNode.jsはインストールされているのだが...

解決方法

この動画にあるように,nodeコマンドを使うと,うまくいった.

  1. ライブラリをグローバルにインストール

    npm i -g @modelcontextprotocol/server-filesystem
    
  2. npxでなく,nodeを使うようにclaude_desktop_config.jsonファイルを書き換え

    {
      "mcpServers": {
        "filesystem": {
          "command": <which nodeコマンドで表示されるパス>,
          "args": [
            <1でインストールしたライブラリのパス>,
            "/Users/username/Desktop"
          ]
        }
      }
    }
    

    は,自分の場合,
    "/Users/username/.nodebrew/node/v22.14.0/bin/node"
    で,
    <1でインストールしたライブラリのパス>は,自分の場合,
    "/Users/username/.nodebrew/node/v22.14.0/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js"
    でした.

  3. Claude Desktopを再起動

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?