Context: user previously had context7 MCP server registered manually in three places (~/.claude/settings.json + two in ~/.claude.json), with the CONTEXT7_API_KEY in HTTP-header form. Replaced with the official context7@claude-plugins-official plugin. What changed (outside the repo): - ~/.claude/plugins/cache/.../context7/unknown/.mcp.json — added "--api-key" CLI flag to args (Upstash docs recommend this for stdio). - ~/.claude/settings.json — removed top-level mcpServers.context7. - ~/.claude.json — removed top-level mcpServers.context7 and a legacy project-scoped entry under projects[snolla-admin-ui]. Backups saved with suffix .bak-20260428-114532. What changed in the repo (this commit): - .wiki/concepts/context7-setup.md — new page documenting where the key lives, the /plugin update gotcha, and the rollback path. - .wiki/index.md, log.md — linked / logged. - .tasks/STATUS.md — task moved to Done. Plugin takes effect after Claude Code restart; current session still uses the legacy HTTP transport (verified via smoke test on resolve-library-id). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.6 KiB
title, type, updated
| title | type | updated |
|---|---|---|
| context7 setup: official plugin + API key | concept | 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/<version>/.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 https://context7.com/docs/resources/all-clients):
{
"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:
# inspect
cat ~/.claude/plugins/cache/claude-plugins-official/context7/<version>/.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.