upstash/context7 · warning

No Context7 setup detected. Pass --claude, --cursor, --openc

Error message

No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, --antigravity, or --gemini.

What it means

`context7 remove` first resolves what to uninstall: explicit agent flags, then detectConfiguredAgents(scope) which scans config files (e.g. .mcp.json, agent rules) for Context7 setup. When nothing is found and no agent flags were passed, there is nothing to remove, so the CLI warns 'No Context7 setup detected' and lists the accepted flags instead of prompting.

Source

Thrown at packages/cli/src/commands/remove.ts:156

        loop: false,
        theme: CHECKBOX_THEME,
      },
      { getName: (mode: UninstallMode) => MODE_LABELS[mode] }
    );
  } catch {
    return null;
  }
}

async function resolveAgents(options: UninstallOptions, scope: Scope): Promise<SetupAgent[]> {
  const explicit = getSelectedAgents(options);
  if (explicit.length > 0) return explicit;

  const detected = await detectConfiguredAgents(scope);
  if (detected.length > 0 && options.yes) return detected;

  if (detected.length === 0) {
    log.warn(
      "No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, --antigravity, or --gemini."
    );
    return [];
  }

  log.blank();
  const selected = await promptAgents(detected);
  if (!selected) {
    log.warn("Remove cancelled");
    return [];
  }

  return selected;
}

function resolveFlagModes(options: UninstallOptions): UninstallMode[] {
  if (options.all) return ["mcp", "cli"];

View on GitHub (pinned to 5284672feb)

Solutions

  1. Check which scope holds the config: re-run with the other scope flag (e.g. `--scope user`/`--global` vs default project).
  2. Run `context7 remove` from the project root where setup originally ran (the one containing .mcp.json or agent rule files).
  3. If you know the agent, pass its flag directly — `context7 remove --claude` skips detection entirely.
  4. Verify a Context7 config actually exists (look for .mcp.json / agent config dirs) before invoking remove.
Defensive patterns

Strategy: validation

Validate before calling

import { access } from "node:fs/promises";

// Pre-check the scopes a Context7 setup would live in before running remove
async function hasAnySetup(candidates: string[]): Promise<boolean> {
  const results = await Promise.allSettled(candidates.map((p) => access(p)));
  return results.some((r) => r.status === "fulfilled");
}
// e.g. candidates = [join(homedir(), ".claude"), join(process.cwd(), ".mcp.json")]

Type guard

import type { SetupAgent } from "../agents.js";

function hasDetectedAgents(agents: SetupAgent[]): boolean {
  return Array.isArray(agents) && agents.length > 0;
}

Prevention

When it happens

Trigger: Running `context7 remove` on a machine/directory with no Context7 MCP or rule configuration for the selected scope; running with `--scope project` in a repo whose Context7 config lives in the user (global) scope, or vice versa; configs were already removed by a previous run.

Common situations: Wrong directory: the setup was done in another project so project-scope detection finds nothing; setup was installed under a different user account (homedir); the user manually deleted .mcp.json earlier; mixing up remove scope flags.

Related errors


AI-assisted analysis of upstash/context7@5284672feb (2026-08-18). Data as JSON: /api/errors/008c91012f47fc60. Report an issue: GitHub.