context7-cli
upstash/context7
CLI for fetching library docs, managing AI coding skills, and configuring Context7 MCP.
What is context7-cli?
The ctx7 CLI provides three core functions: fetch up-to-date documentation for any library, manage AI coding skills (install, search, generate), and configure Context7 MCP for your editor. Use it when you need current API docs, want to install or create coding skills, or are setting up Context7 for Claude Code, Cursor, or OpenCode.
- Fetch current library documentation for any package to verify APIs and signatures
- Install, search, and manage AI coding skills from the registry
- Generate custom AI coding skills with AI assistance (requires login)
- Configure Context7 MCP integration for Claude Code, Cursor, or OpenCode
- Suggest skills based on your project dependencies
- List and remove installed skills
How to install context7-cli
npx skills add https://github.com/upstash/context7 --skill context7-cli- Node.js and npm installed
- Run `npm install -g ctx7@latest` or use `npx ctx7@latest` directly
How to use context7-cli
- 1.Run `ctx7 library <name>` to resolve a library ID (e.g., `ctx7 library react`)
- 2.Use `ctx7 docs <libraryId> <query>` to fetch documentation (e.g., `ctx7 docs /facebook/react hooks`)
- 3.For skills, run `ctx7 skills search <keywords>` to find available skills
- 4.Install a skill with `ctx7 skills install /owner/repo` or `ctx7 skills install /owner/repo skillname`
- 5.Run `ctx7 setup` to configure Context7 MCP for your editor (interactive)
- 6.Log in with `ctx7 login` for higher rate limits and skill generation access
Use cases
- Look up current API documentation while writing code when training data may be outdated
- Install pre-built AI coding skills to extend your agent's capabilities
- Generate a custom skill tailored to your project's specific needs
- Set up Context7 MCP to enable skill management in your editor
- Search the skill registry to find tools matching your workflow
- AI coding agent users (Claude Code, Cursor, OpenCode)
- Developers needing up-to-date library documentation
- Teams building custom AI coding skills
- Anyone setting up Context7 for their development environment
context7-cli FAQ
Most commands work without login. Only `skills generate` requires it. Login also unlocks higher rate limits on docs commands. Set `CONTEXT7_API_KEY` environment variable to skip interactive login.
Library IDs require a `/` prefix, e.g., `/facebook/react` not `facebook/react`. Always run `ctx7 library` first to resolve the correct ID.
Use `ctx7 skills install /owner/repo` for interactive selection, or `ctx7 skills install /owner/repo skillname` to install a specific skill directly.
Yes, run `ctx7 skills generate` to create a custom skill with AI assistance. This requires login via `ctx7 login`.
Run `ctx7 setup` for an interactive configuration. You can pass `--api-key` or `--oauth` flags to skip login, or log in first with `ctx7 login`.
Full instructions (SKILL.md)
Source of truth, from upstash/context7.
name: context7-cli description: Use the ctx7 CLI to fetch library documentation, manage AI coding skills, and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, wants to install/search/generate skills, or needs to set up Context7 for their AI coding agent.
ctx7 CLI
The Context7 CLI does three things: fetches up-to-date library documentation, manages AI coding skills, and sets up Context7 MCP for your editor.
Make sure the CLI is up to date before running commands:
npm install -g ctx7@latest
Or run directly without installing:
npx ctx7@latest <command>
What this skill covers
- Documentation — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated.
- Skills management — Install, search, suggest, list, remove, and generate AI coding skills.
- Setup — Configure Context7 MCP for Claude Code / Cursor / OpenCode.
Quick Reference
# Documentation
ctx7 library <name> <query> # Step 1: resolve library ID
ctx7 docs <libraryId> <query> # Step 2: fetch docs
# Skills
ctx7 skills install /owner/repo # Install from a repo (interactive)
ctx7 skills install /owner/repo name # Install a specific skill
ctx7 skills search <keywords> # Search the registry
ctx7 skills suggest # Auto-suggest based on project deps
ctx7 skills list # List installed skills
ctx7 skills remove <name> # Uninstall a skill
ctx7 skills generate # Generate a custom skill with AI (requires login)
# Setup
ctx7 setup # Configure Context7 MCP (interactive)
ctx7 login # Log in for higher rate limits + skill generation
ctx7 whoami # Check current login status
Authentication
ctx7 login # Opens browser for OAuth
ctx7 login --no-browser # Prints URL instead of opening browser
ctx7 logout # Clear stored tokens
ctx7 whoami # Show current login status (name + email)
Most commands work without login. Exceptions: skills generate always requires it; ctx7 setup requires it unless --api-key or --oauth is passed. Login also unlocks higher rate limits on docs commands.
Set an API key via environment variable to skip interactive login entirely:
export CONTEXT7_API_KEY=your_key
Common Mistakes
- Library IDs require a
/prefix —/facebook/reactnotfacebook/react - Always run
ctx7 libraryfirst —ctx7 docs react "hooks"will fail without a valid ID - Repository format for skills is
/owner/repo— e.g.,ctx7 skills install /anthropics/skills skills generaterequires login — runctx7 loginfirst
Related skills
More from upstash/context7 and the wider catalog.

find-docs
Retrieve current documentation, API references, and code examples for any developer technology.

context7-mcp
Fetch current library and framework documentation to answer setup, API, and code generation questions.

documentation-lookup
Fetch current documentation for libraries and frameworks instead of relying on training data.