npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@grayhaven/context7cli

v0.1.3

Published

Context7 CLI for AI agents - fetch up-to-date library documentation

Readme

context7cli

CLI for AI agents to fetch up-to-date library documentation from Context7.

Two commands. No intermediate steps. Token-budgeted responses.

Install

npm

npm install -g @grayhaven/context7cli

Homebrew (macOS)

brew install tylergibbs1/context7cli/context7cli

curl (macOS / Linux / WSL)

curl -fsSL https://raw.githubusercontent.com/tylergibbs1/context7cli/main/install.sh | bash

Pin a version:

VERSION=v0.1.0 curl -fsSL https://raw.githubusercontent.com/tylergibbs1/context7cli/main/install.sh | bash

PowerShell (Windows)

irm https://raw.githubusercontent.com/tylergibbs1/context7cli/main/install.ps1 | iex

Pin a version:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/tylergibbs1/context7cli/main/install.ps1))) -Version v0.1.0

From source

git clone https://github.com/tylergibbs1/context7cli.git
cd context7cli
bun install
bun run build

The built CLI is at dist/index.js. Link it globally with npm link.

Commands

search — browse available libraries

context7 search <library>
context7 search react
# {"ok":true,"data":[{"id":"/websites/react_dev","name":"React","description":"..."},…]}

With full metadata:

context7 search react --detail full
# {"ok":true,"data":[{"id":"/websites/react_dev","name":"React","description":"...","totalSnippets":2922,"trustScore":10,"benchmarkScore":95.1,"versions":[]},…]}

docs — fetch documentation

Accepts a library name (auto-resolves) or ID (direct lookup).

context7 docs <name-or-id> [--topic T] [--tokens N] [--detail concise|full]
# By name (auto-resolves to best match)
context7 docs nextjs --topic routing

# By ID (skips resolution)
context7 docs /vercel/next.js --topic routing

# Limit token budget
context7 docs nextjs --tokens 2000

# Full metadata (type, tokens, language per snippet)
context7 docs nextjs --topic hooks --detail full

Concise response (default):

{
  "ok": true,
  "library": "Next.js",
  "libraryId": "/vercel/next.js",
  "data": [
    { "title": "App Router > Routing", "content": "..." }
  ]
}

Full response (--detail full):

{
  "ok": true,
  "library": { "id": "/vercel/next.js", "name": "Next.js", "snippets": 2922, "trustScore": 10 },
  "data": [
    { "title": "App Router > Routing", "content": "...", "type": "code", "tokens": 450, "language": "typescript" }
  ]
}

Truncation — when results exceed the token budget, a steering message is appended:

{
  "truncated": "Result truncated at 2000 tokens. 3 more snippets available. Use --tokens 4000 or --topic to narrow results."
}

Flags

| Flag | Description | Default | |------|-------------|---------| | --api-key <key> | Context7 API key (or set CONTEXT7_API_KEY env var) | — | | --topic <topic> | Focus docs on a specific topic | "documentation" | | --tokens <number> | Token budget for docs response | 10000 | | --detail <concise\|full> | Response detail level | concise | | --help | Show help | — |

Authentication

Optional. Set CONTEXT7_API_KEY for higher rate limits:

export CONTEXT7_API_KEY=your-key-here

Get a free key at context7.com/dashboard.

Development

bun run dev              # run from source
bun run typecheck        # type check
bun run build            # bundle to dist/
bun test                 # run tests

License

MIT