
Context7 Cli
- 23 installs
- 60.2k repo stars
- Updated August 2, 2026
- upstash/context7-mcp
This is a copy of context7-cli by upstash - installs and ranking accrue to the original listing.
Helps with ai & agent building tasks during AI-assisted development.
About
context7-cli is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- context7-cli
- AI & Agent Building
- AI-coding skill
Context7 Cli by the numbers
- 23 all-time installs (skills.sh)
- +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/upstash/context7-mcp --skill context7-cliAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 23 |
|---|---|
| repo stars | ★ 60.2k |
| Last updated | August 2, 2026 |
| Repository | upstash/context7-mcp ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
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@latestOr run directly without installing:
npx ctx7@latest <command>What this skill covers
- [Documentation](references/docs.md) — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated.
- [Skills management](references/skills.md) — Install, search, suggest, list, remove, and generate AI coding skills.
- [Setup](references/setup.md) — 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 statusAuthentication
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_keyCommon 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
Documentation Commands
Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework. Two-step workflow: resolve the library name to get its ID, then query docs using that ID.
If the user already provided a library ID in /org/project or /org/project/version format, pass it directly to ctx7 docs.
Step 1: Resolve a Library
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.
ctx7 library react "How to clean up useEffect with async operations"
ctx7 library nextjs "How to set up app router with middleware"
ctx7 library prisma "How to define one-to-many relations with cascade delete"Always pass a query argument — it is required and directly affects result ranking. Use the user's intent to form the query, which helps disambiguate when multiple libraries share a similar name. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
Result fields
Each result includes:
- Library ID — Context7-compatible identifier (format:
/org/project) - Name — Library or package name
- Description — Short summary
- Code Snippets — Number of available code examples
- Source Reputation — Authority indicator (High, Medium, Low, or Unknown)
- Benchmark Score — Quality indicator (100 is the highest score)
- Versions — List of versions if available. Use one of those versions if the user provides a version in their query. The format is
/org/project/version.
Selection process
1. Analyze the query to understand what library/package the user is looking for 2. Select the most relevant match based on:
- Name similarity to the query (exact matches prioritized)
- Description relevance to the query's intent
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
- Source reputation (consider libraries with High or Medium reputation more authoritative)
- Benchmark score (higher is better, 100 is the maximum)
3. If multiple good matches exist, acknowledge this but proceed with the most relevant one 4. If no good matches exist, clearly state this and suggest query refinements 5. For ambiguous queries, request clarification before proceeding with a best-guess match
IMPORTANT: Do not call ctx7 library more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.
Version-specific IDs
If the user mentions a specific version, use a version-specific library ID:
# General (latest indexed)
ctx7 docs /vercel/next.js "How to set up app router"
# Version-specific
ctx7 docs /vercel/next.js/v14.3.0-canary.87 "How to set up app router"The available versions are listed in the ctx7 library output. Use the closest match to what the user specified.
# Output as JSON for scripting
ctx7 library react "How to use hooks for state management" --json | jq '.[0].id'Step 2: Query Documentation
Retrieves up-to-date documentation and code examples for the resolved library.
You must call ctx7 library first to obtain the exact Context7-compatible library ID required to use this command, UNLESS the user explicitly provides a library ID in the format /org/project or /org/project/version.
ctx7 docs /facebook/react "How to clean up useEffect with async operations"
ctx7 docs /vercel/next.js "How to add authentication middleware to app router"
ctx7 docs /prisma/prisma "How to define one-to-many relations with cascade delete"IMPORTANT: Do not call ctx7 docs more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have.
Writing good queries
The query directly affects the quality of results. Be specific and include relevant details. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
| Quality | Example |
|---|---|
| Good | "How to set up authentication with JWT in Express.js" |
| Good | "React useEffect cleanup function with async operations" |
| Bad | "auth" |
| Bad | "hooks" |
Use the user's full question as the query when possible — vague one-word queries return generic results.
The output contains two types of content: code snippets (titled, with language-tagged blocks) and info snippets (prose explanations with breadcrumb context).
# Output as structured JSON
ctx7 docs /facebook/react "How to use hooks for state management" --json
# Pipe to other tools — output is clean when not in a TTY (no spinners or colors)
ctx7 docs /facebook/react "How to use hooks for state management" | head -50
ctx7 docs /vercel/next.js "How to add middleware for route protection" | grep -A5 "middleware"Authentication
Works without authentication. For higher rate limits:
# Option A: environment variable
export CONTEXT7_API_KEY=your_key
# Option B: OAuth login
ctx7 loginSetup
ctx7 setup
One-time command to configure Context7 for your AI coding agent. Prompts for mode on first run:
- MCP server — registers the Context7 MCP server so the agent can call tools natively
- CLI + Skills — installs a
find-docsskill that guides the agent to usectx7CLI commands (no MCP required)
ctx7 setup # Interactive — prompts for mode, then agent/install target
ctx7 setup --mcp # Skip prompt, use MCP server mode
ctx7 setup --cli # Skip prompt, use CLI + Skills mode
# MCP mode — target a specific agent
ctx7 setup --claude # Claude Code only
ctx7 setup --cursor # Cursor only
ctx7 setup --opencode # OpenCode only
# CLI + Skills mode — target a specific install location
ctx7 setup --cli --claude # Claude Code (~/.claude/skills)
ctx7 setup --cli --cursor # Cursor (~/.cursor/skills)
ctx7 setup --cli --universal # Universal (~/.agents/skills)
ctx7 setup --cli --antigravity # Antigravity (~/.config/agent/skills)
ctx7 setup --project # Configure current project instead of globally
ctx7 setup --yes # Skip confirmation promptsAuthentication options:
ctx7 setup --api-key YOUR_KEY # Use an existing API key (both MCP and CLI + Skills mode)
ctx7 setup --oauth # OAuth endpoint — MCP mode only (IDE handles the auth flow)Without --api-key or --oauth, setup opens a browser for OAuth login. MCP mode additionally generates a new API key after login. --oauth is MCP-only.
What gets written — MCP mode:
- MCP server entry in the agent's config file (
.mcp.jsonfor Claude,.cursor/mcp.jsonfor Cursor,.opencode.jsonfor OpenCode) - A Context7 rule file instructing the agent to use Context7 for library docs
- A
context7-mcpskill in the agent's skills directory
What gets written — CLI + Skills mode:
- A
find-docsskill in the chosen agent's skills directory, guiding the agent to usectx7 libraryandctx7 docscommands
Skills Commands
Manage AI coding skills from the Context7 registry. Skills are Markdown files that teach AI coding agents best practices, patterns, and workflows for specific libraries or tasks.
Install
Install skills from any GitHub repository. Repository format is always /owner/repo.
ctx7 skills install /anthropics/skills # Interactive — pick from a list
ctx7 skills install /anthropics/skills pdf # Install a specific skill by name
ctx7 skills install /anthropics/skills --all # Install everything without promptingTarget a specific IDE with a flag:
ctx7 skills install /anthropics/skills pdf --claude # Claude Code only
ctx7 skills install /anthropics/skills pdf --cursor # Cursor only
ctx7 skills install /anthropics/skills pdf --universal # Universal (.agents/skills/)
ctx7 skills install /anthropics/skills --all --global # All skills, global installAlias: ctx7 si /anthropics/skills pdf
Search
Find skills across the entire registry by keyword. Shows an interactive list with install counts and trust scores. Select to install.
ctx7 skills search pdf
ctx7 skills search typescript testing
ctx7 skills search react nextjsAlias: ctx7 ss pdf
Suggest
Auto-detects your project dependencies and recommends relevant skills from the registry.
ctx7 skills suggest # Scan current project, install to project
ctx7 skills suggest --global # Install suggestions globally
ctx7 skills suggest --claude # Target Claude Code onlyReads package.json, requirements.txt, pyproject.toml, Cargo.toml, go.mod, Gemfile. Falls back to suggesting ctx7 skills search if no dependencies are detected.
Alias: ctx7 ssg
Generate (AI-powered)
Generate a custom skill tailored to your stack using AI. Requires login.
ctx7 skills generate
ctx7 skills generate --claude # Install directly to Claude Code
ctx7 skills generate --global # Install to global skillsInteractive flow: 1. Describe the expertise you want (e.g., "OAuth authentication with NextAuth.js") 2. Select relevant libraries from search results 3. Answer 3 clarifying questions to focus the skill 4. Review the generated skill, request changes if needed 5. Choose where to install it
Limits: Free accounts get 6 generations/week, Pro accounts get 10.
Aliases: ctx7 skills gen, ctx7 skills g
List
Show all installed skills for the current project or globally.
ctx7 skills list # Current project (all detected IDEs)
ctx7 skills list --claude # Claude Code only
ctx7 skills list --global # Global skills
ctx7 skills list --global --claude # Global Claude Code skillsRemove
Uninstall a skill by name.
ctx7 skills remove pdf
ctx7 skills remove pdf --claude # From Claude Code only
ctx7 skills remove pdf --global # From global skillsAliases: ctx7 skills rm, ctx7 skills delete
Info
Browse all skills in a repository without installing — useful for previewing what's available.
ctx7 skills info /anthropics/skillsOutput shows each skill name, description, and URL, plus quick install commands.
IDE Flags
All skills commands accept these flags to target a specific AI coding assistant:
| Flag | Directory | Used by |
|---|---|---|
--universal | .agents/skills/ | Amp, Codex, Gemini CLI, OpenCode, GitHub Copilot |
--claude | .claude/skills/ | Claude Code |
--cursor | .cursor/skills/ | Cursor |
--antigravity | .agent/skills/ | Antigravity |
Without a flag, the CLI prompts you to select one or more targets interactively.
Add --global to any flag to install in your home directory instead of the current project.