5
3

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のMCP機能を使ってgithubに接続しようとしたらトラブった件(Windows編)

Last updated at Posted at 2025-03-09

環境:windows10,cursor(ver.0.46.7)

いきなり結論

  1. githubで必要な権限を付けたトークンを発行しておく(手順省略)
  2. smitheryでログインしてgithubを選択、あとは表示される手順通り
  3. 詳しく書くとInstallationのcursorタブを選択、githubPersonalAccessTokenの入力欄に発行したトークンを入力してGenerate Command、発行されたコマンドをcursorに貼り付けて設定。cursor起動中はDOSウィンドウが表示されて鬱陶しいが我慢する
  4. 上手く設定できるとこんな感じ
    image.png

以降試行錯誤の記録

cursorから直接接続(執筆時点で不具合有り)

出てきた方法を試す。参考にしたページ

env GITHUB_PERSONAL_ACCESS_TOKEN=~ npx -y @modelcontextprotocol/server-github

windowsだとenvコマンドがないとかcmd /cで実行しないと上手く認識しないとかあった。

参考
参考2
参考3

windowsで動かす方法

  1. システムの詳細設定から環境変数GITHUB_PERSONAL_ACCESS_TOKENを設定する(再起動するか$Env:GITHUB_PERSONAL_ACCESS_TOKEN=~とかで任意に更新が必要かも)
  2. cmd /c npx @modelcontextprotocol/server-githubをコマンドとしてMCPサーバーに設定する
  3. 下記の状態になったらOK

image.png

何が問題?

publicなリポジトリは取得できるけどprivateなリポジトリが取得できない。
権限ミスかと色々試したけどできない。
どうやら@modelcontextprotocol/server-githubでバグが発生している模様。
GithubのIssue
上記Issueが解決すればこの方法でも問題はなくなるかもしれない。
ちなみにこの問題はmacとかでも起きているのかも?

veyrax経由で取得してみる(執筆時点で不具合有り)

veyraxにもgithubへのアクセス機能があるのでアカウントを作成して連携してみた。
結果、cursorから直接接続する場合と同じくprivateなリポジトリが取得できなかった。

結論、再び

冒頭の手順でsmithery経由して接続するとprivateなリポジトリの情報が取得できた。
日本語での情報が少なくて収集が大変だった…
情報が増えたりcursorのバージョンとかが上がるとこんな苦労もなくなるかも。

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?