Skip to content

fix(mcp-setup): add runtime detection and interactive fallback for tool environment#138

Open
gvauter wants to merge 1 commit into
mainfrom
fix/mcp-setup-tool-detection
Open

fix(mcp-setup): add runtime detection and interactive fallback for tool environment#138
gvauter wants to merge 1 commit into
mainfrom
fix/mcp-setup-tool-detection

Conversation

@gvauter

@gvauter gvauter commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the mcp-setup skill's Step 5 tool detection, which silently defaulted to Claude Code's .mcp.json format when no tool directories were found in consumer repos.

Changes

Replace the old scan-or-default logic with a three-tier detection strategy:

  1. 5a — Implicit context (preferred): The agent recognizes which tool it is running inside (OpenCode, Claude Code, Cursor) without environment checks.
  2. 5b — Directory scanning (fallback): Scans for .claude-plugin/, .opencode/, .cursor-plugin/ directories. Prompts user if multiple are found.
  3. 5c — Interactive prompt (last resort): Asks the user which tool they are using when nothing is detected.
  4. Fallback rule: If any step fails or produces an ambiguous result, always fall back to prompting the user. Never guess silently.

The old "Unknown → silently write .mcp.json" path is removed entirely.

Testing

Verified locally:

  • 5a correctly identifies OpenCode when running inside OpenCode
  • 5b detects all three tool directories in this repo (would prompt user to select)
  • 5c correctly prompts in a consumer repo with no tool directories
  • Fallback rule ensures no silent guessing

Closes #120

…ol environment

Replace the silent 'Unknown → .mcp.json' default with a three-tier
detection strategy:

1. Runtime detection (env vars: OPENCODE_SESSION, CLAUDE_CODE, etc.)
2. Directory scanning (.claude-plugin/, .opencode/, .cursor-plugin/)
3. Interactive prompt asking the user which tool they are using

This fixes the chicken-and-egg problem where consumer repos have no tool
directories when mcp-setup is first invoked, causing OpenCode users to
get Claude Code config format.

Closes #120

Signed-off-by: George Vauter <gvauter@redhat.com>
@gvauter gvauter requested a review from a team as a code owner July 13, 2026 13:33
@gvauter gvauter requested review from gxmiranda and yvonnedevlinrh and removed request for a team July 13, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp-setup skill defaults to .mcp.json when no tool directory exists in consumer repos

1 participant