# https://github.com/upstash/context7 Project Manual

Generated at: 2026-06-06 08:06:15 UTC

## Table of Contents

- [Context7 Platform Overview and Architecture](#page-1)
- [MCP Server and Core Documentation Tools](#page-2)
- [ctx7 CLI, Agent Setup, and Skills System](#page-3)
- [SDKs, Extensions, and Plugin Ecosystem](#page-4)

<a id='page-1'></a>

## Context7 Platform Overview and Architecture

### Related Pages

Related topics: [MCP Server and Core Documentation Tools](#page-2), [ctx7 CLI, Agent Setup, and Skills System](#page-3)

<details>
<summary>Related Source Files</summary>

The following source files were used to generate this page:

- [README.md](https://github.com/upstash/context7/blob/main/README.md)
- [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)
- [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)
- [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)
- [packages/sdk/src/commands/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/types.ts)
- [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)
- [packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)
- [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)
- [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)
- [packages/tools-ai-sdk/src/tools/types.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/types.ts)
- [packages/cli/package.json](https://github.com/upstash/context7/blob/main/packages/cli/package.json)
- [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)
- [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)
- [packages/pi/package.json](https://github.com/upstash/context7/blob/main/packages/pi/package.json)
- [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)
- [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)

</details>

# Context7 Platform Overview and Architecture

## 1. Purpose and Scope

Context7 is an open-source platform developed by Upstash that delivers **up-to-date, version-specific documentation and code examples** to AI coding agents and LLM-powered applications. The project addresses a well-known failure mode of LLM-based coding assistants: training data becomes stale, APIs evolve, and assistants hallucinate interfaces that no longer exist.

> "Context7 provides up-to-date documentation and code examples for libraries and frameworks." — [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)

The repository is a **pnpm monorepo** that ships Context7 in several consumption modes so the same documentation engine can be reached from MCP-aware agents, AI SDK workflows, terminal sessions, vendor-specific coding assistants, and the pi coding agent.

### 1.1 The Problem Context7 Solves

| Problem | How Context7 Responds |
|---|---|
| Year-old training data in LLMs | Fresh, source-driven docs fetched at request time |
| Hallucinated APIs | Snippets keyed to a real `libraryId` (e.g. `/vercel/next.js`) |
| Generic answers for old versions | Versioned library IDs and slash-command hints (e.g. `use library /vercel/next.js/v14.2.0`) |
| Repetitive boilerplate explanations | Pre-aggregated, topic-ranked documentation snippets |

Source: [README.md](https://github.com/upstash/context7/blob/main/README.md), [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)

### 1.2 High-Level Capabilities

Context7 exposes two primary tool surfaces across all integration paths:

- **`resolve-library-id`** — maps a free-form library name to a Context7-compatible ID.
- **`query-docs`** — fetches ranked documentation for a resolved ID.

Source: [README.md](https://github.com/upstash/context7/blob/main/README.md), [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)

---

## 2. Repository Layout

Context7 is structured as a multi-package monorepo. Each package targets a distinct surface area but shares the same underlying API.

| Package / Path | Type | Purpose |
|---|---|---|
| `packages/sdk` (`@upstash/context7-sdk`) | TypeScript SDK | HTTP/REST client for the Context7 API |
| `packages/mcp` (`@upstash/context7-mcp`) | MCP server | Exposes Context7 over Model Context Protocol |
| `packages/tools-ai-sdk` (`@upstash/context7-tools-ai-sdk`) | AI SDK tools | Vercel AI SDK-compatible tools and agents |
| `packages/cli` (`ctx7`) | CLI | Terminal `ctx7` command plus `setup`/`upgrade` helpers |
| `packages/pi` (`@upstash/context7-pi`) | Pi extension | Tools, skill, and slash command for the pi coding agent |
| `plugins/cursor/context7` | Cursor plugin | Rules, skills, and MCP wiring for Cursor |
| `plugins/claude/context7` | Claude Code plugin | Marketplace plugin for Claude Code |
| `rules/` | Static rules | Plain-text rules fetched by `ctx7 setup` |

Source: [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json), [packages/cli/package.json](https://github.com/upstash/context7/blob/main/packages/cli/package.json), [packages/pi/package.json](https://github.com/upstash/context7/blob/main/packages/pi/package.json)

---

## 3. High-Level Architecture

The platform follows a **hub-and-spoke** topology: a central Context7 service (referenced as `mcp.context7.com` and `context7.com/api`) acts as the hub, while thin clients connect to it from a variety of agentic surfaces.

```mermaid
graph TD
    User[Developer / Prompt] --> Agent[Coding Agent or LLM App]
    Agent -->|MCP| MCPServer["packages/mcp<br/>@upstash/context7-mcp"]
    Agent -->|AI SDK Tools| AISDK["packages/tools-ai-sdk<br/>resolveLibraryId / queryDocs"]
    Agent -->|CLI Invocation| CLI["packages/cli<br/>ctx7 docs / library"]
    Agent -->|Pi Extension| Pi["packages/pi<br/>/c7-docs + skills"]
    Agent -->|Plugin| Plugin["plugins/cursor or plugins/claude"]

    MCPServer -->|HTTP| Context7API[("context7.com<br/>mcp.context7.com")]
    AISDK -->|Context7 client| Context7API
    CLI -->|HTTP| Context7API
    Pi -->|HTTP| Context7API
    Plugin -->|MCP wiring| MCPServer

    Context7API --> Index[(Library Index)]
    Context7API --> Docs[(Versioned Snippets)]
```

Source: [README.md](https://github.com/upstash/context7/blob/main/README.md), [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts), [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)

### 3.1 Request Lifecycle

Regardless of which surface a developer uses, the lifecycle converges on the same two-step flow:

```mermaid
graph TD
    A[User asks a library question] --> B{Client surface}
    B -->|MCP| C["resolve-library-id(libraryName)"]
    B -->|CLI| D["ctx7 library <name>"]
    B -->|AI SDK| E["resolveLibraryId()"]
    C --> F[Context7 returns Library[]]
    D --> F
    E --> F
    F --> G{Select best match<br/>name / trust / snippets / benchmark}
    G -->|libraryId| H["query-docs(libraryId, query)"]
    H --> I[Ranked Documentation[]]
    I --> J[Assistant answers with citations]
```

Source: [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts), [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)

---

## 4. Core Packages in Depth

### 4.1 `@upstash/context7-sdk` — The HTTP Client

The SDK is the canonical TypeScript client. It is a thin wrapper around the Context7 HTTP/REST API and is reused by the AI SDK tools and the MCP server.

**Configuration surface**

```ts
interface Context7Config {
  apiKey?: string;
}
```

Source: [packages/sdk/src/commands/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/types.ts)

**Data model returned by the API**

| Type | Key fields | Purpose |
|---|---|---|
| `Library` | `id`, `name`, `description`, `totalSnippets`, `trustScore` (0–10), `benchmarkScore` (0–100), `versions?` | A searchable entry in the Context7 index |
| `Documentation` | `title`, `content`, `source` | A single ranked documentation snippet |
| `GetContextOptions` | `type: "json" \| "txt"` | Response format switch |
| `SearchLibraryOptions` | `type: "json" \| "txt"` | Response format switch |
| `QueryParams` | `Record<string, string \| number \| boolean \| undefined>` | Generic query bag |

Source: [packages/sdk/src/commands/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/types.ts)

**Example usage**

```ts
import { Context7 } from "@upstash/context7-sdk";

const client = new Context7({ apiKey: "<CONTEXT7_API_KEY>" });

const libraries = await client.searchLibrary(
  "I need to build a UI with components",
  "react"
);
console.log(libraries[0].id); // "/facebook/react"

const docs = await client.getContext("How do I use hooks?", "/facebook/react");
```

Source: [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)

> ⚠️ The SDK README is explicit that the package is a **work in progress** and breaking changes may occur. Source: [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)

### 4.2 `@upstash/context7-mcp` — The Model Context Protocol Server

The MCP package is the most widely deployed surface. It is a Node.js binary (`context7-mcp`) that speaks MCP and registers two tools.

**Server identity registered with MCP clients**

| Field | Value |
|---|---|
| `name` | `Context7` |
| `version` | `SERVER_VERSION` (build-time) |
| `websiteUrl` | `https://context7.com` |
| `icons[0].src` | `https://context7.com/context7-icon-green.png` |

Source: [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)

**Runtime dependencies** ([packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json))

| Dependency | Version | Role |
|---|---|---|
| `@modelcontextprotocol/sdk` | `^1.25.1` | MCP protocol implementation |
| `express` | `^5.1.0` | HTTP transport for MCP |
| `@upstash/redis` | `^1.38.0` | Caching layer |
| `jose` | `^6.1.3` | JWT/auth handling |
| `undici` | `^6.6.3` | HTTP client used against `context7.com` |
| `zod` | `^4.3.4` | Input validation for tool schemas |
| `commander` | `^14.0.0` | CLI parsing for the binary |

**Registered tool: `resolve-library-id`**

- **Input:** `query` (required, used for relevance ranking) and `libraryName` (required).
- **Output:** Matching libraries with their Context7-compatible IDs, descriptions, code snippet counts, and source reputation.
- **Workflow rule:** "You MUST call this function before 'Query Documentation' tool to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query." Source: [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)

**Registered tool: `query-docs`**

- **Input:** A Context7 library ID (e.g. `/vercel/next.js`) plus a natural-language query.
- **Output:** Ranked documentation snippets and code examples. Source: [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)

**Server-level instructions emitted to MCP clients** ([packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts))

> "Use this server to fetch current documentation whenever the user asks about a library, framework, SDK, API, CLI tool, or cloud service — even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot. This includes API syntax, configuration, version migration, library-specific debugging, setup instructions, and CLI tool usage. Use even when you think you know the answer — your training data may not reflect recent changes. Prefer this over web search for library docs."
>
> "Do not use for: refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts."

### 4.3 `@upstash/context7-tools-ai-sdk` — Vercel AI SDK Tools and Agents

The AI SDK package exposes two tools plus a pre-configured agent that wraps them. It depends on the SDK and the `ai` package.

**Public exports** ([packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts))

- Agents: `Context7Agent`, `Context7AgentConfig`
- Tools: `resolveLibraryId`, `queryDocs`, `Context7ToolsConfig`
- Prompts: `SYSTEM_PROMPT`, `AGENT_PROMPT`, `RESOLVE_LIBRARY_ID_DESCRIPTION`, `QUERY_DOCS_DESCRIPTION`
- Re-exports from SDK: `Context7Config`, `Library`, `Documentation`, `GetContextOptions`

**Tool configuration** ([packages/tools-ai-sdk/src/tools/types.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/types.ts))

```ts
interface Context7ToolsConfig {
  /** Context7 API key. Falls back to CONTEXT7_API_KEY env var. */
  apiKey?: string;
}
```

**Example: tools with `generateText`**

```ts
import { resolveLibraryId, queryDocs } from "@upstash/context7-tools-ai-sdk";
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";

const { text } = await generateText({
  model: openai("gpt-4o"),
  prompt: "Find React documentation about hooks",
  tools: {
    resolveLibraryId: resolveLibraryId(),
    queryDocs: queryDocs(),
  },
  stopWhen: stepCountIs(5),
});
```

Source: [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)

**`queryDocs` tool contract** ([packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts))

- Built on `ai`'s `tool()` factory and `zod` for schema validation.
- Lazily instantiates a `Context7` client per call, optionally using a passed `apiKey` (otherwise reading `CONTEXT7_API_KEY`).
- Accepts a `libraryId` parameter that the prompt requires the agent to have obtained via `resolveLibraryId` first.

**Agent prompt directives** ([packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts))

The package ships two prompts:

1. `SYSTEM_PROMPT` — a minimal "you are a documentation search assistant" baseline.
2. `AGENT_PROMPT` — a strict 4-step workflow:
   1. Call `resolveLibraryId` with the library name.
   2. Pick the best library by official source, name similarity, description, reputation (High/Medium preferred), code snippet coverage, and benchmark score.
   3. Call `queryDocs` with the chosen ID and the user's question.
   4. Answer with citations.

Both prompts cap tool calls: **"Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have."** Source: [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)

### 4.4 `ctx7` — The CLI

The CLI (`packages/cli`, npm name `ctx7`) is the "no-agent" entry point. It also serves as the setup utility for installing rules, skills, and MCP wiring into various coding agents.

**Binary surface** ([packages/cli/package.json](https://github.com/upstash/context7/blob/main/packages/cli/package.json))

- `bin.ctx7` → `./dist/index.js`
- Type: ESM (`"type": "module"`)
- Bundler: `tsup`

**Core command examples** ([README.md](https://github.com/upstash/context7/blob/main/README.md))

```bash
ctx7 library <name> <query>   # search the index
ctx7 docs <libraryId> <query> # fetch documentation
```

**Setup command** ([packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md))

- `ctx7 setup [--antigravity] [--all-agents] [--yes]` installs skills, rules, and MCP config into the active agent.
- Latest release `ctx7@0.4.5` adds support for `--antigravity`, which:
  - Installs skills to `.agent/skills`.
  - Adds a `GEMINI.md` rule section.
  - Writes MCP config to `~/.gemini/config/mcp_config.json` using `httpUrl` (matching the Gemini convention).
- `ctx7 remove` is the symmetric cleanup command; it only prompts for agents with actual Context7 artifacts and preserves non-Context7 MCP entries.
- `ctx7 upgrade` (since 0.4.0) checks for newer versions and surfaces safer upgrade guidance across `npm`, `pnpm`, `bun`, and ephemeral runners.

**Rules templates** ([packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts))

- The setup flow tries GitHub raw URLs first: `https://raw.githubusercontent.com/upstash/context7/master/rules` and `.../main/rules`.
- If both fail, the `FALLBACK_MCP` and `FALLBACK_CLI` strings are embedded directly in the binary, ensuring the agent always gets a usable rule even offline from the rule CDN.

### 4.5 `@upstash/context7-pi` — Pi Coding Agent Extension

The pi package wires Context7 into the [pi coding agent](https://pi.dev).

**Installation** ([packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md))

```bash
pi install npm:@upstash/context7-pi
export CONTEXT7_API_KEY=ctx7sk_...
```

**What it adds**

| Component | Purpose |
|---|---|
| `resolve-library-id` tool | Convert a name (e.g. `Next.js`) to a Context7 ID (`/vercel/next.js`) |
| `query-docs` tool | Fetch documentation for a resolved ID |
| `context7-docs` skill | Instructs the agent when to invoke the tools |
| `/c7-docs <library> <question>` slash command | One-shot resolve + query flow |

**Auth model**

- Works without setup under IP-based rate limits (good for trying it out).
- For higher quotas, a free key from `context7.com/dashboard` must be exported as `CONTEXT7_API_KEY`.

Source: [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)

### 4.6 Vendor Plugins

**Cursor** ([plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md))
- Ships an MCP server entry pointing at Context7.
- Adds an always-on `use-context7` rule.
- Adds a `context7-docs-lookup` skill.
- Adds a `docs-researcher` agent for context-clean lookups.
- Supports version pinning via the library ID (e.g. including a tag in the ID).

**Claude Code** ([plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md))
- Distributed as a Claude Code marketplace plugin (`context7-plugin@context7-marketplace`).
- Install: `claude plugin marketplace add upstash/context7` then `claude plugin install context7-plugin@context7-marketplace`.
- Provides MCP server, skills, a `docs-researcher` agent, and a `/context7:docs` slash command.

---

## 5. Configuration and Authentication

Context7 follows a consistent authentication story across packages: an API key is preferred, with an unauthenticated fallback gated by IP-based rate limits.

| Surface | Key source | Fallback |
|---|---|---|
| SDK | `Context7Config.apiKey` constructor arg | None — key is required for production use |
| AI SDK tools | `Context7ToolsConfig.apiKey` | `CONTEXT7_API_KEY` environment variable |
| MCP server | Per-server env (typical `CONTEXT7_API_KEY`) | Unauthenticated IP-rate-limited calls |
| CLI | `CONTEXT7_API_KEY` env var | Unauthenticated IP-rate-limited calls |
| Pi extension | `CONTEXT7_API_KEY` env var | IP-based rate limits |

Source: [packages/tools-ai-sdk/src/tools/types.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/types.ts), [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts), [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)

### 5.1 Slash-Command Authoring Pattern

The README documents two ways for an agent to invoke Context7 deterministically:

```txt
How do I connect to MongoDB? use library /mongodb/docs
How do I set up Next.js 14 middleware? use context7
```

The `use library /org/project[/version]` form bypasses `resolve-library-id` entirely. The `use context7` form expects the agent to use the configured tool flow. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

### 5.2 Library ID Format

| Form | Example | Interpretation |
|---|---|---|
| `/org/project` | `/facebook/react` | Latest indexed version of the project |
| `/org/project/version` | `/vercel/next.js/v14.2.0` | Pinned to a specific version/tag |

Source: [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts), [README.md](https://github.com/upstash/context7/blob/main/README.md)

---

## 6. Telemetry and Update UX

### 6.1 CLI Telemetry

- Telemetry emits fire-and-forget events to `/api/v2/cli/events` (commands, searches, installs, generation feedback).
- Opt-out: `CTX7_TELEMETRY_DISABLED` environment variable. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### 6.2 Update Notifications

- `ctx7` checks for newer versions and surfaces a non-blocking notice before interactive commands.
- `ctx7 upgrade` provides guidance for `npm`, `pnpm`, `bun`, and ephemeral runners. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### 6.3 Skill Discovery and Generation

- `ctx7 skills suggest` scans `package.json`, `requirements.txt`, and `pyproject.toml` to recommend relevant skills with install counts and trust scores. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- `ctx7 skills install` supports `--all-agents` and `--yes` for non-interactive multi-agent installs. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- `ctx7 skills generate` provides AI-powered skill creation, with an OAuth auto-login flow. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

---

## 7. Common Failure Modes and Mitigations

| Failure mode | Observed behavior | Mitigation in code |
|---|---|---|
| Hitting unauthenticated rate limits | Calls fail with quota errors | Export `CONTEXT7_API_KEY=ctx7sk_...` (MCP, AI SDK, CLI, Pi) |
| Agent calls `query-docs` with no library ID | Tool returns a schema error | All surfaces ship instructions telling the agent to call `resolve-library-id` first; `AGENT_PROMPT` enforces a strict 4-step workflow ([packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)) |
| Agent loops on a bad query | Tool floods the context | Hard cap of 3 calls per question, per the `QUERY_DOCS_DESCRIPTION` and `AGENT_PROMPT` |
| Rules CDN unreachable on first install | `ctx7 setup` can't fetch rules | `FALLBACK_MCP` and `FALLBACK_CLI` strings embedded in the binary ([packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)) |
| Windows path validation rejecting valid files | Skill install aborts | Patch in 0.3.13 normalizes backslash paths ([packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)) |
| Codex sandbox blocks CLI network access | DNS or network failure inside the sandbox | 0.3.12 added Codex-specific setup guidance telling Codex to rerun outside the default sandbox ([packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)) |

---

## 8. Community-Driven Concerns and Roadmap Signals

These are the most-engaged feature requests and pain points observed in the project's issue tracker. The page describes what the code does today; the items below map directly to open community discussions.

| Issue | Theme | Current state in code | Where it surfaces |
|---|---|---|---|
| #59 — Self-host the documentation backend | Deployment / vendor lock-in | All clients hardcode `context7.com` / `mcp.context7.com` endpoints ([packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts), [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md)) | Would require a configurable base URL across SDK, MCP, CLI, and Pi |
| #320 — Offline / air-gapped docs | Network independence | No local cache of indexed snippets in the open-source packages; MCP and SDK always call `context7.com` | Would require bundling snippets locally and a switch to a local data source |
| #34 — Private documents | Multi-tenant indexing | Library IDs in the type system are public-shaped (`/org/project`) and accounts are not modeled in the SDK types ([packages/sdk/src/commands/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/types.ts)) | Would require a user-scoped index and per-key access control |
| #45 — Versioning of docs | Version pinning | Slash syntax supports `/org/project/version`; `Library.versions` exists on the type ([packages/sdk/src/commands/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/types.ts), [README.md](https://github.com/upstash/context7/blob/main/README.md)) | Partially supported; agent prompts already instruct agents to use version-specific IDs |
| #19 — Generic "getting error" thread | Stability / diagnostics | No structured error catalog in the open-source repo; clients surface raw HTTP errors | Would benefit from typed error enums on the SDK |

Source: Issues referenced from [README.md](https://github.com/upstash/context7/blob/main/README.md) and the community context provided alongside this page.

---

## 9. Choosing the Right Surface

```mermaid
graph TD
    Start[What are you building?] --> Q1{Need an MCP-aware agent?}
    Q1 -->|Yes| MCP[Use packages/mcp or a plugin]
    Q1 -->|No| Q2{Using Vercel AI SDK?}
    Q2 -->|Yes| AITools[Use packages/tools-ai-sdk]
    Q2 -->|No| Q3{Need a pi agent integration?}
    Q3 -->|Yes| Pi[Use packages/pi]
    Q3 -->|No| Q4{Need a terminal one-shot?}
    Q4 -->|Yes| CLI[Use packages/cli ctx7 docs]
    Q4 -->|No| SDK[Use packages/sdk directly]
```

Source: [README.md](https://github.com/upstash/context7/blob/main/README.md), [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md), [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md), [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)

---

## 10. See Also

- [packages/sdk/README.md](https://github.com/upstash/context7/blob/main/packages/sdk/README.md) — HTTP client reference
- [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md) — AI SDK tool reference
- [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts) — MCP server registration and tool schemas
- [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) — CLI version history and behavior changes
- [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md) — Cursor plugin reference
- [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md) — Claude Code plugin reference
- [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md) — pi coding agent extension

---

<a id='page-2'></a>

## MCP Server and Core Documentation Tools

### Related Pages

Related topics: [Context7 Platform Overview and Architecture](#page-1), [SDKs, Extensions, and Plugin Ecosystem](#page-4)

<details>
<summary>Related Source Files</summary>

The following source files were used to generate this page:

- [README.md](https://github.com/upstash/context7/blob/main/README.md)
- [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)
- [packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)
- [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)
- [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)
- [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)
- [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)
- [packages/cli/src/setup/agents.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/agents.ts)
- [packages/cli/src/setup/mcp-writer.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/mcp-writer.ts)
- [packages/cli/src/commands/setup.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/commands/setup.ts)
- [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)
- [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)
- [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)
</details>

# MCP Server and Core Documentation Tools

## Overview

Context7's MCP (Model Context Protocol) Server is the central client-facing component of the platform. It exposes two LLM-callable tools — `resolve-library-id` and `query-docs` — that allow AI coding assistants to look up up-to-date documentation for any library, framework, SDK, or CLI tool. The same tool surface is also delivered through companion packages: a Vercel AI SDK adapter (`@upstash/context7-tools-ai-sdk`), a CLI (`ctx7`), a pi coding-agent extension (`@upstash/context7-pi`), and a Cursor plugin.

The MCP server itself is intentionally thin. It does **not** crawl, parse, or store documentation in this repository. The supporting components — the API backend, the parsing engine, and the crawling engine — are private and not part of this open-source repository. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

> "This repository hosts the MCP server's source code. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this repository." — [README.md](https://github.com/upstash/context7/blob/main/README.md)

This separation is important context for several of the most-upvoted community issues: requests for self-hosting the documentation backend (#59), offline / air-gapped operation (#320), and private document indexes (#34) all intersect with the boundary between the open MCP server and the private backend.

## High-Level Architecture

```mermaid
graph TD
    A[AI Coding Agent<br/>Cursor, Claude Code, Codex, etc.] -->|MCP protocol| B[Context7 MCP Server<br/>@upstash/context7-mcp]
    A -.->|slash command| C[ctx7 CLI]
    A -.->|AI SDK tool calls| D[tools-ai-sdk]
    A -.->|pi extension| E[context7-pi]
    B -->|HTTPS / API key| F[(Context7 API<br/>context7.com/api)]
    C -->|HTTPS / API key| F
    D -->|HTTPS / API key| F
    E -->|HTTPS / API key| F
    F --> G[(Private: Crawler)]
    F --> H[(Private: Parser)]
    F --> I[(Private: Indexed Docs)]
    B -.stdio or http transport.-> A
    C -.reads/writes MCP config.-> J[Agent config files<br/>~/.claude, .cursor, etc.]
    D -.uses CONTEXT7_API_KEY.-> A
```

The MCP server is the canonical implementation; the CLI, AI SDK tools, and pi extension are delivery mechanisms that ultimately call the same private API. Source: [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)

## The Two Core Tools

The MCP server exposes two tools, both of which are mirrored in the AI SDK, CLI, and pi extension packages. Their descriptions are intentionally kept identical so that the LLM receives the same instructions regardless of the client. Source: [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

> "Tool titles, descriptions, and parameter descriptions are copied verbatim from `@upstash/context7-mcp` (packages/mcp/src/index.ts) so pi and MCP clients give the LLM identical instructions. Update both together when tweaking guidance." — [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

### `resolve-library-id`

Resolves a human-friendly package or product name into a Context7-compatible library ID. **It must be called before `query-docs`** unless the user already supplied a library ID in `/org/project` (or `/org/project/version`) form.

| Parameter     | Type   | Required | Description                                                                                       |
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `query`       | string | yes      | The user's question or task. Used to rank results by relevance.                                    |
| `libraryName` | string | yes      | The name of the library to search for. Use the official name with proper punctuation (e.g., `"Next.js"`). |

The tool returns a list of matching libraries, each annotated with:

- **Library ID** in `/org/project` form.
- **Name** and **Description**.
- **Code Snippets** count — higher is better.
- **Source Reputation** — `High`, `Medium`, `Low`, or `Unknown`.
- **Benchmark Score** — up to 100.
- **Versions** — if available; use one of these if the user specified a version.

The selection process the LLM is instructed to follow is:

1. Analyze the query to understand the library/package the user wants.
2. Pick the most relevant match based on name similarity, description relevance, snippet coverage, source reputation, and benchmark score. Source: [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

### `query-docs`

Fetches documentation and code examples for a resolved library ID. Source: [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)

| Parameter    | Type   | Required | Description                                                                          |
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------ |
| `libraryId`  | string | yes      | Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`).    |
| `query`      | string | yes      | The user's full question — not a single word.                                       |

Internally the AI SDK tool constructs a `Context7` client using the supplied `apiKey` (or the `CONTEXT7_API_KEY` environment variable if none is given):

```typescript
export function queryDocs(config: Context7ToolsConfig = {}) {
  const { apiKey } = config;
  const getClient = () => new Context7({ apiKey });
  // ...
}
```

Source: [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)

### Recommended Two-Step Workflow

The Context7 system prompt defines an explicit four-step workflow for the LLM:

```mermaid
graph TD
    S1[Step 1: resolveLibraryId with library name] --> S2[Step 2: Analyze results]
    S2 --> S3{Is there a version?}
    S3 -- yes --> V[Use /org/project/version]
    S3 -- no --> I[Use /org/project]
    V --> S4[Step 3: queryDocs]
    I --> S4
    S4 --> S5[Step 4: Answer with code examples<br/>and cite the library ID]
```

Source: [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)

## Transport: stdio vs HTTP

The MCP server can be reached over either transport. The transport is selected at setup time by the CLI. Source: [packages/cli/src/commands/setup.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/commands/setup.ts)

```typescript
function resolveTransport(options: SetupOptions): Transport {
  return options.stdio ? "stdio" : "http";
}
```

The default is HTTP, which the Cursor deeplink install also uses. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

```text
https://mcp.context7.com/mcp
```

When the Antigravity agent is targeted, the HTTP transport is configured with an `httpUrl` key (the Gemini convention) rather than a generic `serverUrl`:

```typescript
buildEntry: (auth, transport) =>
  transport === "stdio" ? stdioEntry(auth) : withHeaders({ httpUrl: mcpUrl(auth) }, auth),
```

Source: [packages/cli/src/setup/agents.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/agents.ts)

## Setup via the `ctx7 setup` Command

`ctx7 setup` is the recommended one-shot installer. It writes the MCP config, drops a rule file, and installs a skill for the selected agent(s). Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### Supported Agents and Their Config Layouts

| Agent        | MCP config file                                    | Rule file                         | Skill directory                |
| ------------ | -------------------------------------------------- | --------------------------------- | ------------------------------ |
| `claude`     | `~/.claude.json` / `.mcp.json`                     | `CLAUDE.md`                       | `.claude/skills`               |
| `cursor`     | `~/.cursor/mcp.json` / `.cursor/mcp.json`         | Cursor Rules                      | `.cursor/skills`               |
| `codex`      | `~/.codex/config.toml`                             | `AGENTS.md`                       | `.codex/skills`                |
| `opencode`   | `opencode.json`                                    | `AGENTS.md`                       | `.opencode/skill`              |
| `gemini`     | `~/.gemini/settings.json`                          | `GEMINI.md`                       | —                              |
| `antigravity`| `~/.gemini/config/mcp_config.json`                 | `~/.gemini/GEMINI.md` / `GEMINI.md`| `.agent/skills`                |

Source: [packages/cli/src/setup/agents.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/agents.ts)

### `setup` Command Flags

| Flag             | Effect                                                              |
| ---------------- | ------------------------------------------------------------------- |
| `--claude`       | Configure for Claude Code                                           |
| `--cursor`       | Configure for Cursor                                                |
| `--codex`        | Configure for Codex CLI                                             |
| `--opencode`     | Configure for opencode                                              |
| `--gemini`       | Configure for Gemini CLI                                            |
| `--antigravity`  | Configure for Antigravity 2.0 (added in `ctx7@0.4.5`)               |
| `--project`      | Write config to the project (vs. the user's home directory)         |
| `--stdio`        | Use stdio transport instead of HTTP                                 |
| `--mcp`          | Setup mode: install only the MCP config                             |
| `--cli`          | Setup mode: install only the CLI                                    |
| `--api-key <k>`  | Use a specific API key                                              |
| `--oauth`        | Authenticate via OAuth                                              |
| `--yes`          | Non-interactive: accept all defaults                                |

Source: [packages/cli/src/commands/setup.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/commands/setup.ts) and [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

The latest release (`ctx7@0.4.5`) extends this with first-class Antigravity 2.0 support:

> "`ctx7 setup` now properly supports `--antigravity`, installing skills to `.agent/skills`, a `GEMINI.md` rule section (Antigravity reads Gemini-family config), and MCP config to Antigravity 2.0's documented global path `~/.gemini/config/mcp_config.json` (with `httpUrl` for HTTP, matching the Gemini convention). Antigravity has no documented project-level MCP file." — [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### The Default Rule Text

When a project has no prior `context7` rule, `ctx7 setup` writes a rule that tells the agent to reach for `resolve-library-id` → `query-docs` automatically. The fallback rule looks like this (truncated for length):

```text
Use Context7 MCP to fetch current documentation whenever the user asks about a
library, framework, SDK, API, CLI tool, or cloud service -- even well-known
ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot.

Steps
1. resolve-library-id with the library name and the user's question
2. Pick the best match by exact name, description, snippet count, source
   reputation, and benchmark score
3. query-docs with the selected library ID and the user's full question
4. Answer using the fetched docs
```

Source: [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)

## Authentication

The MCP server and the AI SDK tools both read the `CONTEXT7_API_KEY` environment variable when no explicit key is provided. Source: [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)

```bash
export CONTEXT7_API_KEY=ctx7sk_...
```

Without a key, requests are served at IP-based rate limits, which is useful for trying the service out. The pi extension README makes this explicit:

> "The extension works without any setup at IP-based rate limits — useful for trying it out. For higher quotas, generate a free key at context7.com/dashboard." — [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)

The CLI additionally supports an OAuth flow that fires automatically when authentication is required (for example, for `ctx7 skills generate`):

> "Auto-login via OAuth when the generate command requires authentication instead of showing an error." — [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

## Versioning

Library versions are part of the library ID format: `/org/project` for the default version, or `/org/project/version` to pin a specific release. The `resolve-library-id` response includes a `versions` array; the AI is instructed to pick from it when the user mentions a version. Source: [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

> "Versions: List of versions if available. Use one of those versions if the user provides a version in your query. The format of the version is /org/project/version." — [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

This addresses the long-standing community request in #45 for explicit documentation versioning — though version pinning is supported by the data model, the granularity depends on what the crawler has ingested for a given library.

The Cursor plugin README documents the same pattern:

> "To get documentation for a specific version, include the version in the library…" — [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)

## Research Mode

A "research" mode exposes deep, agent-driven documentation answers. It is reachable through both surfaces:

| Surface         | How to invoke research mode                       |
| --------------- | ------------------------------------------------- |
| MCP tool        | Call the `researchMode` MCP tool                  |
| CLI             | `ctx7 docs --research <libraryId> <query>`        |

Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

> "Expose research mode through the MCP `researchMode` tool and the CLI `docs --research` flag for deep, agent-driven documentation answers." — [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

## CLI Surface

The `ctx7` CLI mirrors the MCP tool surface in a shell-friendly form. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

| Command                                  | Description                                                                                  |
| ---------------------------------------- | -------------------------------------------------------------------------------------------- |
| `ctx7 library <name> <query>`            | Searches the Context7 index by library name and returns matching libraries with their IDs.   |
| `ctx7 docs <libraryId> <query>`          | Retrieves documentation for a library using a Context7-compatible library ID.                |
| `ctx7 docs <libraryId> <query> --research` | Use research mode for deeper, agent-driven answers.                                        |
| `ctx7 setup [--claude\|--cursor\|...]`   | One-shot installer for a coding agent.                                                       |
| `ctx7 remove`                            | Cleanup counterpart to `ctx7 setup`; preserves non-Context7 MCP entries.                    |
| `ctx7 upgrade`                           | Check for a newer CLI version with safer guidance across npm/pnpm/bun.                       |
| `ctx7 skills suggest`                    | Scan `package.json`, `requirements.txt`, `pyproject.toml` and recommend skills.               |
| `ctx7 skills install [--all-agents --yes]` | Install a skill across all detected agents non-interactively.                              |
| `ctx7 skills generate`                   | AI-generate a new skill (requires auth, may trigger OAuth).                                  |

Sources: [README.md](https://github.com/upstash/context7/blob/main/README.md), [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

## AI SDK Adapter (`@upstash/context7-tools-ai-sdk`)

For Vercel AI SDK users, the same two tools are exposed as `resolveLibrary` and `getLibraryDocs`, plus a pre-wired `Context7Agent` that performs the multi-step workflow. Source: [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)

```typescript
import { Context7Agent } from "@upstash/context7-tools-ai-sdk";
import { anthropic } from "@ai-sdk/anthropic";

const agent = new Context7Agent({
  model: anthropic("claude-sonnet-4-20250514"),
});

const { text } = await agent.generate({
  prompt: "How do I set up routing in Next.js?",
});
```

The package's public surface is the union of tools, the agent, and a re-export of the relevant prompts and SDK types. Source: [packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)

```typescript
export { Context7Agent, type Context7AgentConfig } from "@agents";
export { resolveLibraryId, queryDocs, type Context7ToolsConfig } from "@tools";
export {
  SYSTEM_PROMPT,
  AGENT_PROMPT,
  RESOLVE_LIBRARY_ID_DESCRIPTION,
  QUERY_DOCS_DESCRIPTION,
} from "@prompts";
```

## pi Extension (`@upstash/context7-pi`)

The pi extension mirrors the MCP surface in a form suited to the pi coding agent. It adds:

- The two tools (`resolve-library-id`, `query-docs`).
- A `context7-docs` skill that triggers them automatically.
- A `/c7-docs <library> <question>` slash command that runs the resolve + query flow in one shot.

Install:

```bash
pi install npm:@upstash/context7-pi
```

Source: [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)

## Cursor Plugin

The Cursor plugin bundles the MCP server, an always-on `use-context7` rule, a `context7-docs-lookup` skill, and a dedicated `docs-researcher` agent. Source: [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)

```mermaid
graph TD
    C[Cursor] --> P[context7 plugin]
    P --> M[MCP Server]
    P --> R[use-context7 rule]
    P --> S[context7-docs-lookup skill]
    P --> A[docs-researcher agent]
    M -->|resolve-library-id| API[Context7 API]
    M -->|query-docs| API
```

## Configuration Reference

| Environment variable       | Used by                       | Purpose                                                                |
| -------------------------- | ----------------------------- | ---------------------------------------------------------------------- |
| `CONTEXT7_API_KEY`         | MCP server, AI SDK, pi, CLI   | Authenticated requests, raises quota above IP-based limits.            |
| `CTX7_TELEMETRY_DISABLED`   | CLI                           | Disable fire-and-forget usage events posted to `/api/v2/cli/events`.   |
| `EDITOR`                   | CLI                           | Editor opened by the "View skill" action in `skills generate`.         |

Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md), [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)

## Common Failure Modes and Community Notes

### Network / API Downtime

Because all client surfaces (MCP server, CLI, AI SDK, pi) ultimately call the hosted Context7 API, the system is sensitive to outages at `context7.com`. This is the central concern behind issue #59, which requests the ability to self-host the documentation backend. As of the current codebase, **the open repository does not include the backend**, so self-hosting the documentation service is not possible from this repo alone. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

### Air-Gapped / Offline Use

Issue #320 asks for offline documentation. The MCP client itself is a thin client and cannot retrieve anything without a reachable API. There is no offline cache in the open repository. Source: [README.md](https://github.com/upstash/context7/blob/main/README.md)

### Private Documents

Issue #34 asks for private document indexes tied to user accounts. Authentication via `CONTEXT7_API_KEY` exists, and the CLI supports OAuth-based login, but private document storage lives in the private backend and is not exposed by the open MCP server. Source: [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts), [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### Generic "getting error" Reports

Issue #19 is the most-commented community thread and consists almost entirely of user-submitted error screenshots. The most common remedies, derived from the code rather than the issue thread:

- Re-run `ctx7 setup` so the agent's MCP config is regenerated and the rule/skill are installed.
- Export `CONTEXT7_API_KEY` in the shell that launches the agent.
- For Codex in particular, the rule and skill now tell the agent to retry Context7 CLI requests outside the default sandbox after DNS or network failures. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- For Windows users, the `skills install` path validation bug that rejected valid files inside the target directory was fixed in `ctx7@0.3.13`. Source: [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)

### Version Pinning Caveats

Version IDs in the form `/org/project/version` are accepted by the API, but only versions that the crawler has ingested will resolve. Users pinning to very old or pre-release tags (the example in #45 was `v13.5.11` of `vercel/next.js`) may receive empty results if those tags have not been indexed. Source: [packages/pi/lib/prompts.ts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)

## How the Pieces Fit Together

```mermaid
graph TD
    subgraph Open Source
        MCP[packages/mcp<br/>@upstash/context7-mcp]
        SDK[packages/tools-ai-sdk]
        CLI[packages/cli / ctx7]
        PI[packages/pi]
        CUR[plugins/cursor]
        MCP -.shared prompts.-> SDK
        MCP -.shared prompts.-> PI
        CLI -.configures.-> MCP
        CLI -.configures.-> SDK
        CLI -.configures.-> PI
        CUR -.bundles.-> MCP
    end
    subgraph Private
        API[Context7 API]
        CR[Crawler]
        PR[Parser]
        IDX[Indexed Docs]
    end
    MCP -->|HTTPS| API
    SDK -->|HTTPS| API
    CLI -->|HTTPS| API
    PI -->|HTTPS| API
    API --- CR
    API --- PR
    API --- IDX
```

Source: [README.md](https://github.com/upstash/context7/blob/main/README.md), [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)

## See Also

- [Context7 Platform README](https://github.com/upstash/context7/blob/main/README.md)
- [`@upstash/context7-mcp` package configuration](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)
- [AI SDK tools — queryDocs implementation](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)
- [AI SDK system prompts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)
- [AI SDK package entry point](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)
- [CLI setup templates (fallback rules)](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)
- [CLI agent registry (Claude, Cursor, Codex, Antigravity, …)](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/agents.ts)
- [`ctx7 setup` command](https://github.com/upstash/context7/blob/main/packages/cli/src/commands/setup.ts)
- [MCP config writer (TOML / JSON)](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/mcp-writer.ts)
- [CLI changelog (Antigravity 2.0, research mode, Windows fix)](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- [pi extension README](https://github.com/upstash/context7/blob/main/packages/pi/README.md)
- [pi extension shared prompts](https://github.com/upstash/context7/blob/main/packages/pi/lib/prompts.ts)
- [Cursor plugin README](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)

---

<a id='page-3'></a>

## ctx7 CLI, Agent Setup, and Skills System

### Related Pages

Related topics: [Context7 Platform Overview and Architecture](#page-1), [SDKs, Extensions, and Plugin Ecosystem](#page-4)

<details>
<summary>Related Source Files</summary>

The following source files were used to generate this page:

- [README.md](https://github.com/upstash/context7/blob/main/README.md)
- [packages/cli/README.md](https://github.com/upstash/context7/blob/main/packages/cli/README.md)
- [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- [packages/cli/package.json](https://github.com/upstash/context7/blob/main/packages/cli/package.json)
- [packages/cli/src/types.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/types.ts)
- [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)
- [packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)
- [packages/tools-ai-sdk/src/agents/context7.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/agents/context7.ts)
- [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)
- [packages/tools-ai-sdk/src/prompts/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/index.ts)
- [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)
- [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)
- [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)
- [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)
- [plugins/cursor/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)
</details>

# ctx7 CLI, Agent Setup, and Skills System

The `ctx7` CLI is the user-facing entry point for the Context7 documentation service. It bundles three concerns into a single Node.js binary: a **client** for resolving libraries and fetching their docs, an **agent installer** that wires Context7 into popular AI coding assistants, and a **skills lifecycle manager** for installing, searching, and generating reusable agent skills. As of the latest release (`ctx7@0.4.5`), the CLI is published as a single ESM binary named `ctx7` from the `packages/cli` workspace [Source: [packages/cli/package.json:1-15](https://github.com/upstash/context7/blob/main/packages/cli/package.json)].

```mermaid
graph TD
    A[User Terminal] -->|npx ctx7| B[ctx7 CLI]
    B --> C[docs / library commands]
    B --> D[setup / remove commands]
    B --> E[skills commands]
    B --> F[auth commands]
    B --> G[upgrade command]
    C --> H[Context7 API<br/>context7.com/api]
    D --> I[Agent Config Files<br/>.cursor/mcp.json, ~/.claude/...]
    E --> J[Local Skills Directory<br/>~/.agents/skills]
    F --> K[OAuth + API Key]
    H --> L[Upstash / Search Index]
```

## High-Level Role in the Repository

The Context7 monorepo contains three primary client surfaces that all delegate to the same hosted API:

| Package | Role | Source |
| --- | --- | --- |
| `packages/mcp` | Model Context Protocol server for editors that speak MCP | [packages/mcp/package.json:1-15](https://github.com/upstash/context7/blob/main/packages/mcp/package.json) |
| `packages/tools-ai-sdk` | Vercel AI SDK tools (`resolveLibraryId`, `queryDocs`) and a `Context7Agent` | [packages/tools-ai-sdk/src/index.ts:1-15](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts) |
| `packages/cli` (`ctx7`) | Human-facing CLI for library lookups, agent setup, and skill management | [packages/cli/README.md:1-10](https://github.com/upstash/context7/blob/main/packages/cli/README.md) |

The CLI is intentionally the lowest-friction way to onboard: it requires no code changes, no editor plugin installation, and no SDK integration. A single `npx ctx7 setup` command provisions a working MCP-backed documentation assistant in any supported agent [Source: [packages/cli/README.md:7-22](https://github.com/upstash/context7/blob/main/packages/cli/README.md)].

## Command Surface

The CLI exposes several command groups. The following table summarizes each command, its purpose, and the most common invocation form. All descriptions are grounded in either the CLI README or the CHANGELOG.

| Command | Purpose | Key Flags / Notes |
| --- | --- | --- |
| `ctx7 setup` | Configure MCP + rules + skills for one or more AI agents | `--cursor`, `--claude`, `--opencode`, `--antigravity`, `--all-agents`, `--yes` |
| `ctx7 remove` | Undo a `setup`, removing only Context7-owned artifacts | Prompts only for agents that actually contain Context7 entries |
| `ctx7 upgrade` | Update the CLI binary via the user's package manager (npm/pnpm/bun) | Caches a "newer version available" check; non-blocking notice |
| `ctx7 docs <libraryId> <query>` | Fetch documentation for a specific library | `--json`, `--research` (deep agent-driven research) |
| `ctx7 library <name>` | Resolve a human name to a Context7 library ID | `--json` |
| `ctx7 skills install` | Install one or more skills into detected agent directories | `--all-agents`, `--yes` |
| `ctx7 skills search` | Browse the skill hub with install counts and trust scores | Columns: `Installs`, `Trust (0–10)` |
| `ctx7 skills list` | List skills already present in detected directories | No prompt (per `0.2.0` simplification) |
| `ctx7 skills suggest` | Scan `package.json`, `requirements.txt`, `pyproject.toml` and recommend skills | Based on project dependencies |
| `ctx7 skills generate` | AI-powered generation of a new skill (OAuth-gated) | Includes a feedback loop and a weekly quota |
| `ctx7 login` / `logout` | OAuth 2.0 authentication | Stores a refreshable token |
| `ctx7 whoami` | Display identity, teamspace, and active teamspace name | Uses the internal API endpoint |

These commands are documented in the CLI's user-facing README [Source: [packages/cli/README.md:1-70](https://github.com/upstash/context7/blob/main/packages/cli/README.md)] and their evolution is tracked in the CHANGELOG [Source: [packages/cli/CHANGELOG.md:1-110](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## Agent Setup Workflow

### What `ctx7 setup` Does

`ctx7 setup` is the canonical onboarding flow. It performs three logical steps:

1. **Authenticate** via OAuth 2.0 and persist a refreshable token plus an API key [Source: [packages/cli/CHANGELOG.md:78-92](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
2. **Write an MCP server entry** to the agent's config file, using the agent-specific key (`mcpServers`, `mcp_config.json`, etc.).
3. **Install a rule and a skill** so the agent knows when to invoke Context7 automatically.

The `--antigravity` flag (added in `0.4.5`) installs the skill to `.agent/skills`, appends a `GEMINI.md` rule section (Antigravity reads Gemini-family config), and writes the MCP config to `~/.gemini/config/mcp_config.json` using `httpUrl` for HTTP transport [Source: [packages/cli/CHANGELOG.md:1-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

### Supported Agents

```mermaid
graph LR
    Setup[ctx7 setup] --> Claude[--claude<br/>Claude Code]
    Setup --> Cursor[--cursor<br/>Cursor]
    Setup --> OpenCode[--opencode<br/>OpenCode / AGENTS.md]
    Setup --> Antigravity[--antigravity<br/>Antigravity 2.0]
    Setup --> Codex[Codex<br/>AGENTS.md append]
    Setup --> All[--all-agents]
```

- **Claude Code** — installs the `context7` plugin via the Claude marketplace; ships a `docs-researcher` agent, a `/context7:docs` command, and a `find-docs` skill [Source: [plugins/claude/context7/README.md:1-30](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)].
- **Cursor** — writes `mcp.json`, an always-on `use-context7` rule (with `alwaysApply: true`), and a `context7-docs-lookup` skill [Source: [plugins/cursor/context7/README.md:1-22](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)].
- **OpenCode / Codex** — write to `AGENTS.md` (OpenCode was migrated from `.opencode/rules/` in `0.3.10`) [Source: [packages/cli/CHANGELOG.md:38-45](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- **Antigravity** — global config at `~/.gemini/config/mcp_config.json`, project-level rule in `GEMINI.md`, skill in `.agent/skills` [Source: [packages/cli/CHANGELOG.md:1-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

### Version Pinning

The Cursor plugin documentation explicitly notes that a specific version can be requested by including the version in the library name (e.g., `Next.js 13`), so that the resolver returns a tag-pinned library ID [Source: [plugins/cursor/context7/README.md:25-30](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md)]. This addresses the community interest in documentation versioning (see [issue #45](https://github.com/upstash/context7/issues/45)).

### Path Resolution and Security

The setup flow writes configuration into well-known directories. Several CHANGELOG entries show hardening around path resolution:

- `0.3.7`: removed `shell: true` from the `spawn` call in the `generate` command to prevent command injection via the `EDITOR` environment variable [Source: [packages/cli/CHANGELOG.md:55-58](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- `0.3.7`: prevented directory traversal in skill file installation by validating that resolved paths stay within the target directory [Source: [packages/cli/CHANGELOG.md:59-61](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- `0.3.13`: fixed skill installation path validation on Windows so that valid files inside the target directory are not rejected due to backslash-separated resolved paths [Source: [packages/cli/CHANGELOG.md:22-25](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

The `find-docs` skill is the canonical trigger: the CHANGELOG notes its description was rewritten in `0.3.10` to push invocation rates from 66% to 98% [Source: [packages/cli/CHANGELOG.md:38-45](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## Skills System

### What a Skill Is in Context7

A skill is a bundle of files (typically a `SKILL.md` plus optional auxiliary assets) that teaches an AI agent *when and how* to use Context7's MCP tools. Skills are agent-agnostic in their on-disk representation but installed into agent-specific directories by the CLI [Source: [packages/cli/src/types.ts:1-15](https://github.com/upstash/context7/blob/main/packages/cli/src/types.ts)].

The internal type model distinguishes between **hub skills** (downloadable from the Context7 skill hub) and **setup skills** (the locally generated `find-docs` skill that is bundled with the CLI). This split is reflected in the `TODO(deprecate-skills-phase-2)` comment in the types file, which marks the legacy `Skill`, `SkillSearchResult`, `LibrarySearchResult`, and related response types for removal [Source: [packages/cli/src/types.ts:1-80](https://github.com/upstash/context7/blob/main/packages/cli/src/types.ts)].

### Skill Metadata

Hub skills expose a small set of metadata fields used for ranking and trust signaling:

| Field | Type | Description |
| --- | --- | --- |
| `name` | `string` | Display name shown in prompts and search results |
| `description` | `string` | One-line description used for the skill's invocation trigger |
| `url` | `string` | Canonical URL on `context7.com` |
| `installCount` | `number` | Cumulative install counter, shown as `↓100+` style buckets [Source: [packages/cli/CHANGELOG.md:95-100](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)] |
| `trustScore` | `number` | 0–10 score surfaced in the `Trust(0–10)` column of search results [Source: [packages/cli/CHANGELOG.md:108-112](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)] |

A skill is "blocked" if prompt-injection heuristics flag its description; the `blockedSkillsCount` field on `ListSkillsResponse` is the public surface for that signal [Source: [packages/cli/src/types.ts:30-35](https://github.com/upstash/context7/blob/main/packages/cli/src/types.ts)].

### Skill Lifecycle Commands

```mermaid
graph TD
    A[skills suggest] -->|scan deps| B[Recommended skills]
    B --> C[skills search]
    C -->|pick one| D[skills install]
    D -->|write to| E[Agent skill dir]
    F[skills generate] -->|OAuth required| G[Wizard: questions, then generation]
    G --> H[Save to disk / open in $EDITOR]
    I[skills list] --> J[Inventory of installed skills]
    K[skills remove] --> E
```

Each command maps to a specific user goal:

- **`skills suggest`** scans `package.json`, `requirements.txt`, and `pyproject.toml` to recommend skills that match the project's actual dependencies [Source: [packages/cli/CHANGELOG.md:115-118](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- **`skills search`** returns a ranked list with install counts and trust scores; items are presented with numbered rows, hover highlighting, and Enter-to-select [Source: [packages/cli/CHANGELOG.md:130-140](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- **`skills install`** supports `--all-agents` (write to every detected agent) and `--yes` (non-interactive) [Source: [packages/cli/CHANGELOG.md:18-21](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- **`skills generate`** is the AI wizard: it asks clarifying questions, streams query progress, lets the user give feedback, and enforces a weekly quota. Generation requires OAuth, and `0.2.2` added auto-login via OAuth when the command is run unauthenticated [Source: [packages/cli/CHANGELOG.md:108-115](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].
- **`skills list`** is now promptless since `0.2.0`; it shows all detected IDE skill directories [Source: [packages/cli/CHANGELOG.md:125-127](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

### Skill Installation Paths

Universal global skills are installed to `~/.agents/skills` (this was changed from `~/.config/agents/skills` in `0.3.10`) [Source: [packages/cli/CHANGELOG.md:46-48](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)]. Per-agent paths are listed in the table above.

### Prompt Injection Defense

Since `0.1.4`, the CLI runs a prompt-injection detector on downloaded skill content; blocked skills are reported via a warning message rather than being installed silently [Source: [packages/cli/CHANGELOG.md:148-150](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## Library and Documentation Commands

The two commands that touch the documentation API itself are `library` and `docs`.

### `ctx7 library`

Resolves a human-readable name to a Context7 library ID. The result includes, for each candidate, the ID, title, description, branch, snippet count, token estimate, star count, trust score, benchmark score, and available versions [Source: [packages/cli/src/types.ts:60-72](https://github.com/upstash/context7/blob/main/packages/cli/src/types.ts)]. A `--json` flag emits the raw response for piping.

### `ctx7 docs`

Fetches documentation for a specific library ID. Output is, by default, a human-readable summary that includes code examples when the underlying snippets contain them. A `--json` flag exposes the raw payload. Since `0.4.0`, a `--research` flag engages a deep, agent-driven research mode that orchestrates multiple resolution and query calls [Source: [packages/cli/CHANGELOG.md:5-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

The MCP server exposes the same surface as the `researchMode` tool, so the same flag exists programmatically [Source: [packages/cli/CHANGELOG.md:5-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## Authentication and API Keys

The CLI uses OAuth 2.0 for human authentication. The flow is:

1. `ctx7 login` opens a browser window, performs the OAuth dance, and stores a refreshable token plus an API key.
2. The API key is written to the agent's MCP config so the editor can authenticate against the Context7 API.
3. `ctx7 whoami` reports the identity, teamspace, and active teamspace name; the `0.3.6` release centralized the auth constants and switched `whoami` to the internal API endpoint [Source: [packages/cli/CHANGELOG.md:72-78](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

`0.3.6` also added token refresh support so long-lived sessions do not silently break [Source: [packages/cli/CHANGELOG.md:75-78](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

For SDK-based integrations, an API key is also accepted directly. The `tools-ai-sdk` package documents that an unset key falls back to the `CONTEXT7_API_KEY` environment variable, with IP-based rate limits as the default for unauthenticated usage [Source: [packages/pi/README.md:14-22](https://github.com/upstash/context7/blob/main/packages/pi/README.md)].

## Configuration and Environment

| Variable | Purpose | Source |
| --- | --- | --- |
| `CONTEXT7_API_KEY` | Fallback API key for CLI and SDK calls | [packages/pi/README.md:18-22](https://github.com/upstash/context7/blob/main/packages/pi/README.md) |
| `CTX7_TELEMETRY_DISABLED` | Suppresses the fire-and-forget telemetry events emitted to `/api/v2/cli/events` | [packages/cli/CHANGELOG.md:102-106](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `EDITOR` | Used by `skills generate` to open the produced skill in the user's editor (no `shell: true` since `0.3.7`) | [packages/cli/CHANGELOG.md:55-58](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |

The CLI also caches an "update available" state, surfaced as a non-blocking notice before interactive commands, and provides a dedicated `ctx7 upgrade` path for npm, pnpm, and bun installations [Source: [packages/cli/CHANGELOG.md:11-17](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## SDK-Level Documentation Flow

The CLI mirrors the multi-step documentation flow that the AI SDK exposes. The `Context7Agent` class encapsulates the same workflow that an LLM using `generateText` would produce manually [Source: [packages/tools-ai-sdk/src/agents/context7.ts:1-50](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/agents/context7.ts)].

```mermaid
graph TD
    Q[User question] --> R[Step 1: resolveLibraryId]
    R --> S[Review candidates<br/>trust, benchmark, snippet count]
    S --> T[Step 2: queryDocs<br/>libraryId + question]
    T --> U[Compose answer<br/>with code examples + citations]
    U --> V[Final response]
```

The two underlying tools have explicit input schemas and descriptions:

- **`resolveLibraryId(libraryName)`** — returns a list of candidate library IDs with the metadata fields described above. The system prompt instructs the agent to prefer official sources, higher snippet counts, and higher benchmark scores [Source: [packages/tools-ai-sdk/src/prompts/system.ts:1-30](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)].
- **`queryDocs(libraryId, query, { topic?, tokens? })`** — fetches documentation snippets and code examples. The tool is built with Vercel AI SDK's `tool()` helper and can be used directly with `generateText`/`streamText` [Source: [packages/tools-ai-sdk/src/tools/query-docs.ts:1-30](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)].

`Context7Agent` wires these tools together, defaults `stopWhen` to `stepCountIs(5)`, and prefixes the system prompt with `AGENT_PROMPT` so the multi-step workflow is enforced [Source: [packages/tools-ai-sdk/src/agents/context7.ts:1-50](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/agents/context7.ts)].

The index module re-exports both tools, the agent, the prompts, and useful SDK types (`Context7Config`, `Library`, `Documentation`, `GetContextOptions`) so consumers can build their own agent scaffolds [Source: [packages/tools-ai-sdk/src/index.ts:1-15](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)].

## Telemetry and Lifecycle Hooks

Since `0.2.1`, the CLI emits telemetry events (commands, searches, installs, generation feedback) to `/api/v2/cli/events` on a fire-and-forget basis. Setting `CTX7_TELEMETRY_DISABLED=1` disables it. The `0.3.5` release added an install-count event when `ctx7 setup` provisions a new agent [Source: [packages/cli/CHANGELOG.md:80-88](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)].

## Common Failure Modes

| Symptom | Likely Cause | Mitigation |
| --- | --- | --- |
| `ctx7 setup` writes a config file the agent ignores | Wrong agent flag (e.g., `--cursor` for a Claude project) | Re-run with the correct flag or use `--all-agents` |
| `skills install` rejects a path on Windows | Backslash path normalization (fixed in `0.3.13`) | Upgrade CLI to `>= 0.3.13` [Source: [packages/cli/CHANGELOG.md:22-25](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)] |
| `skills generate` opens a vulnerable editor | `EDITOR` injection via `shell: true` (fixed in `0.3.7`) | Upgrade CLI to `>= 0.3.7` [Source: [packages/cli/CHANGELOG.md:55-58](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)] |
| Editor keeps using stale training data | Skill `find-docs` not installed or `alwaysApply: false` | Re-run `ctx7 setup` and verify the rule was written |
| Network or DNS failures inside Codex sandbox | Codex defaults to a sandboxed network | The CLI ships Codex-specific guidance to rerun outside the sandbox [Source: [packages/cli/CHANGELOG.md:26-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)] |
| High-traffic requests throttled | Unauthenticated IP-based rate limit | Generate a free key at [context7.com/dashboard](https://context7.com/dashboard) and export `CONTEXT7_API_KEY` [Source: [packages/pi/README.md:16-22](https://github.com/upstash/context7/blob/main/packages/pi/README.md)] |

## Community Context and Known Gaps

The community context surfaces several recurring requests that intersect with the CLI surface area. While none of them are fully addressed in the current source tree, they are worth documenting for wiki readers:

- **Self-hosting the documentation backend** ([issue #59](https://github.com/upstash/context7/issues/59)) — every CLI command ultimately calls the central `context7.com/api`; there is no documented `CTX7_API_BASE` override in the retrieved sources.
- **Offline / air-gapped operation** ([issue #320](https://github.com/upstash/context7/issues/320)) — the CLI's `docs` and `library` commands require network access to the hosted API; local skill bundles are usable offline but library resolution is not.
- **Private documents and per-user API keys** ([issue #34](https://github.com/upstash/context7/issues/34)) — the OAuth + teamspace model added in `0.2.0`/`0.3.6` is a step in this direction, but a dedicated "personal docs index" feature is not present in the retrieved sources.
- **Error reports** ([issue #19](https://github.com/upstash/context7/issues/19)) — the high comment count suggests intermittent setup failures; the hardening entries in `0.3.7`, `0.3.10`, `0.3.13`, and `0.4.5` reflect ongoing fixes for these reports.
- **Documentation versioning** ([issue #45](https://github.com/upstash/context7/issues/45)) — the Cursor plugin already documents version pinning via the library name, but the CLI does not yet expose a first-class `--version` flag in the retrieved sources.

## Upgrade Path and Changelog Highlights

| Version | Change | Source |
| --- | --- | --- |
| `0.4.5` | `--antigravity` support for `ctx7 setup` | [packages/cli/CHANGELOG.md:1-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.4.0` | `researchMode` MCP tool and `ctx7 docs --research` | [packages/cli/CHANGELOG.md:5-10](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.3.6` | OAuth refresh, centralized auth, `whoami` teamspace | [packages/cli/CHANGELOG.md:72-78](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.3.10` | Universal skills at `~/.agents/skills`, OpenCode → `AGENTS.md`, `find-docs` description rewrite | [packages/cli/CHANGELOG.md:38-45](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.3.7` | `shell: true` removal; directory-traversal fix | [packages/cli/CHANGELOG.md:55-61](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.3.11` | `skills install --all-agents --yes` | [packages/cli/CHANGELOG.md:18-21](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.2.3` | `skills suggest` dependency scan | [packages/cli/CHANGELOG.md:115-118](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.2.2` | `--json` skills search, OAuth auto-login in `generate` | [packages/cli/CHANGELOG.md:108-115](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |
| `0.2.0` | `skills generate` wizard + OAuth login/logout/whoami | [packages/cli/CHANGELOG.md:120-128](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md) |

## See Also

- [Context7 Main README](https://github.com/upstash/context7/blob/main/README.md) — overview, install links, and video tutorials.
- [`@upstash/context7-tools-ai-sdk` README](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md) — Vercel AI SDK integration for custom agents.
- [Cursor plugin README](https://github.com/upstash/context7/blob/main/plugins/cursor/context7/README.md) — Cursor-specific MCP and rule setup.
- [Claude Code plugin README](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md) — Claude Code plugin installation and tools.
- [pi extension README](https://github.com/upstash/context7/blob/main/packages/pi/README.md) — `pi` coding agent integration.
- Community issues referenced: [#59 Self-hosting](https://github.com/upstash/context7/issues/59), [#320 Offline](https://github.com/upstash/context7/issues/320), [#34 Private docs](https://github.com/upstash/context7/issues/34), [#19 Errors](https://github.com/upstash/context7/issues/19), [#45 Versioning](https://github.com/upstash/context7/issues/45).

---

<a id='page-4'></a>

## SDKs, Extensions, and Plugin Ecosystem

### Related Pages

Related topics: [MCP Server and Core Documentation Tools](#page-2), [ctx7 CLI, Agent Setup, and Skills System](#page-3)

<details>
<summary>Related Source Files</summary>

The following source files were used to generate this page:

- [README.md](https://github.com/upstash/context7/blob/main/README.md)
- [package.json](https://github.com/upstash/context7/blob/main/package.json)
- [packages/tools-ai-sdk/README.md](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)
- [packages/tools-ai-sdk/src/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)
- [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)
- [packages/tools-ai-sdk/src/prompts/index.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/index.ts)
- [packages/tools-ai-sdk/src/tools/query-docs.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)
- [packages/tools-ai-sdk/src/index.test.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.test.ts)
- [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)
- [packages/mcp/package.json](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)
- [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)
- [packages/cli/CHANGELOG.md](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)
- [packages/pi/README.md](https://github.com/upstash/context7/blob/main/packages/pi/README.md)
- [packages/sdk/src/commands/get-context/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/get-context/types.ts)
- [plugins/claude/context7/README.md](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)
</details>

# SDKs, Extensions, and Plugin Ecosystem

## Overview

Context7 is distributed as a monorepo containing multiple packages that together form a developer-facing documentation retrieval ecosystem. The ecosystem is designed so that the same Context7 backend (exposed at `https://context7.com/api`) can be invoked from several different surfaces: a programmatic TypeScript SDK, a Vercel AI SDK tool/agent integration, a Model Context Protocol (MCP) server, a standalone CLI, a `pi` coding-agent extension, and a Claude Code plugin.

The goal of the SDKs, extensions, and plugin ecosystem is to provide up-to-date, version-specific library documentation and code examples to any AI-assisted coding workflow, while keeping the integration surface small and consistent. Every entry point ultimately calls the same two backend capabilities: **resolving a human-readable library name into a Context7 library ID**, and **querying documentation/code snippets for that library ID** (Source: [README.md:1-120](https://github.com/upstash/context7/blob/main/README.md)).

## Ecosystem Architecture

The following diagram shows how the various packages in the ecosystem relate to one another and to the central Context7 API.

```mermaid
graph TD
    User[Developer / AI Agent]
    subgraph "Client Surfaces"
        CLI["ctx7 CLI<br/>(packages/cli)"]
        MCP["context7-mcp<br/>(packages/mcp)"]
        AISDK["@upstash/context7-tools-ai-sdk<br/>(packages/tools-ai-sdk)"]
        Pi["@upstash/context7-pi<br/>(packages/pi)"]
        Claude["Claude Code Plugin<br/>(plugins/claude/context7)"]
    end
    subgraph "Core"
        SDK["@upstash/context7-sdk<br/>(packages/sdk)"]
    end
    API["context7.com/api<br/>(resolve + docs endpoints)"]

    User --> CLI
    User --> MCP
    User --> AISDK
    User --> Pi
    User --> Claude

    CLI --> SDK
    MCP --> API
    AISDK --> SDK
    Pi --> SDK
    Claude --> MCP

    SDK --> API
```

Two important takeaways from the architecture:

1. The `@upstash/context7-sdk` package is the **canonical TypeScript client**. Most other clients either wrap it directly (AI SDK tools, Pi extension) or expose the same two-tool surface (MCP server, CLI) against the same backend.
2. The MCP server talks to the Context7 HTTP API directly, while the Vercel AI SDK tools and the Pi extension go through the SDK client. This layering keeps HTTP details in one place and lets higher-level packages focus on agent ergonomics (Source: [packages/tools-ai-sdk/src/index.ts:1-20](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)).

## Package Inventory

| Package | Type | Primary Consumer | Authentication |
| --- | --- | --- | --- |
| `@upstash/context7-sdk` | Core TypeScript SDK | Application developers, other packages | `CONTEXT7_API_KEY` or constructor `apiKey` |
| `@upstash/context7-tools-ai-sdk` | Vercel AI SDK tools + agent | Vercel AI SDK applications | `CONTEXT7_API_KEY` or per-tool `apiKey` |
| `context7-mcp` | MCP server (Model Context Protocol) | MCP-compatible clients (Claude Desktop, Cursor, etc.) | Optional `CONTEXT7_API_KEY` for higher rate limits |
| `ctx7` | Standalone CLI (npx) | Developers, agent setups | Optional API key; OAuth flow for some commands |
| `@upstash/context7-pi` | Extension for the `pi` coding agent | `pi` users | `CONTEXT7_API_KEY` env var, IP-based fallback |
| Claude Code plugin (`context7-plugin`) | Marketplace plugin | Claude Code | Optional `CONTEXT7_API_KEY` |

The root monorepo is a workspace using npm/pnpm-style packages, with shared TypeScript and ESLint configuration across the SDK and CLI (Source: [package.json:1-30](https://github.com/upstash/context7/blob/main/package.json), Source: [packages/sdk/eslint.config.js:1-30](https://github.com/upstash/context7/blob/main/packages/sdk/eslint.config.js)).

## Core SDK: `@upstash/context7-sdk`

The SDK is the lowest-level programmatic entry point. It exposes a `Context7` class and a small set of command modules. The two commands that the rest of the ecosystem is built on are:

- **Search library** — converts a library name into a list of matching Context7 library IDs.
- **Get context** — fetches documentation snippets and code examples for a given library ID and query.

The `get-context` command returns a strongly-typed payload composed of `codeSnippets` and `infoSnippets`, with each snippet carrying token counts, page identifiers, and structured code/language metadata (Source: [packages/sdk/src/commands/get-context/types.ts:1-15](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/get-context/types.ts)).

The SDK is consumed transitively by the AI SDK tools package, which re-exports the relevant types alongside its own tool/agent exports (Source: [packages/tools-ai-sdk/src/index.ts:15-20](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)).

## Vercel AI SDK Tools: `@upstash/context7-tools-ai-sdk`

This package provides Vercel AI SDK v5+ compatible tools and a pre-configured agent. According to the package README, its purpose is to:

- Add documentation lookup tools to AI SDK workflows using `generateText` or `streamText`.
- Provide a `Context7Agent` for higher-level agent loops.
- Enable RAG pipelines that retrieve accurate, version-specific code examples (Source: [packages/tools-ai-sdk/README.md:1-15](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)).

### Public Exports

The package's main entry point re-exports:

- **Agent** — `Context7Agent` and its `Context7AgentConfig` type from `@agents`.
- **Tools** — `resolveLibraryId`, `queryDocs`, and `Context7ToolsConfig` from `@tools`.
- **Prompts** — `SYSTEM_PROMPT`, `AGENT_PROMPT`, `RESOLVE_LIBRARY_ID_DESCRIPTION`, `QUERY_DOCS_DESCRIPTION` from `@prompts`.
- **Re-exported SDK types** — `Context7Config`, `Library`, `Documentation`, `GetContextOptions` (Source: [packages/tools-ai-sdk/src/index.ts:1-20](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.ts)).

### The Two Tools

The two AI SDK tools mirror the MCP tool naming and contract:

| Tool name | Purpose | Key input(s) |
| --- | --- | --- |
| `resolveLibraryId` | Convert a human-readable library name into a Context7 library ID | `libraryName` (required), `query` (required for relevance ranking) |
| `queryDocs` | Fetch up-to-date documentation and code examples for a library | `libraryId` (required, `/org/project` format), `query` (required) |

Both tools can be invoked with or without configuration. If no `apiKey` is passed, the tool falls back to the `CONTEXT7_API_KEY` environment variable (Source: [packages/tools-ai-sdk/src/tools/query-docs.ts:1-30](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)).

### Prompt System

The prompt module defines three layers of guidance that control how an LLM should use these tools:

- `SYSTEM_PROMPT` — A minimal, role-level description ("documentation search assistant powered by Context7"). Useful when the model only needs a high-level orientation (Source: [packages/tools-ai-sdk/src/prompts/system.ts:1-15](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)).
- `AGENT_PROMPT` — A four-step explicit workflow: call `resolveLibraryId` first, rank results, call `queryDocs` with the chosen ID, then answer citing the library ID. It encodes selection heuristics such as preferring official sources, name similarity, source reputation (High/Medium), code snippet count, and benchmark score (Source: [packages/tools-ai-sdk/src/prompts/system.ts:15-80](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)).
- `QUERY_DOCS_DESCRIPTION` — The tool-level description that is included verbatim in the tool's schema, instructing the model not to call the tool more than 3 times per question (Source: [packages/tools-ai-sdk/src/prompts/system.ts:80-100](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)).

These prompts are also surfaced as named exports from the prompts barrel for consumers who want to compose their own agents (Source: [packages/tools-ai-sdk/src/prompts/index.ts:1-10](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/index.ts)).

### Tool Wiring with `generateText`

A typical integration uses `generateText` from the Vercel AI SDK, wires in both tools, and uses `stepCountIs(5)` (or similar) to bound the agent loop (Source: [packages/tools-ai-sdk/README.md:25-55](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/README.md)):

```typescript
import { resolveLibraryId, queryDocs } from "@upstash/context7-tools-ai-sdk";
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";

const { text } = await generateText({
  model: openai("gpt-4o"),
  prompt: "How do I use React Server Components?",
  tools: {
    resolveLibraryId: resolveLibraryId(),
    getLibraryDocs: queryDocs(),
  },
  stopWhen: stepCountIs(5),
});
```

The integration tests in the package exercise both tools end-to-end against a real LLM (Bedrock Claude 3 Haiku in the test suite) and assert that the LLM calls the expected tool and receives a stringified payload containing "Context7-compatible library ID" (Source: [packages/tools-ai-sdk/src/index.test.ts:25-60](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/index.test.ts)).

## MCP Server: `context7-mcp`

The Model Context Protocol server is published as `context7-mcp` and is the recommended integration path for MCP-aware clients (Claude Desktop, Cursor, Windsurf, and others). The MCP server is implemented using `@modelcontextprotocol/sdk` and the runtime dependencies are listed in its `package.json` (Source: [packages/mcp/package.json:1-40](https://github.com/upstash/context7/blob/main/packages/mcp/package.json)).

### Server Identity and Instructions

When the MCP server starts, it registers server metadata (name, version, website, icon) and a detailed `instructions` string. The instructions tell the host exactly when to call the tools — including which kinds of questions warrant a Context7 lookup (libraries, frameworks, SDKs, APIs, CLIs, cloud services) and which do not (refactoring, scripts from scratch, business-logic debugging, code review, general programming concepts) (Source: [packages/mcp/src/index.ts:1-30](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)).

### MCP Tools

The server registers two tools with titles and descriptions that mirror the AI SDK tools:

- `resolve-library-id` — title "Resolve Context7 Library ID". Required inputs are `libraryName` and `query` (the latter is used to rank results by relevance).
- `query-docs` — fetches documentation for the resolved ID (Source: [packages/mcp/src/index.ts:30-50](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts)).

This naming parity is intentional: it allows the same agent prompt content (e.g. the rule installed by `ctx7 setup`) to work across the MCP server, the CLI, and direct AI SDK tool calls (Source: [packages/cli/src/setup/templates.ts:1-80](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)).

## CLI: `ctx7`

The CLI is the on-ramp most developers encounter first. It is distributed as a `bin` entry (used by `npx ctx7@latest …`) and ships rule/skill templates that the `ctx7 setup` command installs into a project's coding-agent configuration (Source: [packages/cli/CHANGELOG.md:1-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)).

### Core Commands

| Command | Purpose |
| --- | --- |
| `ctx7 library <name> <query>` | Search the Context7 index by name and return matching libraries with IDs. |
| `ctx7 docs <libraryId> <query>` | Fetch documentation for a library using its Context7 ID. |
| `ctx7 setup` | Install Context7 rules, skills, and MCP config into the current project. |
| `ctx7 skills suggest` | Scan project dependencies and recommend relevant skills. |
| `ctx7 skills generate` | AI-powered generation of a new skill. |
| `ctx7 skills install` | Install a discovered skill. |
| `ctx7 skills search` | Browse available skills with install counts and trust scores. |

(Sources: [README.md:60-90](https://github.com/upstash/context7/blob/main/README.md), [packages/cli/CHANGELOG.md:1-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md).)

### Setup Templates and Agent Targeting

The `setup` command uses bundled templates that target multiple agent environments. The latest release (ctx7 0.4.5) added explicit support for Antigravity: the command now installs skills to `.agent/skills`, adds a `GEMINI.md` rule section, and writes MCP config to Antigravity 2.0's documented global path `~/.gemini/config/mcp_config.json` (using `httpUrl` for HTTP, matching the Gemini convention) (Source: community release notes for `ctx7@0.4.5`).

The templates also include generic fallback rules that teach an agent when to reach for the Context7 tools (or CLI) and when not to. The fallback rules explicitly direct the model to prefer Context7 over web search for library docs and to call `resolve-library-id` first, then `query-docs` with the user's full question (Source: [packages/cli/src/setup/templates.ts:1-80](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)).

### Recent CLI Improvements

The 0.2.x CLI changelog also describes:

- An `installs` and `trust` column in skill search results, aligned column headers, and a "View skill" action that opens the skill in `$EDITOR` (Source: [packages/cli/CHANGELOG.md:15-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)).
- Telemetry for usage metrics, opt-out via `CTX7_TELEMETRY_DISABLED` (Source: [packages/cli/CHANGELOG.md:25-40](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)).
- OAuth-based auto-login when the generate command requires authentication (Source: [packages/cli/CHANGELOG.md:15-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)).

## Pi Coding Agent Extension: `@upstash/context7-pi`

The Pi extension is installed with `pi install npm:@upstash/context7-pi` and contributes two LLM-callable tools, a skill, and a slash command. The two tools are `resolve-library-id` and `query-docs`, sharing names and contracts with the MCP and AI SDK tools (Source: [packages/pi/README.md:1-30](https://github.com/upstash/context7/blob/main/packages/pi/README.md)).

A `/c7-docs <library> <question>` slash command is provided for manual lookup, running the resolve + query flow in a single invocation. Authentication uses the `CONTEXT7_API_KEY` env var for higher quotas, with an IP-based rate limit fallback when no key is set (Source: [packages/pi/README.md:20-50](https://github.com/upstash/context7/blob/main/packages/pi/README.md)).

## Claude Code Plugin: `context7-plugin`

The Claude Code plugin is distributed as a marketplace plugin and bundles the MCP server with Claude-specific extras:

- **MCP server** — connects Claude Code to Context7's documentation service.
- **Skills** — auto-trigger documentation lookups when the user asks about a library.
- **Agents** — a dedicated `docs-researcher` agent for focused lookups.
- **Commands** — `/context7:docs` for manual queries.

Installation is performed via the marketplace commands `claude plugin marketplace add upstash/context7` and `claude plugin install context7-plugin@context7-marketplace` (Source: [plugins/claude/context7/README.md:1-30](https://github.com/upstash/context7/blob/main/plugins/claude/context7/README.md)).

## Authentication and Configuration Patterns

The ecosystem consistently uses a single environment variable — `CONTEXT7_API_KEY` — to authenticate against the central Context7 API. The pattern is:

- **SDK and AI SDK tools** — pass `apiKey` to the constructor/tool factory, or set `CONTEXT7_API_KEY` and let the client fall back to it (Source: [packages/tools-ai-sdk/src/tools/query-docs.ts:15-30](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/tools/query-docs.ts)).
- **MCP server** — configured in the host's MCP config; `CONTEXT7_API_KEY` is optional, but the rate limit is higher when provided.
- **CLI** — relies on the same env var for higher limits; some flows (e.g. `ctx7 skills generate`) trigger an OAuth login instead of failing with an error (Source: [packages/cli/CHANGELOG.md:15-30](https://github.com/upstash/context7/blob/main/packages/cli/CHANGELOG.md)).
- **Pi extension** — same `CONTEXT7_API_KEY` env var, with IP-based fallback (Source: [packages/pi/README.md:20-40](https://github.com/upstash/context7/blob/main/packages/pi/README.md)).

The shared tool surface and naming (`resolve-library-id` / `resolveLibraryId`, `query-docs` / `queryDocs`) means that the same agent rule — and the same prompt — can be reused across all surfaces without modification (Source: [packages/cli/src/setup/templates.ts:1-60](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts)).

## Data Model: `get-context` Response

The `get-context` SDK command returns a typed payload that is reused by every consumer in the ecosystem. Its structure is:

| Field | Type | Description |
| --- | --- | --- |
| `codeSnippets` | `ApiCodeSnippet[]` | Extracted code examples with title, description, language, and a per-language `codeList`. |
| `infoSnippets` | `ApiInfoSnippet[]` | Prose documentation snippets with breadcrumb and `pageId` for citation. |

Each `ApiCodeSnippet` carries a `codeId` (used to dedupe and reference) and optional `codeTokens` for budgeting; each `ApiInfoSnippet` carries a `pageId` and optional `contentTokens` (Source: [packages/sdk/src/commands/get-context/types.ts:1-15](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/get-context/types.ts)). This single typed contract is what the AI SDK, MCP server, CLI, and Pi extension ultimately surface to the LLM as tool output.

## Typical Resolution → Query Flow

Every consumer implements the same logical flow. The MCP server's tool description spells it out for the host LLM:

```mermaid
graph TD
    A[User asks about a library] --> B{User provided<br/>/org/project or<br/>/org/project/version?}
    B -- Yes --> D[query-docs with libraryId and full question]
    B -- No --> C[resolve-library-id with libraryName and full question]
    C --> E[Rank results by<br/>name match, reputation,<br/>snippets, benchmark]
    E --> F[Pick best Context7 library ID]
    F --> D
    D --> G[Compose answer,<br/>cite library ID and snippets]
```

This is enforced at the prompt level for the AI SDK: the `AGENT_PROMPT` mandates the same four-step procedure and bounds `queryDocs` to a maximum of 3 calls per question (Source: [packages/tools-ai-sdk/src/prompts/system.ts:15-80](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts)). The CLI's fallback rule template, the MCP server's instructions, and the Pi extension's bundled skill all encode the same flow with the same selection criteria (Source: [packages/cli/src/setup/templates.ts:1-80](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts), Source: [packages/mcp/src/index.ts:1-50](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts), Source: [packages/pi/README.md:30-50](https://github.com/upstash/context7/blob/main/packages/pi/README.md)).

## Community Context and Known Limitations

Several of the most-engaged community issues describe limitations that the SDKs, extensions, and plugin ecosystem inherits from its current single-backend architecture:

- **Self-hosting the documentation backend** (issue #59) — there is currently no supported way to point any of the SDKs, MCP server, CLI, or Pi extension at a self-hosted documentation API; everything routes through `context7.com/api`. The `httpUrl` configuration introduced in the Antigravity setup is still pointed at the hosted service.
- **Offline / air-gapped environments** (issue #320) — the MCP server and CLI both require internet access to resolve libraries and fetch docs. The SDK and AI SDK tools have no built-in cache or local index that would let them function fully offline.
- **Private documents** (issue #34) — there is no per-user account, document index, or per-user API key flow that would let the SDKs scope queries to private documents. The `CONTEXT7_API_KEY` model is currently shared/global, not per-user.
- **Documentation versioning** (issue #45) — version pinning is supported by including the version in the library ID (`/org/project/version`) and in natural-language prompts, but the SDK does not expose a typed version-pinning option, and the AI SDK tool schemas do not require an explicit version field.

These are worth keeping in mind when designing integrations: any ecosystem consumer built today inherits the same hosted-only, online-only, public-only constraints.

## See Also

- [README.md](https://github.com/upstash/context7/blob/main/README.md) — High-level overview and quickstart.
- [packages/sdk/src/commands/get-context/types.ts](https://github.com/upstash/context7/blob/main/packages/sdk/src/commands/get-context/types.ts) — Canonical response types.
- [packages/tools-ai-sdk/src/prompts/system.ts](https://github.com/upstash/context7/blob/main/packages/tools-ai-sdk/src/prompts/system.ts) — Agent and tool prompt strings.
- [packages/cli/src/setup/templates.ts](https://github.com/upstash/context7/blob/main/packages/cli/src/setup/templates.ts) — Agent rules and skill templates installed by `ctx7 setup`.
- [packages/mcp/src/index.ts](https://github.com/upstash/context7/blob/main/packages/mcp/src/index.ts) — MCP server tool registrations and instructions.

---

<!-- evidence_pipeline_checked: true -->
<!-- evidence_injected: true -->

---

## Pitfall Log

Project: upstash/context7

Summary: Found 32 structured pitfall item(s), including 1 high/blocking item(s). Top priority: Security or permission risk - Security or permission risk requires verification.

## 1. Security or permission risk - Security or permission risk requires verification

- Severity: high
- Evidence strength: source_linked
- Finding: Developers should check this security_permissions risk before relying on the project: [Bug]: OAuth metadata issuer mismatch for MCP OAuth endpoint
- User impact: Developers may expose sensitive permissions or credentials: [Bug]: OAuth metadata issuer mismatch for MCP OAuth endpoint
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: [Bug]: OAuth metadata issuer mismatch for MCP OAuth endpoint. Context: Source discussion did not expose a precise runtime context.
- Guardrail: Do not recommend enabling privileged or credential-bearing paths until the source-backed risk is reviewed: https://github.com/upstash/context7/issues/2723
- Evidence: failure_mode_cluster:github_issue | fmev_95c37b5d4ec8d5ee4507509dad3c2a1f | https://github.com/upstash/context7/issues/2723

## 2. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: @upstash/context7-pi@0.1.0
- User impact: Upgrade or migration may change expected behavior: @upstash/context7-pi@0.1.0
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: @upstash/context7-pi@0.1.0. Context: Observed when using node
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_release | fmev_46f371ada1fbace84d952510823b7f4b | https://github.com/upstash/context7/releases/tag/%40upstash/context7-pi%400.1.0

## 3. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: Add tool to search by npm package name to skip the initial docs index search, makes MCP server faster
- User impact: Developers may fail before the first successful local run: Add tool to search by npm package name to skip the initial docs index search, makes MCP server faster
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: Add tool to search by npm package name to skip the initial docs index search, makes MCP server faster. Context: Observed when using node
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_97f541b9c1bdf6a270413d479cb65002 | https://github.com/upstash/context7/issues/230

## 4. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: [Feature Request] Local docs sync and numerous dx improvements
- User impact: Developers may fail before the first successful local run: [Feature Request] Local docs sync and numerous dx improvements
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: [Feature Request] Local docs sync and numerous dx improvements. Context: Observed during installation or first-run setup.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_33ab52cf164db9dced1235e8c17026f6 | https://github.com/upstash/context7/issues/103

## 5. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: ctx7 setup --cli: downloadSkillFromGitHub missing Authorization header causes 403
- User impact: Developers may fail before the first successful local run: ctx7 setup --cli: downloadSkillFromGitHub missing Authorization header causes 403
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: ctx7 setup --cli: downloadSkillFromGitHub missing Authorization header causes 403. Context: Observed when using macos
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_f983d67f6d5644dbb372458c86f98034 | https://github.com/upstash/context7/issues/2363

## 6. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: ctx7@0.4.5
- User impact: Upgrade or migration may change expected behavior: ctx7@0.4.5
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: ctx7@0.4.5. Context: Observed during installation or first-run setup.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_release | fmev_9786b7981f1e51c97bd00ed6170af655 | https://github.com/upstash/context7/releases/tag/ctx7%400.4.5

## 7. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this installation risk before relying on the project: ctx7@0.5.1
- User impact: Upgrade or migration may change expected behavior: ctx7@0.5.1
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: ctx7@0.5.1. Context: Observed when using docker
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_release | fmev_5ee21e73150b416333eaa911b8e0c948 | https://github.com/upstash/context7/releases/tag/ctx7%400.5.1

## 8. Installation risk - Installation risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a installation risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_37c5d19255fa423199c3f5f0b317c9b1 | https://github.com/upstash/context7/issues/230

## 9. Configuration risk - Configuration risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this configuration risk before relying on the project: @upstash/context7-mcp@3.1.0
- User impact: Upgrade or migration may change expected behavior: @upstash/context7-mcp@3.1.0
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: @upstash/context7-mcp@3.1.0. Context: Source discussion did not expose a precise runtime context.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_release | fmev_554228c877dad4ddb42a45c3dcf8b001 | https://github.com/upstash/context7/releases/tag/%40upstash/context7-mcp%403.1.0

## 10. Configuration risk - Configuration risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this configuration risk before relying on the project: Feature Request: Support multiple product docs in one repo
- User impact: Developers may misconfigure credentials, environment, or host setup: Feature Request: Support multiple product docs in one repo
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: Feature Request: Support multiple product docs in one repo. Context: Source discussion did not expose a precise runtime context.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_752d9c6ad1111e7576eb2b756e09be9a | https://github.com/upstash/context7/issues/328

## 11. Configuration risk - Configuration risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this configuration risk before relying on the project: [Bug]: ctx7 setup on a remote server fails login
- User impact: Developers may misconfigure credentials, environment, or host setup: [Bug]: ctx7 setup on a remote server fails login
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: [Bug]: ctx7 setup on a remote server fails login. Context: Observed when using node
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_8bd9c73c4b097b45bbb9bf50dec280be | https://github.com/upstash/context7/issues/2693

## 12. Configuration risk - Configuration risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this configuration risk before relying on the project: ctx7@0.5.0
- User impact: Upgrade or migration may change expected behavior: ctx7@0.5.0
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: ctx7@0.5.0. Context: Observed when using docker, linux
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_release | fmev_3704dcb3c12460ca1521e1f999dbba13 | https://github.com/upstash/context7/releases/tag/ctx7%400.5.0

## 13. Configuration risk - Configuration risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a configuration risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_cd9ab6da5e00494a9a33cf8d052f6d7a | https://github.com/upstash/context7/issues/1985

## 14. Capability evidence risk - Capability evidence risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a capability evidence risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_494a211c781b4e46bd85dfd878df3b67 | https://github.com/upstash/context7/issues/2404

## 15. Capability evidence risk - Capability evidence risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a capability evidence risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_dab36bccef7b4502a4745abf500ebff4 | https://github.com/upstash/context7/issues/2402

## 16. Capability evidence risk - Capability evidence risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: README/documentation is current enough for a first validation pass.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: capability.assumptions | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

## 17. Maintenance risk - Maintenance risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this migration risk before relying on the project: Library Report: /powershell/powershell - Missing or incorrect documentation.
- User impact: Developers may hit a documented source-backed failure mode: Library Report: /powershell/powershell - Missing or incorrect documentation.
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: Library Report: /powershell/powershell - Missing or incorrect documentation.. Context: Source discussion did not expose a precise runtime context.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_759d8757fcc775ebd5f7d6875422b1d5 | https://github.com/upstash/context7/issues/2726

## 18. Maintenance risk - Maintenance risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Developers should check this migration risk before relying on the project: Library Report: /websites/help_obsidian_md - Missing or incorrect documentation.
- User impact: Developers may hit a documented source-backed failure mode: Library Report: /websites/help_obsidian_md - Missing or incorrect documentation.
- Suggested check: Before packaging this project, run the relevant install/config/quickstart check for: Library Report: /websites/help_obsidian_md - Missing or incorrect documentation.. Context: Source discussion did not expose a precise runtime context.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_56d642ac71adc3db99b0e8219c5627dd | https://github.com/upstash/context7/issues/2402

## 19. Maintenance risk - Maintenance risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a maintenance risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: evidence.maintainer_signals | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

## 20. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: no_demo
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: downstream_validation.risk_items | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

## 21. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: no_demo
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: risks.scoring_risks | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

## 22. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_6de89e27738047e3ad152cc882c33ad5 | https://github.com/upstash/context7/issues/2726

## 23. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_bb840f4b2bcc4021a2526d3871340a11 | https://github.com/upstash/context7/issues/2722

## 24. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_207c6f65d2774bedb18a4e4f90ee5fb7 | https://github.com/upstash/context7/issues/2723

## 25. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_38b83de6a9e04a10bebd94d4701fd482 | https://github.com/upstash/context7/issues/2693

## 26. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_b2aa60378ae44af3b2c8d52a110979a3 | https://github.com/upstash/context7/issues/103

## 27. Security or permission risk - Security or permission risk requires verification

- Severity: medium
- Evidence strength: source_linked
- Finding: Project evidence flags a security or permission risk. Review the linked source before relying on this workflow.
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: community_evidence:github | cevd_1b962697d290411b87ecb6d82ea39cd9 | https://github.com/upstash/context7/issues/2363

## 28. Capability evidence risk - Capability evidence risk requires verification

- Severity: low
- Evidence strength: source_linked
- Finding: Developers should check this conceptual risk before relying on the project: Library Report: /websites/antigravity_google_home - Missing or incorrect documentation.
- User impact: Developers may hit a documented source-backed failure mode: Library Report: /websites/antigravity_google_home - Missing or incorrect documentation.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_c1062ab49b374733cfc7061d8f78fee3 | https://github.com/upstash/context7/issues/2404

## 29. Capability evidence risk - Capability evidence risk requires verification

- Severity: low
- Evidence strength: source_linked
- Finding: Developers should check this conceptual risk before relying on the project: Library Report: /websites/openwrt - Missing or incorrect documentation.
- User impact: Developers may hit a documented source-backed failure mode: Library Report: /websites/openwrt - Missing or incorrect documentation.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_3f88adbf07c59ef83b3d01a58bd1d4ab | https://github.com/upstash/context7/issues/1985

## 30. Capability evidence risk - Capability evidence risk requires verification

- Severity: low
- Evidence strength: source_linked
- Finding: Developers should check this conceptual risk before relying on the project: [Feature]: Multiple sources under a single repo
- User impact: Developers may hit a documented source-backed failure mode: [Feature]: Multiple sources under a single repo
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Guardrail: State this as source-backed community evidence, not as Doramagic reproduction.
- Evidence: failure_mode_cluster:github_issue | fmev_03102ea5cdc3f3e223d11b3e190a442a | https://github.com/upstash/context7/issues/2725

## 31. Maintenance risk - Maintenance risk requires verification

- Severity: low
- Evidence strength: source_linked
- Finding: issue_or_pr_quality=unknown。
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: evidence.maintainer_signals | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

## 32. Maintenance risk - Maintenance risk requires verification

- Severity: low
- Evidence strength: source_linked
- Finding: release_recency=unknown。
- User impact: May increase setup, validation, or first-run risk for the user.
- Suggested check: Reproduce the official install and quickstart path in an isolated environment.
- Evidence: evidence.maintainer_signals | npm_package:@upstash/context7-mcp | https://www.npmjs.com/package/@upstash/context7-mcp

<!-- canonical_name: upstash/context7; human_manual_source: deepwiki_human_wiki -->
