Skip to content

fix(install): skip duplicate Codex MCP registration on repeat init - #117

Open
syf2211 wants to merge 1 commit into
mathomhaus:mainfrom
syf2211:fix/codex-mcp-duplicate-registration
Open

fix(install): skip duplicate Codex MCP registration on repeat init#117
syf2211 wants to merge 1 commit into
mathomhaus:mainfrom
syf2211:fix/codex-mcp-duplicate-registration

Conversation

@syf2211

@syf2211 syf2211 commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Wire codex mcp list --json into the MCP install pre-check so repeat guild init --yes runs detect an existing guild entry and skip re-adding it, matching Claude/Cursor idempotency.

Fixes #14

Motivation

Codex's mcp add succeeds on duplicate entries (unlike claude mcp add, which errors with "already exists"). Without a list probe, guild init could register guild twice in Codex's MCP config.

Changes

  • Add ListArgv for Codex (codex mcp list --json) in clients.go
  • Parse Codex JSON list output in scanGuildFromCodexJSON, integrated into scanForGuildEntry
  • Add regression tests for JSON parsing and the Codex skip-already-registered path

Tests

go test ./internal/install/... -count=1

All install package tests pass (including new TestScanForGuildEntry_CodexJSON and TestMCPInstall_Run_SkipsAlreadyRegistered_Codex).

Notes

  • HTTP/streamable_http guild entries are detected as registered but return an empty command path, so they fall through to install (same as unparseable human-format lines). This is unlikely from guild init, which always registers a stdio launcher.
  • Malformed JSON or probe failures fall through to install, preserving historical behaviour.

Wire `codex mcp list --json` as ListArgv and parse the JSON output so
repeat `guild init --yes` runs detect an existing guild entry and skip
re-adding it, matching Claude/Cursor idempotency. Fixes mathomhaus#14.

Includes regression tests for JSON parsing and the Codex skip path.
@github-actions github-actions Bot added the area: install guild init / mcp install / release label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: install guild init / mcp install / release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] guild init may create duplicate codex mcp entries on re-invocation

1 participant