Closed14

Slack の MCP サーバ使ってみる

ピン留めされたアイテム
snakasnaka
snakasnaka
snakasnaka

Claude Desktop 再起動したが、接続失敗

2025-04-25T23:46:14.412Z [slack] [info] Initializing server...
2025-04-25T23:46:14.449Z [slack] [info] Server started and connected successfully
2025-04-25T23:46:14.453Z [slack] [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}
unknown command: node. Perhaps you have to reshim?
2025-04-25T23:46:14.616Z [slack] [info] Server transport closed
2025-04-25T23:46:14.616Z [slack] [info] Client transport closed
2025-04-25T23:46:14.617Z [slack] [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-25T23:46:14.617Z [slack] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-04-25T23:46:14.617Z [slack] [info] Client transport closed
snakasnaka

envPATH の設定が必要だった

{
  "globalShortcut": "",
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-slack"
      ],
      "env": {
        "PATH": "/Users/snaka/.asdf/installs/nodejs/22.12.0/bin",
        "SLACK_BOT_TOKEN": "xoxb-xxxxxxxxxxx",
        "SLACK_TEAM_ID": "Txxxxxxxxxxxx",
        "SLACK_CHANNEL_IDS": "Cxxxxxxxxxxxx"
      }
    }
  }
}
snakasnaka

今度は別のエラー

2025-04-25T23:50:33.552Z [slack] [info] Initializing server...
2025-04-25T23:50:33.565Z [slack] [info] Server started and connected successfully
2025-04-25T23:50:33.719Z [slack] [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}
npm error code ENOENT
npm error syscall spawn sh
npm error path /
npm error errno -2
npm error enoent spawn sh ENOENT
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /Users/snaka/.npm/_logs/2025-04-25T23_50_33_825Z-debug-0.log
2025-04-25T23:50:38.240Z [slack] [info] Server transport closed
2025-04-25T23:50:38.240Z [slack] [info] Client transport closed
2025-04-25T23:50:38.241Z [slack] [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-25T23:50:38.241Z [slack] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-04-25T23:50:38.241Z [slack] [info] Client transport closed
snakasnaka

ログ ( /Users/snaka/.npm/_logs/2025-04-25T23_50_33_825Z-debug-0.log ) を確認

117 http fetch GET 200 https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.0.1.tgz 473ms (cache miss)
118 verbose stack Error: spawn sh ENOENT
118 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:285:19)
118 verbose stack     at onErrorNT (node:internal/child_process:483:16)
118 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
119 error code ENOENT
120 error syscall spawn sh
121 error path /
122 error errno -2
123 error enoent spawn sh ENOENT
124 error enoent This is related to npm not being able to find a file.
124 error enoent
125 verbose cwd /
126 verbose os Darwin 23.6.0
127 verbose node v22.12.0
128 verbose npm  v10.9.2
129 verbose exit -2
130 verbose code -2
131 error A complete log of this run can be found in: /Users/snaka/.npm/_logs/2025-04-25T23_50_33_825Z-debug-0.log
snakasnaka

メッセージなどから sh コマンドが見つけきれてなさそう、という推測から PATH:/bin を追加

{
  "globalShortcut": "",
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-slack"
      ],
      "env": {
        "PATH": "/Users/snaka/.asdf/installs/nodejs/22.12.0/bin:/bin",
        "SLACK_BOT_TOKEN": "xoxb-xxxxxxxxxxx",
        "SLACK_TEAM_ID": "Txxxxxxxxxxxx",
        "SLACK_CHANNEL_IDS": "Cxxxxxxxxxxxx"
      }
    }
  }
}
snakasnaka

申し訳ありませんが、「not_in_channel」というエラーが表示されました。これは私(または現在のユーザー)がこのチャンネルに参加していないことを意味します。チャンネルの履歴を取得するには、まずチャンネルに参加する必要があります。
チャンネルに参加するには、Slackのインターフェースでチャンネル名をクリックし、そのあと「チャンネルに参加する」または「Join Channel」ボタンをクリックしてください。あるいは、Slackの左側のサイドバーで「+」ボタンをクリックし、「チャンネル」を選択して「times-nakamatsu」を検索することもできます。

チャンネルに追加が必要

このスクラップは4ヶ月前にクローズされました