The Problem
You're building with Next.js 15 and ask your AI assistant to write an API route. It gives you the Pages Router pattern from Next.js 12. You paste React docs into the prompt, but they're already outdated by the time you copy them.
Context7 solved this by indexing documentation directly from source repos and serving it through an MCP server. Cursor, Claude Code, and other AI editors use it to get real, version-specific docs instead of hallucinated APIs.
But MCP has a constraint: you need an MCP-compatible client. If you're working in the terminal, running a script, or using a local LLM — you're out of luck.
The Solution
I built c7 — a CLI that pulls from the same Context7 database and outputs docs as plain text to stdout.
c7 react hooks
c7 express middleware
c7 nextjs "app router"
That's it. No server, no configuration, no IDE integration. Just text you can pipe anywhere.
How It Works
The CLI does two things:
-
Resolves a library name to a Context7 ID (e.g.,
react→/websites/react_dev) - Fetches documentation for that library, filtered by topic
Under the hood it's two API calls using Node.js built-in fetch against Context7's v2 API. The entire project is ~220 lines across two files with zero dependencies.
bin/c7.js — 136 lines (CLI parsing + output formatting)
lib/api.js — 87 lines (Context7 v2 API client)
No axios. No commander. No chalk. Just process.argv and fetch.
The Real Power: Pipes
Because c7 outputs plain text to stdout, it composes with everything:
Pipe into LLMs
# Claude
c7 react hooks | claude "summarize the key patterns and show examples"
# Ollama (local models)
c7 express middleware | ollama run codellama "explain this middleware pattern"
# Any LLM CLI
c7 nextjs "api routes" | llm "write an API route based on these docs"
Pipe into Unix tools
# Search docs
c7 nextjs "api routes" | grep "export"
# Page through docs
c7 prisma "schema" | less
# Copy to clipboard
c7 react "useEffect" | pbcopy
# Build context files
c7 nextjs "app router" >> context.txt
c7 react "server components" >> context.txt
Use in scripts
# Pre-load context for a coding agent
DOCS=$(c7 nextjs "app router middleware")
claude "Build a Next.js middleware that handles auth. Use these docs:\n$DOCS"
c7 vs MCP Server
| MCP Server | c7 CLI | |
|---|---|---|
| Setup | Install server, configure MCP client, restart editor | npx @vedanth/context7 |
| Works in | MCP-compatible editors | Terminal, scripts, CI, anywhere |
| Composable | Limited to MCP protocol | Pipes, redirects, subshells |
| Dependencies | Several npm packages | Zero |
| Lines of code | ~1000+ | ~220 |
They're complementary. Use the MCP server in your editor, use c7 everywhere else.
Getting Started
# Run without installing
npx @vedanth/context7 react hooks
# Or install globally
npm install -g @vedanth/context7
c7 react hooks
c7 express middleware
c7 nextjs "app router" | claude "summarize"
No API key required for basic usage. For higher rate limits, get a free key at context7.com/dashboard.
Links
- GitHub: github.com/VedanthB/context7-cli
- npm: @vedanth/context7
- Landing page: c7.akarispeed.xyz
- Context7: context7.com
Built by Vedanth Bora. If this saves you from one hallucinated API, it was worth building.
Top comments (0)