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?

cursorでnotionの公式MCPがclient closedとなる原因の一例(npxは正しく動きますか)

Posted at

背景

Notion公式からMCPが公開されたので、Cursorと連携しようとしました。
設定は複雑ではないはずなのに、必要な設定を終えた後もnotionApiの欄に赤く「client closed」と表示され、接続がうまくいきませんでした。

原因

mcp.json
{
  "mcpServers": {
    "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      ...
    }
  }
}

mcp.jsonの"command": "npx"を見て、npxへのパスがうまく通っていないのではと確認したところ、nodeのバージョン管理にasdfを使用している中で、グローバルのnodeバージョンがうまく指定できていないことが分かりました。

npxの動作確認:

npx --version

通常のプロジェクトでは.tool-versionsファイルに使いたいバージョン情報を記載しますが、Cursorの設定ディレクトリにはそれがない状態でした。

解決

おそらく適切な場所に.tool-versionsファイルに設定することや、グローバルバージョンを指定することで解決します。
asdfで管理したい事情は別にあったためnodeだけnpmに切り替えたところ解決しました。

プログラミング初心者の初歩的な原因でした。MCPが話題となり初心者も多いかと思いますので、エラー時のチェック項目の一つとして参考のなればと思います。

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?