ctx7 CLI is the command-line interface for Context7. It does three things:
- Fetch library documentation — resolve any library by name and query its up-to-date docs directly in your terminal, without opening a browser
- Manage AI coding skills — install, search, generate, and remove skills from the Context7 registry
- Configure Context7 MCP — set up the MCP server for Claude Code, Cursor, or OpenCode with a single command
Installation
Requires Node.js 18 or later.- npx (no install)
- Global install
Run ctx7 directly without installing anything. Useful for one-off commands or trying it out.
Query Library Documentation
Fetching docs is a two-step process: first resolve the library name to get its Context7 ID, then use that ID to query documentation.Step 1 — ctx7 library
Searches the Context7 index by name and returns matching libraries. Pass aquery describing what you’re trying to do — this ranks results by relevance and helps when a library name is ambiguous or shared across multiple packages.
| Field | Description |
|---|---|
| Library ID | The identifier to pass to ctx7 docs (format: /org/project) |
| Code Snippets | Number of indexed code examples — higher means more documentation coverage |
| Source Reputation | Authority indicator: High, Medium, Low, or Unknown |
| Benchmark Score | Quality score from 0 to 100 |
| Versions | Version-specific IDs when available (format: /org/project/version) |
Step 2 — ctx7 docs
Takes a library ID and a natural-language question, and returns relevant code snippets and explanations from the indexed documentation.Library IDs always start with
/. Running ctx7 docs react "hooks" will fail — always use the full ID returned by ctx7 library in Step 1."How to set up authentication with JWT in Express.js" returns much better results than "auth".
The output contains two types of content: code snippets (titled, with language-tagged blocks) and info snippets (prose explanations with breadcrumb context). Both are formatted for readability in the terminal.
Setup
Configure Context7 for your AI coding agent. On first run, prompts you to choose between two modes:- MCP server — registers the Context7 MCP server in your agent’s config so it can call
resolve-library-idandget-library-docstools natively - CLI + Skills — installs a
docsskill that guides your agent to fetch up-to-date library docs usingctx7CLI commands (no MCP required)
ctx7 setup
--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 — use it when an IDE handles the auth flow on your behalf.
What gets written — MCP mode:
| File | Purpose |
|---|---|
.mcp.json / .cursor/mcp.json / .opencode.json | MCP server entry |
| Agent rules directory | Rule file — instructs the agent to use Context7 for library docs |
| Agent skills directory | context7-mcp skill |
| File | Purpose |
|---|---|
| Agent skills directory | docs skill — guides the agent to use ctx7 library and ctx7 docs commands |
Authentication
Most commands work without authentication. Log in to unlock skill generation and higher rate limits on documentation commands.Commands
API Key
Set an API key via environment variable to skip interactive login entirely — useful for CI or scripting:When is authentication required?
| Feature | Required |
|---|---|
ctx7 library / ctx7 docs | No — login gives higher rate limits |
ctx7 skills install / search / suggest / list / remove | No |
ctx7 skills generate | Yes |
ctx7 setup | Yes — unless --api-key is passed (--oauth also skips login for MCP mode) |
Skills
Manage AI coding skills from the Context7 registry. See Skills for a full explanation of what skills are, the registry, trust scores, and skill file structure.ctx7 skills install
Install skills from any GitHub repository. Repository format is/owner/repo.
When installing to multiple clients, the skill files are created in your primary client’s directory and symlinked to the others.
ctx7 si /anthropics/skills pdf
ctx7 skills search
Find skills across all indexed repositories by keyword. Shows an interactive list — select to install directly.ctx7 ss pdf
ctx7 skills suggest
Auto-detects your project dependencies and recommends relevant skills from the registry.package.json, requirements.txt, pyproject.toml, Cargo.toml, go.mod, Gemfile.
Alias: ctx7 ssg
ctx7 skills generate
Generate a custom skill tailored to your stack using AI. Requires login.- Describe the expertise you want (e.g., “OAuth authentication with NextAuth.js”)
- Select relevant libraries from search results
- Answer 3 clarifying questions to focus the skill
- Review the generated skill and request changes if needed
- Choose where to install it
ctx7 skills gen, ctx7 skills g
ctx7 skills list
View skills installed in your project or globally.ctx7 skills info
Preview all available skills in a repository without installing.ctx7 skills remove
Uninstall a skill by name.ctx7 skills rm, ctx7 skills delete
Shortcuts
| Shortcut | Full command |
|---|---|
ctx7 si | ctx7 skills install |
ctx7 ss | ctx7 skills search |
ctx7 ssg | ctx7 skills suggest |
ctx7 skills i | ctx7 skills install |
ctx7 skills s | ctx7 skills search |
ctx7 skills ls | ctx7 skills list |
ctx7 skills rm | ctx7 skills remove |
ctx7 skills gen | ctx7 skills generate |
ctx7 skills g | ctx7 skills generate |
Telemetry
The CLI collects anonymous usage data to help improve the product. To disable:Next Steps
Browse Skills
Explore the skills registry
Skills Guide
Learn about skill file structure, trust scores, and the registry
Claude Code
Set up Context7 in Claude Code
All Clients
Installation for every supported editor