Skip to content

fix: normalize Codex Context7 naming#970

Merged
affaan-m merged 2 commits intoaffaan-m:mainfrom
seancheick:codex/context7-consistency
Mar 28, 2026
Merged

fix: normalize Codex Context7 naming#970
affaan-m merged 2 commits intoaffaan-m:mainfrom
seancheick:codex/context7-consistency

Conversation

@seancheick
Copy link
Copy Markdown
Contributor

@seancheick seancheick commented Mar 27, 2026

Summary

This PR fixes a small Codex inconsistency around Context7 naming.

ECC's reference Codex config used [mcp_servers.context7], while the merge and sanity-check scripts treated [mcp_servers.context7-mcp] as canonical. This patch makes context7 the canonical Codex section name everywhere, while keeping @upstash/context7-mcp as the launcher package.

Changes

  • Normalize the managed MCP section name to [mcp_servers.context7]
  • Treat legacy [mcp_servers.context7-mcp] entries as aliases during updates
  • Update the global sanity check to expect context7
  • Clarify the naming/migration behavior in the Codex docs

Verification

  • git diff --check
  • bash -n scripts/codex/check-codex-global-state.sh

node was not available in my local environment, so I did not run the merge script itself.


Summary by cubic

Normalize Codex Context7 naming so [mcp_servers.context7] is canonical across code and docs, while keeping the launcher package @upstash/context7-mcp. On update, legacy [mcp_servers.context7-mcp] entries are migrated to the canonical section and removed.

  • Bug Fixes

    • Canonicalize Context7 as [mcp_servers.context7]; treat [mcp_servers.context7-mcp] as a legacy alias.
    • In merge-mcp-config.js, --update-mcp replaces the canonical block and cleans up any legacy alias.
    • Update scripts/codex/check-codex-global-state.sh, docs, and examples to expect context7 and warn on legacy.
  • Migration

    • No manual steps. --update-mcp converts and removes [mcp_servers.context7-mcp].

Written for commit 432788d. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation

    • Clarified the canonical Codex TOML section name for the Context7 MCP and added explanatory comments and README guidance about migration behavior.
  • Chores

    • Normalized the canonical section name for Context7 MCP entries; legacy section names are treated as aliases, will trigger warnings, and are removed or migrated during config synchronization/update.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1af002c8-2ea3-417b-ba09-2ca7b1d88f0c

📥 Commits

Reviewing files that changed from the base of the PR and between 59636b6 and 432788d.

📒 Files selected for processing (5)
  • .codex/AGENTS.md
  • .codex/config.toml
  • README.md
  • scripts/codex/check-codex-global-state.sh
  • scripts/codex/merge-mcp-config.js
✅ Files skipped from review due to trivial changes (3)
  • .codex/AGENTS.md
  • .codex/config.toml
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/codex/check-codex-global-state.sh
  • scripts/codex/merge-mcp-config.js

📝 Walkthrough

Walkthrough

This PR canonicalizes the Context7 MCP TOML section to [mcp_servers.context7], treats [mcp_servers.context7-mcp] as a legacy alias, and updates docs, validation, and merge scripts to reflect the canonical name while continuing to launch the @upstash/context7-mcp package.

Changes

Cohort / File(s) Summary
Documentation
\.codex/AGENTS.md, README.md
Document that the canonical TOML section is [mcp_servers.context7], note the launcher remains @upstash/context7-mcp, and describe --update-mcp migration from legacy context7-mcp.
Configuration
\.codex/config.toml
Added inline comments clarifying the canonical section name (context7) vs. the npm package name.
Validation & Merge Scripts
scripts/codex/check-codex-global-state.sh, scripts/codex/merge-mcp-config.js
Switch canonical key to mcp_servers.context7, invert legacy-detection so context7-mcp is treated as legacy alias, update messages, and extend --update-mcp to remove legacy alias when migrating.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • affaan-m

Poem

🐰 I hopped through TOML lines, tidy and spry,
Swapped old names for new with a curious eye.
Legacy paths shelved, canonical bright,
Still launching the same package into night.
A small rabbit cheer — configs aligned just right! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: normalizing the Codex Context7 section naming convention across the codebase and documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/codex/merge-mcp-config.js">

<violation number="1" location="scripts/codex/merge-mcp-config.js:109">
P2: With the new alias mapping, `--update-mcp` leaves legacy `context7-mcp` entries intact when a canonical `context7` entry already exists, causing duplicate server definitions after update.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR normalizes the Codex MCP section name for Context7 from the inconsistent [mcp_servers.context7-mcp] to the canonical [mcp_servers.context7] across the merge script, sanity-check script, reference config, and documentation, while keeping @upstash/context7-mcp as the launcher package name.

Key changes:

  • merge-mcp-config.js: Renames ECC_SERVERS['context7-mcp']ECC_SERVERS.context7, reverses LEGACY_ALIASES so context7-mcp is now the legacy key, and adds a new cleanup branch that removes a stale [mcp_servers.context7-mcp] section when both it and the canonical [mcp_servers.context7] are found simultaneously during --update-mcp.
  • check-codex-global-state.sh: Flips the section-presence loop to check for context7 (required) and emits a warning — rather than a failure — when a legacy context7-mcp section is detected.
  • .codex/config.toml: Adds an inline comment clarifying the section-name vs. package-name distinction.
  • .codex/AGENTS.md / README.md: Adds concise documentation of the canonical name and the automatic migration path via --update-mcp.

Confidence Score: 5/5

Safe to merge — changes are a targeted naming normalization with no logic regressions.

All three migration scenarios (only legacy, only canonical, both simultaneously) are handled correctly in the --update-mcp path. The sanity-check script is correctly updated to match the new canonical name. No new bugs introduced; documentation is accurate and consistent with the code.

No files require special attention.

Important Files Changed

Filename Overview
scripts/codex/merge-mcp-config.js Renames ECC_SERVERS key from context7-mcp to context7, reverses LEGACY_ALIASES mapping, and adds a new cleanup block for when both canonical and legacy sections coexist during --update-mcp. Logic is correct for all three user scenarios.
scripts/codex/check-codex-global-state.sh Correctly flips the sanity-check loop from expecting context7-mcp to context7, and swaps the warn/ok messages so legacy context7-mcp presence now produces a warning and absence produces an ok.
.codex/config.toml Adds a clarifying inline comment between command and args explaining the section/package naming split. Already uses [mcp_servers.context7] as the canonical section name.
.codex/AGENTS.md Adds two documentation bullets explaining the canonical section name and legacy-alias migration behavior. Accurate and consistent with the code changes.
README.md Adds a single paragraph clarifying the context7 vs @upstash/context7-mcp naming split and the --update-mcp migration path. No issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Run merge-mcp-config.js --update-mcp] --> B{Check existing config}

    B --> C{context7 canonical exists?}
    C -->|No| D{context7-mcp legacy exists?}
    C -->|Yes| E{context7-mcp legacy also exists?}

    D -->|No| F[ADD new context7 section]
    D -->|Yes| G[REMOVE context7-mcp + REMOVE context7 if present, ADD context7]

    E -->|No| H[REMOVE context7, ADD context7]
    E -->|Yes| I[REMOVE context7, REMOVE context7-mcp, ADD context7]

    F --> J[Write config.toml]
    G --> J
    H --> J
    I --> J
Loading

Reviews (3): Last reviewed commit: "fix: clean up legacy Context7 aliases on..." | Re-trigger Greptile

@seancheick
Copy link
Copy Markdown
Contributor Author

Addressed the review feedback in a follow-up commit.

Changes:

  • aligned the Context7 launcher to @upstash/context7-mcp@latest to avoid drift warnings against the reference config
  • removed surviving legacy [mcp_servers.context7-mcp] entries during --update-mcp when both canonical and legacy sections coexist

Verification:

  • git diff --check
  • bash -n scripts/codex/check-codex-global-state.sh

@seancheick
Copy link
Copy Markdown
Contributor Author

Follow-up fixes are pushed and the bot feedback is addressed. Happy to make any further adjustments if you want the scope tightened.

Lidang-Jiang added a commit to Lidang-Jiang/everything-claude-code that referenced this pull request Mar 28, 2026
…check

The global sanity check (check-codex-global-state.sh) hard-fails when
persistent_instructions is missing from ~/.codex/config.toml, but neither
the baseline .codex/config.toml nor the sync script ever define this field.
This causes a clean install to report a failing sanity check even though the
sync otherwise succeeds (affaan-m#967).

- Add persistent_instructions to the baseline .codex/config.toml so that
  users who cp the config get a working default.
- Downgrade the sanity check from fail to warn, since persistent_instructions
  is additive and optional — users who rely solely on AGENTS.md should not be
  blocked.

Fixes affaan-m#967 (persistent_instructions part; context7 naming addressed by affaan-m#970)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
@affaan-m affaan-m force-pushed the codex/context7-consistency branch from 59636b6 to 432788d Compare March 28, 2026 23:44
@affaan-m affaan-m merged commit 9033f2a into affaan-m:main Mar 28, 2026
3 checks passed
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.

2 participants