Pre-computed context
Installed CLI version: !ctx7 --version 2>/dev/null || echo "not installed"
Latest published CLI version: !npm view ctx7 version 2>/dev/null || echo "unknown (npm registry unreachable)"
MCP availability: check your own tool list. If mcp__context7__resolve-library-id / mcp__context7__query-docs are present, the Context7 MCP server is already configured.
Purpose
Bring the local environment to a working state for /context7:lookup. Two independent paths,
either alone sufficient: the CLI (ctx7 via npm) and the Context7 MCP server (configured
by the consuming project). An optional CONTEXT7_API_KEY raises rate limits for both.
Check-centric per the uniform setup contract (docs/PLUGIN-PHILOSOPHY.md
"Setup is explicit and repeatable" in the marketplace repository): check inspects and reports,
apply resolves what check found, and the CLI install is a distinct opt-in subaction.
Idempotent and transparent: safe to rerun.
Action routing: no argument or check runs the check; apply runs the check first, then the
guidance-only remediations (auth, MCP routing); apply install-cli additionally authorizes the
global ctx7 install/upgrade below. All actions are non-interactive when the action is given.
Never prompt.
check (read-only)
Work top-down from the pre-computed context and report a PASS/FAIL/INFO table with one
remediation line per FAIL. Do not install, edit config, or write anything.
- CLI path. From the pre-computed block: is
ctx7 installed, and does it match the latest
published version? A working, current CLI is PASS. Installed-but-behind is INFO with
remediation apply install-cli. Absent is INFO only when the MCP path is live (below);
otherwise it is a FAIL of the "at least one path works" requirement.
- MCP path. Is the Context7 MCP server present in your tool list? Present is PASS; absent is
INFO. The MCP interface is optional; the CLI alone is sufficient.
- At least one path. FAIL only when neither the CLI nor the MCP server resolves; every
lookup would then be blocked. Remediation:
apply install-cli, or add the MCP server (routed
in apply).
- Auth. INFO: report whether
CONTEXT7_API_KEY is present in the environment
([ -n "$CONTEXT7_API_KEY" ]). Report presence only. Never print or echo the value.
Anonymous usage works at low rates, so absence is never a FAIL.
- Windows Git Bash. INFO: CLI
ctx7 docs /org/project "..." calls must be prefixed with
MSYS_NO_PATHCONV=1 (a no-op on macOS/Linux, so it is safe to always include), or the /org/project
ID gets path-mangled. Full explanation:
${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md.
apply (idempotent)
Run check, then resolve each finding. Re-running after both paths are working changes nothing
and reports "already configured". State each change before making it, and re-detect before
claiming it.
apply install-cli installs or upgrades the CLI. Only with this subaction, and only when
check found ctx7 missing or behind latest:
npm install -g ctx7@latest
No global install available? npx ctx7@latest <command> works per-invocation. Version floor,
npx trade-offs, and the full command/flag reference:
${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md. After installing, re-read the CLI version
and report the observed result. Never claim upgraded on the install command's exit code alone.
Auth (optional, both paths). Guidance only. For higher limits, direct the user to set
CONTEXT7_API_KEY in their own shell profile / secret store:
export CONTEXT7_API_KEY="<your-key>"
Prefer this over ctx7 login. Never write the key into the repository, Claude Code settings,
or an MCP config file, and never print its value. An environment-variable change takes effect
in a fresh session; report its presence only and defer verification to that fresh session.
Rationale and the ctx7 login caveat: ${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md.
MCP path (optional). Guidance only. If the user wants the MCP interface (cleaner output,
more content per call with the measured ratio in
${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/mcp.md, no Windows ceremony), route them to add a context7 server entry
to their own MCP configuration. The exact JSON, covering anonymous and API-key forms plus the
"unset env var breaks config parsing" caveat, lives in
${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/mcp.md. Do not edit their .mcp.json for them.
Verify. Re-read the CLI version and your tool list. Confirm at least one path (CLI or MCP)
is live before declaring setup complete.
Output
Report what was already in place, what changed, what was skipped, and which lookup path(s) are now
available (CLI, MCP, or both).
Boundaries
- Do not run
ctx7 setup or ctx7 skills install. This plugin owns the lookup surface; those
install a parallel skill that fragments and clobbers it (detail in the CLI and update references).
- Do not run
ctx7 setup --mcp or edit the consumer's .mcp.json without consent. Their MCP
configuration is theirs to curate.
- Do not write
CONTEXT7_API_KEY into the repository, Claude Code settings, or any config file, and
never print its value; the key belongs in the environment or a secret store.
- Do not write the plugin cache, Claude Code user settings, or
pluginConfigs. This skill brings the
local environment to a working state for lookups; machine-wide Claude Code state belongs to the user
and the harness, and the installed plugin cache is overwritten on the next plugin update.
- Do not perform library lookups. That is
/context7:lookup.
1---2name: setup-73description: Verify or configure Context7 for this plugin's lookups. Check the ctx7 CLI, CONTEXT7_API_KEY auth, and the Context7 MCP server, then install/upgrade the CLI on request. Use when the user wants Context7 set up, verified, or repaired on this machine, covering CLI installation, API-key auth, and MCP server wiring: 'set up context7', 'is context7 working', 'install ctx7'. Actions: check (read-only verification, default) | apply (resolve what check found) | apply install-cli (also install/upgrade the ctx7 CLI).4---56## Pre-computed context78Installed CLI version: !`ctx7 --version 2>/dev/null || echo "not installed"`910Latest published CLI version: !`npm view ctx7 version 2>/dev/null || echo "unknown (npm registry unreachable)"`1112MCP availability: check your own tool list. If `mcp__context7__resolve-library-id` / `mcp__context7__query-docs` are present, the Context7 MCP server is already configured.1314## Purpose1516Bring the local environment to a working state for `/context7:lookup`. Two independent paths,17either alone sufficient: the **CLI** (`ctx7` via npm) and the **Context7 MCP server** (configured18by the consuming project). An optional `CONTEXT7_API_KEY` raises rate limits for both.1920Check-centric per the uniform setup contract (`docs/PLUGIN-PHILOSOPHY.md`21"Setup is explicit and repeatable" in the marketplace repository): `check` inspects and reports,22`apply` resolves what `check` found, and the CLI install is a distinct opt-in subaction.23Idempotent and transparent: safe to rerun.2425Action routing: no argument or `check` runs the check; `apply` runs the check first, then the26guidance-only remediations (auth, MCP routing); `apply install-cli` additionally authorizes the27global `ctx7` install/upgrade below. All actions are non-interactive when the action is given.28Never prompt.2930## `check` (read-only)3132Work top-down from the pre-computed context and report a PASS/FAIL/INFO table with one33remediation line per FAIL. Do not install, edit config, or write anything.34351. **CLI path**. From the pre-computed block: is `ctx7` installed, and does it match the latest36 published version? A working, current CLI is PASS. Installed-but-behind is INFO with37 remediation `apply install-cli`. Absent is INFO only when the MCP path is live (below);38 otherwise it is a FAIL of the "at least one path works" requirement.392. **MCP path**. Is the Context7 MCP server present in your tool list? Present is PASS; absent is40 INFO. The MCP interface is optional; the CLI alone is sufficient.413. **At least one path**. FAIL only when neither the CLI nor the MCP server resolves; every42 lookup would then be blocked. Remediation: `apply install-cli`, or add the MCP server (routed43 in `apply`).444. **Auth**. INFO: report whether `CONTEXT7_API_KEY` is present in the environment45 (`[ -n "$CONTEXT7_API_KEY" ]`). Report presence only. Never print or echo the value.46 Anonymous usage works at low rates, so absence is never a FAIL.475. **Windows Git Bash**. INFO: CLI `ctx7 docs /org/project "..."` calls must be prefixed with48 `MSYS_NO_PATHCONV=1` (a no-op on macOS/Linux, so it is safe to always include), or the `/org/project`49 ID gets path-mangled. Full explanation:50 `${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md`.5152## `apply` (idempotent)5354Run `check`, then resolve each finding. Re-running after both paths are working changes nothing55and reports "already configured". State each change before making it, and re-detect before56claiming it.57581. **`apply install-cli` installs or upgrades the CLI.** Only with this subaction, and only when59 `check` found `ctx7` missing or behind latest:6061 ```bash62 npm install -g ctx7@latest63 ```6465 No global install available? `npx ctx7@latest <command>` works per-invocation. Version floor,66 npx trade-offs, and the full command/flag reference:67 `${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md`. After installing, re-read the CLI version68 and report the observed result. Never claim upgraded on the install command's exit code alone.69702. **Auth (optional, both paths). Guidance only.** For higher limits, direct the user to set71 `CONTEXT7_API_KEY` in their own shell profile / secret store:7273 ```bash74 export CONTEXT7_API_KEY="<your-key>"75 ```7677 Prefer this over `ctx7 login`. Never write the key into the repository, Claude Code settings,78 or an MCP config file, and never print its value. An environment-variable change takes effect79 in a fresh session; report its presence only and defer verification to that fresh session.80 Rationale and the `ctx7 login` caveat: `${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md`.81823. **MCP path (optional). Guidance only.** If the user wants the MCP interface (cleaner output,83 more content per call with the measured ratio in84 `${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/mcp.md`, no Windows ceremony), route them to add a `context7` server entry85 to *their own* MCP configuration. The exact JSON, covering anonymous and API-key forms plus the86 "unset env var breaks config parsing" caveat, lives in87 `${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/mcp.md`. Do not edit their `.mcp.json` for them.88894. **Verify.** Re-read the CLI version and your tool list. Confirm at least one path (CLI or MCP)90 is live before declaring setup complete.9192## Output9394Report what was already in place, what changed, what was skipped, and which lookup path(s) are now95available (CLI, MCP, or both).9697## Boundaries9899- Do not run `ctx7 setup` or `ctx7 skills install`. This plugin owns the lookup surface; those100 install a parallel skill that fragments and clobbers it (detail in the CLI and update references).101- Do not run `ctx7 setup --mcp` or edit the consumer's `.mcp.json` without consent. Their MCP102 configuration is theirs to curate.103- Do not write `CONTEXT7_API_KEY` into the repository, Claude Code settings, or any config file, and104 never print its value; the key belongs in the environment or a secret store.105- Do not write the plugin cache, Claude Code user settings, or `pluginConfigs`. This skill brings the106 local environment to a working state for lookups; machine-wide Claude Code state belongs to the user107 and the harness, and the installed plugin cache is overwritten on the next plugin update.108- Do not perform library lookups. That is `/context7:lookup`.