Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

context7-cli — Claude Code skill: fresh library docs and Context7 MCP

This skill teaches your agent to pull current library documentation through the ctx7 CLI and wire up Context7 MCP for the editor.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add upstash/context7 --skill context7-cli -a claude-code
Open on GitHub

What context7-cli does

The skill covers the ctx7 CLI. It handles two jobs: fetching up-to-date documentation for a library and setting up Context7 MCP in your editor. Reach for it while writing code, when you need to verify an API signature and the model's training data may be stale.

The flow is two steps. ctx7 library <name> <query> resolves the library ID, then ctx7 docs <libraryId> <query> returns the docs. Library IDs need a leading slash — /facebook/react, not facebook/react. Skip the first step and the docs call fails, so ctx7 library always comes first.

Setup runs through ctx7 setup, which is interactive. It needs a login: ctx7 login opens a browser for OAuth, and ctx7 login --no-browser prints the URL instead. To skip interactive login entirely, export CONTEXT7_API_KEY. Most commands work without signing in, though logging in raises the rate limits on docs requests. Keep the CLI current before running anything: npm install -g ctx7@latest, or call it straight through npx ctx7@latest <command>.

What it helps with

  • pull current library docs when model training data is outdated
  • verify an API signature before writing code
  • resolve a library ID for follow-up doc requests
  • set up Context7 MCP in Claude, Cursor or OpenCode
  • raise docs rate limits by logging in

Example prompts for the agent

  • look up the react docs with ctx7 and show me the current hooks
  • set up Context7 MCP for this project
  • check the function signature in the latest version of this library

How to install context7-cli

1Skills CLI (Vercel)

npx skills add upstash/context7 --skill context7-cli -a claude-code

2Manually: put the files in place

~/.claude/skills/context7-cli/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/context7-cli/

From the same set3

The whole set →

Similar

opencli-autofix jackwener Repairs broken OpenCLI adapters when websites alter their DOM or APIs. The agent inspects trace logs, explores live pages, and applies targeted patches. Claude Code CX Codex Cursor +1 17,600installs book-to-skill virgiliojr94 Turns books and documents into structured agent skills with frameworks, principles, and techniques. Useful when an agent should apply an author's methods while working. Claude Code CX Codex Cursor +1 8,400installs security-best-practices github.com/openai/skills A skill that reviews code against security best practices for Python, JavaScript/TypeScript and Go, then suggests fixes. Claude Code CX Codex Cursor +1 357installs opencli-adapter-author jackwener Build and improve OpenCLI JavaScript adapters from observed site behavior, browser evidence, and existing adapters when a site command needs to be added or fixed. Claude Code CX Codex Cursor +1 16,100installs fireworks-tech-graph yizhiyanhua-ai Builds precise technical SVG diagrams, exports them to PNG or standalone HTML, and animates semantic SVGs into GIFs. Suitable for system architecture, UML, and cloud workflows. Claude Code CX Codex Cursor +1 18,000installs composio ComposioHQ This skill routes Composio tasks for a personal agent or a product with user-connected accounts, from setup and integration to tool runs and troubleshooting. Claude Code CX Codex Cursor +1 8,000installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs

Questions about context7-cli

How do I install context7-cli in Claude?

Run npx skills add upstash/context7 --skill context7-cli -a claude-code. The skill file then sits at ~/.claude/skills/context7-cli/SKILL.md.

What does context7-cli do?

It gives your agent two things: the ctx7 CLI commands for fetching current library documentation, and a way to configure Context7 MCP for the editor.

Do I need to log in for ctx7 to work?

Most commands work without signing in. The exception is ctx7 setup, which requires a login unless you pass --api-key or --oauth. Logging in also raises the rate limits on docs commands.

Source text

SKILL.md · MIT
---
name: context7-cli
description: Use the ctx7 CLI to fetch library documentation and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, or needs to set up Context7 for their AI coding agent.
---

# ctx7 CLI

The Context7 CLI does two things: fetches up-to-date library documentation and sets up Context7 MCP for your editor.

Make sure the CLI is up to date before running commands:

```bash
npm install -g ctx7@latest
```

Or run directly without installing:

```bash
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.
- **[Setup](references/setup.md)** — Configure Context7 MCP for Claude Code / Cursor / OpenCode.

## Quick Reference

```bash
# Documentation
ctx7 library <name> <query>           # Step 1: resolve library ID
ctx7 docs <libraryId> <query>         # Step 2: fetch docs

# Setup
ctx7 setup                            # Configure Context7 MCP (interactive)
ctx7 login                            # Log in for higher rate limits
ctx7 whoami                           # Check current login status
```

## Authentication

```bash
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. Exception: `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:

```bash
export CONTEXT7_API_KEY=your_key
```

## Common Mistakes

- Library IDs require a `/` prefix — `/facebook/react` not `facebook/react`
- Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID

© upstash · MIT · upstash/context7

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor