Skip to main content

Context7

Live library documentation fetching service by Upstash. Pulls version-specific docs and code examples into AI agent context on demand, eliminating hallucinated or outdated API calls.

Two Delivery Modes

Both modes access the same upstream doc index; prefer MCP when the agent harness supports it natively, ctx7 CLI as fallback.

Per-Platform Usage

Cross-platform setup: Claude Code → Cross-Platform Migration Matrix (MCP layer section).

MCP Tools Reference

Two tools, always invoked in sequence: In Claude Code these surface as mcp__context7__resolve-library-id and mcp__context7__query-docs. Usage pattern:

CLI Commands Reference

--json returns structured output suitable for piping into scripts.

REST API Reference

For scripting or non-MCP/CLI integrations. Auth: Authorization: Bearer <CONTEXT7_API_KEY> on both endpoints.

When to Use / When to Skip

Use before: implementing any library API, framework feature, CLI tool invocation, or external API call where flag/method names could have changed. Skip for: pure reasoning tasks, git operations, file manipulation with no external library dependency, standard Unix tools (ls, grep, cat). Similar tool (wiki search, not doc fetch): qmd. Wrapped as one of three surfaces (alongside web/code search) in ketch’s ketch docs command — same resolve → fetch flow, unified under a single agent-facing CLI.

Linked pages