context7-cli

Fetch up-to-date library documentation and configure Context7 MCP for your AI coding agent.

64.1k|3.2k|Updated Mar 26, 2025
Ready to run
npx skills add https://github.com/upstash/context7 --skill context7-cli-upstash
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: context7-cli
Source: https://github.com/upstash/context7/tree/main/skills/context7-cli
Command: npx skills add https://github.com/upstash/context7 --skill context7-cli-upstash

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ctx7, and includes references (resource) components.

What problem does it solve? Developers struggle with outdated training data when writing code, leading to incorrect API usage, deprecated patterns, and wasted debugging time. This Skill provides access to current library documentation on demand and sets up Context7 MCP integration for seamless AI assistance. ## Core Features & Use Cases - Documentation Fetching: Search and retrieve up-to-date docs for any programming library using semantic queries. - Library Resolution: Automatically resolve package names to Context7-compatible library IDs and select the best match. - MCP Setup: Configure Context7 MCP server for Claude Code, Cursor, or OpenCode with one command. - Use Case: When writing a React component with async effects, run ctx7 docs /facebook/react "How to clean up useEffect with async operations" to get current patterns without relying on potentially outdated training data. ## Quick Start Install the CLI with npm install -g ctx7@latest, then run ctx7 search "your question about any library" to fetch current documentation.

Frequently Asked Questions about context7-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch documentation for a specific library using ctx7?▼

First run `ctx7 library <name> <query>` to resolve the library ID, then use `ctx7 docs <libraryId> <query>` with your specific question. Alternatively, use `ctx7 search <query>` to search all libraries at once without needing a library ID.

What is the difference between ctx7 library and ctx7 docs?▼

`ctx7 library` resolves a package name to a Context7-compatible ID and returns matching libraries ranked by relevance. `ctx7 docs` queries the actual documentation and code examples for a resolved library ID. Both require a semantic query to rank results properly.

Can I use ctx7 without logging in?▼

Yes, most commands work without authentication. However, `ctx7 setup` requires OAuth login or an API key unless `--api-key` or `--oauth` is passed. Login also unlocks higher rate limits on documentation queries.

How do I set up Context7 MCP for Claude or Cursor?▼

Run `ctx7 setup --mcp --claude` for Claude Code or `ctx7 setup --mcp --cursor` for Cursor. The command configures the MCP server entry in your agent config and installs a Context7 skill to guide documentation access.

Why does ctx7 docs fail with a library name instead of an ID?▼

The `ctx7 docs` command requires a Context7-compatible library ID in the format `/org/project`, not a package name. Always resolve the name first with `ctx7 library` to obtain the correct ID.

What happens if ctx7 search returns multiple matching libraries?▼

Context7 ranks results by relevance to your query based on name similarity, description match, documentation coverage, and source reputation. Proceed with the top result, or refine your query to disambiguate if the match is unclear.