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 🙏

© 2025 – Pkg Stats / Ryan Hefner

context7-cli

v1.0.0

Published

CLI tool to connect and interact with Context7 MCP server for up-to-date code documentation

Readme

Context7 CLI

npm context7-cli package

A command-line interface for connecting to and interacting with Context7 MCP server. Get up-to-date, version-specific code documentation and examples directly from your terminal.

Features

  • 📡 Persistent connection to Context7 MCP server
  • 💻 Interactive REPL for documentation queries
  • 🚀 Headless mode for one-off command execution
  • 📚 Resolve library IDs and fetch current documentation
  • 🔧 Command-specific help and documentation
  • 🎯 Topic-focused documentation retrieval

Requirements

Installation

npm install -g context7-cli

Quick Start

Interactive Mode

Start the CLI and interact with Context7 through a REPL:

npx context7-cli

Once started, you'll see the context7> prompt:

Context7 CLI

Usage:

commands         list all the available commands
<command> -h     quick help on <command>
<command> <arg>  run <command> with argument
clear            clear the screen
exit, quit, q    exit the CLI

context7> commands
# Lists all 2 available commands

context7> resolve-library-id {"libraryName":"mongodb"}
# Resolves "mongodb" to a Context7-compatible library ID

context7> get-library-docs {"context7CompatibleLibraryID":"/mongodb/docs","topic":"aggregation"}
# Gets MongoDB documentation focused on aggregation

context7> exit

Headless Mode

Execute single commands without starting the interactive REPL:

# General format
npx context7-cli <command> '<json_arguments>'

# Examples
npx context7-cli resolve-library-id '{"libraryName":"mongodb"}'
npx context7-cli get-library-docs '{"context7CompatibleLibraryID":"/mongodb/docs"}'
npx context7-cli get-library-docs '{"context7CompatibleLibraryID":"/vercel/next.js","topic":"routing","page":2}'

Command Line Options

# Show version
npx context7-cli --version
npx context7-cli -v

# List all commands
npx context7-cli --commands

# Get help for specific command
npx context7-cli resolve-library-id -h
npx context7-cli get-library-docs -h

# General help
npx context7-cli --help
npx context7-cli -h

Available Tools

The CLI exposes 2 documentation tools from the Context7 MCP server:

resolve-library-id

Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.

Parameters:

  • libraryName (required): string - The package/product name to resolve (e.g., "mongodb", "next.js", "react")

Example:

context7> resolve-library-id {"libraryName":"mongodb"}

get-library-docs

Fetches up-to-date documentation for a specific library, with optional topic focus and pagination.

Parameters:

  • context7CompatibleLibraryID (required): string - Exact Context7-compatible library ID (e.g., "/mongodb/docs", "/vercel/next.js")
  • topic (optional): string - Focus topic for the docs (e.g., "routing", "hooks", "authentication")
  • page (optional): number - Page number for pagination (1-10). If the context is not sufficient, try page=2, page=3, etc. with the same topic.

Examples:

context7> get-library-docs {"context7CompatibleLibraryID":"/mongodb/docs"}
context7> get-library-docs {"context7CompatibleLibraryID":"/vercel/next.js","topic":"routing"}
context7> get-library-docs {"context7CompatibleLibraryID":"/vercel/next.js","topic":"routing","page":2}

Use Cases

Get Started with a New Library

# 1. Resolve the library ID
context7> resolve-library-id {"libraryName":"mongodb"}

# 2. Get general documentation
context7> get-library-docs {"context7CompatibleLibraryID":"/mongodb/docs"}

# 3. Get topic-specific documentation
context7> get-library-docs {"context7CompatibleLibraryID":"/mongodb/docs","topic":"aggregation"}

Quick Documentation Lookup

# Get Next.js routing documentation
npx context7-cli get-library-docs '{"context7CompatibleLibraryID":"/vercel/next.js","topic":"routing"}'

# Get React hooks documentation
npx context7-cli get-library-docs '{"context7CompatibleLibraryID":"/facebook/react","topic":"hooks"}'

About Context7

Context7 is an MCP server that delivers up-to-date, version-specific code documentation and examples directly into LLM prompts and AI code editors. It solves the problem of outdated training data by pulling current documentation straight from the source.

Learn more at context7.com or github.com/upstash/context7.

License

Apache-2.0