← Back to CLIs
Melvynx

context7-cli

Manage Context7 via CLI - search libraries, get documentation context. Use when user mentions 'context7', 'library docs', 'documentation context', or wants to fetch up-to-date library documentation.

Install

$ npx api2cli install Melvynx/context7-cli

Details

Skill type: Wrapper CLI
Auth type: bearer
Version: 0.1.0
Author: Melvynx
Views: 28

README

context7-cli

CLI for the Context7 API - search libraries and retrieve up-to-date documentation context. Made with api2cli.dev.

Install

npx api2cli install Melvynx/context7-cli

This clones the repo, builds the CLI, links it to your PATH, and installs the AgentSkill to your coding agents.

Install AgentSkill only

npx skills add Melvynx/context7-cli

Auth

context7-cli auth set <token>     # Save your API token
context7-cli auth show            # Display current token (masked)
context7-cli auth show --raw      # Display full unmasked token
context7-cli auth test            # Verify your token works
context7-cli auth remove          # Delete the saved token

Resources

libs

Search for libraries in the Context7 database.

# Search by name
context7-cli libs --name react

# Search with a relevance query
context7-cli libs --name react --query "hooks"

# JSON output
context7-cli libs --name nextjs --query "app router" --json

# Select specific columns
context7-cli libs --name react --fields "name,id"
FlagDescription
--name <name>Library name to search for (e.g. react, nextjs)
--query <query>Your question or task (used for relevance ranking)
--fields <cols>Comma-separated columns to display

context get

Get documentation snippets for a library based on a query.

# Get docs as JSON
context7-cli context get --library /facebook/react --query "useEffect" --json

# Get docs as raw text
context7-cli context get --library /vercel/next.js --query "app router" --type txt --raw

# Pin to a specific version
context7-cli context get --library /vercel/next.js/v15.1.8 --query "middleware" --json

# Select specific columns
context7-cli context get --library /facebook/react --query "hooks" --fields "title,content"
FlagDescription
--library <id>Library ID from search (e.g. /facebook/react)
--query <query>Your question or task
--type <type>Response format: json or txt (default: json)
--rawOutput raw text (when --type txt)
--fields <cols>Comma-separated columns to display

Global Flags

All commands support: --json, --format <text|json|csv|yaml>, --verbose, --no-color, --no-header

Sponsors
context7-cli - api2cli | api2cli