Skip to content

fix: MCP サーバー接続エラーを修正 - #640

Merged
keito4 merged 3 commits into
mainfrom
fix/mcp-server-configuration
Mar 25, 2026
Merged

fix: MCP サーバー接続エラーを修正#640
keito4 merged 3 commits into
mainfrom
fix/mcp-server-configuration

Conversation

@keito4

@keito4 keito4 commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • playwright: npx に --yes フラグを追加
    (インストール確認プロンプトによるタイムアウトを防止)
  • github: api.githubcopilot.com (HTTP/Copilot依存) から
    @modelcontextprotocol/server-github (stdio) に変更し、
    gh auth token から動的にトークンを取得
  • figma: OAuth 認証が必要で接続不可のため削除

Test plan

  • Claude Code 再起動後、MCP サーバーが全て接続されることを確認
  • playwright ツールが利用可能であることを確認
  • github ツールが利用可能であることを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated GitHub integration to handle authentication locally using environment variables
    • Removed Figma integration
    • Enhanced Playwright integration configuration for improved dependency resolution

- playwright: npx に --yes フラグを追加
  (インストール確認プロンプトによるタイムアウトを防止)
- github: api.githubcopilot.com (HTTP/Copilot依存) から
  @modelcontextprotocol/server-github (stdio) に変更
  gh auth token から動的にトークンを取得
- figma: OAuth 認証が必要で接続不可のため削除

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08e82637-ec50-4d45-9c90-246d096d9512

📥 Commits

Reviewing files that changed from the base of the PR and between 7f5a83e and e50e0e8.

📒 Files selected for processing (1)
  • .mcp.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .mcp.json

📝 Walkthrough

Walkthrough

The .mcp.json configuration file is updated to add the --yes flag to the Playwright MCP server, convert the GitHub MCP server from HTTP to stdio-based authentication with token resolution logic, and remove the Figma MCP server entry entirely.

Changes

Cohort / File(s) Summary
MCP Server Configuration
.mcp.json
Updated Playwright server to include --yes flag. Replaced GitHub server HTTP endpoint with stdio subprocess implementing token resolution from environment variables and gh auth token, including validation and error handling. Removed Figma server entry.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

released, size/XS

Poem

🐰 Hops in with glee
Configuration scripts align,
GitHub tokens now shine bright,
Figma bids farewell tonight,
MCP servers take their flight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The pull request title is in Japanese and uses a non-standard format. While it describes MCP server connection error fixes, it lacks clarity for English-speaking developers scanning commit history. Use English titles following conventional commit format: 'fix: Update MCP server configuration (playwright, github, figma)' or similar to improve discoverability and consistency.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mcp-server-configuration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keito4

keito4 commented Mar 25, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項はありません。

判定
patch is correct。問題となる変更点が見当たりません。信頼度 0.66


🤖 Generated by post_pr_ai_review.py hook

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f5a83e8ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .mcp.json Outdated
"headers": {}
"type": "stdio",
"command": "bash",
"args": ["-c", "GITHUB_PERSONAL_ACCESS_TOKEN=$(gh auth token) npx --yes @modelcontextprotocol/server-github"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail fast when GitHub token lookup fails

This command masks gh auth token failures: in bash -c, an assignment with command substitution (GITHUB_PERSONAL_ACCESS_TOKEN=$(gh auth token) ...) does not stop execution when gh is missing or not authenticated, so npx is still started with an empty token. In fresh environments this yields a connected-looking MCP server that later fails GitHub operations with auth errors, making the original setup problem hard to diagnose.

Useful? React with 👍 / 👎.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/test.md (1)

1-3: Consider neutralizing informal wording for repository docs.

Lines [1-3] and Line [115] use casual phrasing (, ) that may not fit team-facing security guidance. Consider a more neutral tone.

Also applies to: 115-115

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/test.md around lines 1 - 3, Replace casual/slang phrases "草" and any
"笑" or similarly informal wording in the repository document with neutral
professional language; update the sentences in the opening anecdote (the lines
referencing Claude Code and force-push) to a concise, factual description about
accidental force-push risks and steps taken to review security settings, and do
the same for the other occurrence noted as "笑" so all team-facing security
guidance uses formal tone and clear, actionable wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/test.md:
- Around line 24-34: The JSON config example currently appears as regular
Markdown (the block containing the "permissions" object and the "deny" array
with entries like "Bash(rm -rf *)"), which causes linting/formatting issues; fix
it by wrapping that entire JSON snippet in a fenced code block using triple
backticks and the language tag (```json) at the start and closing triple
backticks at the end so the wildcard characters are preserved and parsed as
code.

In @.mcp.json:
- Around line 10-12: Update the MCP start command so it does not assume `gh auth
token` always succeeds: first read `GITHUB_PERSONAL_ACCESS_TOKEN` from env, then
fallback to `GITHUB_TOKEN`, and only if both are unset run `gh auth token`; if
that also fails emit a clear error and exit instead of passing an empty token to
the MCP server. Change the `args` entry that currently runs
`GITHUB_PERSONAL_ACCESS_TOKEN=$(gh auth token) npx --yes
`@modelcontextprotocol/server-github`` to a shell snippet that checks
`GITHUB_PERSONAL_ACCESS_TOKEN`, then `GITHUB_TOKEN`, then `gh auth token` and
exports the chosen value before invoking `npx --yes
`@modelcontextprotocol/server-github``, failing with a descriptive message if no
token is available.

---

Nitpick comments:
In @.github/test.md:
- Around line 1-3: Replace casual/slang phrases "草" and any "笑" or similarly
informal wording in the repository document with neutral professional language;
update the sentences in the opening anecdote (the lines referencing Claude Code
and force-push) to a concise, factual description about accidental force-push
risks and steps taken to review security settings, and do the same for the other
occurrence noted as "笑" so all team-facing security guidance uses formal tone
and clear, actionable wording.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bcfa2e9a-9f08-45a6-8aa2-413f37c4ba03

📥 Commits

Reviewing files that changed from the base of the PR and between 657941a and 7f5a83e.

📒 Files selected for processing (2)
  • .github/test.md
  • .mcp.json

Comment thread .github/test.md Outdated
Comment on lines +24 to +34
{
"permissions": {
"deny": [
"Bash(rm -rf *)",
"Bash(curl *)",
"Bash(wget *)",
"Bash(git push --force *)",
"Bash(chmod 777 *)"
]
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Wrap config examples in fenced code blocks.

Lines [24-34] are parsed as normal Markdown, and wildcard entries (e.g., *) trigger formatting/lint issues (like MD037). Please fence JSON examples to preserve exact syntax.

📝 Example fix
-   {
-   "permissions": {
-   "deny": [
-   "Bash(rm -rf *)",
-   "Bash(curl *)",
-   "Bash(wget *)",
-   "Bash(git push --force *)",
-   "Bash(chmod 777 *)"
-   ]
-   }
-   }
+   ```json
+   {
+     "permissions": {
+       "deny": [
+         "Bash(rm -rf *)",
+         "Bash(curl *)",
+         "Bash(wget *)",
+         "Bash(git push --force *)",
+         "Bash(chmod 777 *)"
+       ]
+     }
+   }
+   ```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"permissions": {
"deny": [
"Bash(rm -rf *)",
"Bash(curl *)",
"Bash(wget *)",
"Bash(git push --force *)",
"Bash(chmod 777 *)"
]
}
}
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 28-28: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)


[warning] 30-30: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/test.md around lines 24 - 34, The JSON config example currently
appears as regular Markdown (the block containing the "permissions" object and
the "deny" array with entries like "Bash(rm -rf *)"), which causes
linting/formatting issues; fix it by wrapping that entire JSON snippet in a
fenced code block using triple backticks and the language tag (```json) at the
start and closing triple backticks at the end so the wildcard characters are
preserved and parsed as code.

Comment thread .mcp.json Outdated
@keito4 keito4 self-assigned this Mar 25, 2026
@keito4

keito4 commented Mar 25, 2026

Copy link
Copy Markdown
Owner Author

(aside)
@claude PRがbaseにマージする際にCIが落ちています。
修正してください。

@claude

claude Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 5m 59s —— View job


CI修正対応

  • コンテキスト確認
  • CI失敗内容の調査
  • .mcp.json の GitHub トークンフォールバック修正
  • コミット・プッシュ

調査結果

現在のCIチェックは全て成功しています:

チェック 状態
CI (Quality Gate, PR Size Check, etc.) ✅ SUCCESS
GitGuardian Security Checks ✅ SUCCESS
CodeRabbit ✅ SUCCESS

PRが BLOCKED になっているのはCI失敗ではなく、必須レビューが未完了のためです(branch protection rules により最低1名のレビュワー承認が必要)。


適用した修正

レビューコメント(CodeRabbit・Codex両方)で指摘された .mcp.json のトークン処理問題を修正しました:

修正前:

"args": ["-c", "GITHUB_PERSONAL_ACCESS_TOKEN=$(gh auth token) npx --yes @modelcontextprotocol/server-github"]

gh auth token が失敗しても空トークンのまま続行してしまい、認証エラーの原因が分かりにくい問題がありました。

修正後:

"args": [
  "-c",
  "TOKEN=\"${GITHUB_PERSONAL_ACCESS_TOKEN:-${GITHUB_TOKEN:-$(gh auth token 2>/dev/null)}}\"; [ -n \"$TOKEN\" ] || { echo 'GitHub MCP: missing token' >&2; exit 1; }; export GITHUB_PERSONAL_ACCESS_TOKEN=\"$TOKEN\"; exec npx --yes @modelcontextprotocol/server-github"
]
  • GITHUB_PERSONAL_ACCESS_TOKENGITHUB_TOKENgh auth token の順でフォールバック
  • 全ての認証情報が存在しない場合は明確なエラーメッセージを出力して終了

コミット: e50e0e8
| Branch

- GITHUB_PERSONAL_ACCESS_TOKEN → GITHUB_TOKEN → gh auth token の順でフォールバック
- 全ての認証情報が存在しない場合は明確なエラーメッセージを出力して終了
- 未認証環境でも原因を特定しやすくする

Co-authored-by: keito4 <keito4@users.noreply.github.com>
@keito4
keito4 merged commit 3eac413 into main Mar 25, 2026
2 checks passed
@keito4
keito4 deleted the fix/mcp-server-configuration branch March 25, 2026 05:01
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.107.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant