diff --git a/.tasks/STATUS.md b/.tasks/STATUS.md index fe28a1c..42cb3d3 100644 --- a/.tasks/STATUS.md +++ b/.tasks/STATUS.md @@ -3,6 +3,16 @@ _Updated: 2026-04-28_ ## Done +### Switch context7 from manual MCP config to official plugin +- [x] Backup `~/.claude.json` and `~/.claude/settings.json` (suffix `.bak-20260428-114532`) +- [x] User installed `context7@claude-plugins-official` +- [x] Located installed plugin: `~/.claude/plugins/cache/claude-plugins-official/context7/unknown/` +- [x] Injected `--api-key` flag into the plugin's `.mcp.json` (key sourced from `settings.json`, not echoed in chat) +- [x] Smoke-tested `mcp__context7__resolve-library-id` (returned 5 Nuxt entries — works in current session via legacy HTTP config; plugin takes over after Claude Code restart) +- [x] Removed three manual context7 entries (settings.json + 2 in `.claude.json`); JSON validity confirmed +- [x] Documented setup + plugin-update gotcha in `.wiki/concepts/context7-setup.md` +- [x] Wiki index + log + summary updated + ### Migrate this repo's `.wiki/` to canonical Karpathy layout - [x] `git mv` `.wiki/source/*.md` → `.wiki/concepts/` (rename detection preserves history) - [x] Add `type: concept` frontmatter to each migrated page diff --git a/.wiki/concepts/context7-setup.md b/.wiki/concepts/context7-setup.md new file mode 100644 index 0000000..99435be --- /dev/null +++ b/.wiki/concepts/context7-setup.md @@ -0,0 +1,73 @@ +--- +title: "context7 setup: official plugin + API key" +type: concept +updated: 2026-04-28 +--- + +# context7 setup: official plugin + API key + +_2026-04-28._ + +## Where the MCP server is now registered + +Single source: the official plugin **`context7@claude-plugins-official`**. + +The plugin's `.mcp.json` (after install) lives at: +``` +~/.claude/plugins/cache/claude-plugins-official/context7//.mcp.json +``` + +For this user the version slug is `unknown` (marketplace plugin without a tagged release). + +## API-key injection + +The `@upstash/context7-mcp` npm package, run via stdio, accepts the key as a CLI flag (per Upstash docs at ): + +```json +{ + "context7": { + "command": "npx", + "args": ["-y", "@upstash/context7-mcp", "--api-key", "ctx7sk-..."] + } +} +``` + +We injected the user's existing key (previously in HTTP-header form) into this `args` array. Header / `env` block forms are also supported, but the CLI flag is what Upstash recommends for stdio. + +## What was removed + +Three manual MCP registrations were deleted: + +| File | Where | Had API key? | +|---|---|---| +| `~/.claude/settings.json` | top-level `mcpServers.context7` | yes (header) | +| `~/.claude.json` | top-level `mcpServers.context7` | yes (header) | +| `~/.claude.json` | `projects["…/snolla-admin-ui"].mcpServers.context7` | no (legacy) | + +Backups saved with suffix `.bak-YYYYMMDD-HHMMSS` next to each file. + +## ⚠️ Plugin-update gotcha + +`/plugin update context7@claude-plugins-official` (or a fresh re-install) **will overwrite** the plugin's `.mcp.json` from the marketplace cache, dropping the `--api-key` flag. After any plugin update, re-apply the edit: + +```bash +# inspect +cat ~/.claude/plugins/cache/claude-plugins-official/context7//.mcp.json + +# if --api-key is missing, re-inject +``` + +The marketplace upstream of the plugin lives at `anthropics/claude-plugins-official/external_plugins/context7/.mcp.json` and is two lines — unlikely to change often, but we should expect to re-apply the flag after updates. + +## Restart required to take effect + +Claude Code reads MCP server configs at session start. The session in which this change was made keeps its old (HTTP-transport) connection until a restart. After restart, the plugin's stdio invocation takes over. + +## Why this matters + +Manual MCP entries in `~/.claude.json` / `settings.json` are easy to: +- duplicate accidentally (we had three for one server) +- forget about when sharing config +- drift from the canonical version + +The plugin centralizes the registration and gets versioned through the marketplace. The price is a single edit-after-update for the API key. diff --git a/.wiki/index.md b/.wiki/index.md index 2fc944b..f3f71f9 100644 --- a/.wiki/index.md +++ b/.wiki/index.md @@ -14,6 +14,7 @@ Catalog of all wiki pages. One line per page, organized by type. Updated on ever - [active-platform-decision.md](concepts/active-platform-decision.md) — why `active-platform` is a skill (not a memory entry); why default = Windows; how it's wired into `project-bootstrap` - [build-notes.md](concepts/build-notes.md) — why `build.ps1` exists alongside `build.sh`; PS 5.1 backslash-in-zip gotcha; how to extract a `.skill` +- [context7-setup.md](concepts/context7-setup.md) — switched context7 from manual MCP entries to the official plugin; API key now lives in the plugin's `.mcp.json` as `--api-key`; re-apply after `/plugin update` - [repo-layout.md](concepts/repo-layout.md) — flat `skills/`, committed `dist/`, bash + PowerShell scripts; install model - [wiki-realignment.md](concepts/wiki-realignment.md) — fixing `project-bootstrap` to create the Karpathy-canonical wiki layout diff --git a/.wiki/log.md b/.wiki/log.md index ee68104..dc97969 100644 --- a/.wiki/log.md +++ b/.wiki/log.md @@ -18,3 +18,4 @@ Parseable: `grep "^## \[" .wiki/log.md | tail -20`. ## [2026-04-28] decision | active-platform — skill chosen over global CLAUDE.md / project memory; default Windows; wired into project-bootstrap ## [2026-04-28] refactor | wiki-realignment — fixed project-bootstrap Step 3 to create Karpathy-canonical layout ## [2026-04-28] refactor | this repo's `.wiki/` migrated to canonical layout (SUMMARY.md→index.md, source/→concepts/, added log.md/overview.md/CLAUDE.md schema, raw/README.md) +## [2026-04-28] decision | context7-setup — switched to official plugin; --api-key injected into plugin's .mcp.json; three manual MCP entries removed