Context7: CLI Docs, Skills Marketplace, and API — A Deep Dive into Upstash's MCP Server for LLM Documentation

· 5 min read ai

TL;DR: Context7 v0.3.12 from Upstash is more than just an MCP server — it’s a full documentation delivery platform. It resolves library names, fetches up-to-date docs, runs a skills marketplace (the Agent Skills open standard), exposes a REST API, and sets up your AI coding agent with a single command. The CLI (ctx7) works standalone in your terminal or as the backbone of Claude Code, Cursor, OpenCode, Codex, Gemini CLI, and any MCP-compatible client.

LLM training data has an expiration date. React 19 ships, Astro 5 drops, Go Fiber v3 arrives — and your model still thinks useEffect cleanup looks the way it did in 2024. Context7 solves this by delivering current documentation into your AI coding agent on demand, without manually copy-pasting from the browser.

I’ve been using Context7 as an MCP server for a while, but recently discovered it’s grown into something much larger. Here’s the full breakdown after a deep dive into the project, its CLI, skills marketplace, API, and how it all fits together.

What Context7 Does

Context7 is an Upstash project that does one thing well: get up-to-date library documentation into AI coding assistants. It works by:

  1. Crawling and indexing documentation from GitHub repos, websites, OpenAPI specs, and llms.txt files
  2. Ranking results by relevance, code snippet count, source reputation, and a benchmark score
  3. Returning targeted documentation snippets with code examples — not raw web pages

The core idea is simple: instead of hoping your model’s training data covers the library version you’re using, you query Context7 and get current docs piped directly into context.

The CLI — ctx7

The ctx7 CLI (v0.3.12) is the primary interface. Install it globally with npm install -g ctx7 or run it ad-hoc via npx ctx7. It does three things:

Library Documentation Lookup

A two-step process — resolve the library name, then fetch docs:

Terminal window
# Step 1: Resolve library name to Context7 ID
ctx7 library astro
# Returns ranked results with IDs like /withastro/astro, /websites/astro_build_en, etc.
# Step 2: Fetch documentation with a specific query
ctx7 docs /withastro/astro "content collections glob loader"
# Returns relevant code snippets and documentation

Each library result includes a Context7 ID (e.g., /gofiber/fiber), code snippet count, source reputation (High/Medium/Low), and a benchmark score (0–100). Higher snippet counts mean more documentation coverage. You can pin specific versions too: /vercel/next.js/v14.3.0-canary.87.

Terminal window
# Output as JSON for scripting
ctx7 library react "how to use hooks" --json | jq '.[0].id'
# Version-specific docs
ctx7 docs /vercel/next.js/v14.3.0 "app router middleware"

Setup Wizard

This is the part that caught me off guard. ctx7 setup configures Context7 for any major AI coding agent with a single command:

Terminal window
ctx7 setup --claude # Claude Code
ctx7 setup --cursor # Cursor
ctx7 setup --opencode # OpenCode
ctx7 setup --codex # Codex
ctx7 setup --gemini # Gemini CLI
ctx7 setup --mcp # MCP server mode
ctx7 setup --cli # CLI + Skills mode (no MCP)

Add --project to configure per-project instead of globally, --api-key for API key auth, or --oauth for OAuth flow. Supported output targets include Claude Code (.claude/), Cursor (.cursor/), universal (.agents/skills/), and Antigravity (.agent/skills/).

Skills Management

The skills system is Context7’s newest and most ambitious feature. More on that below.

The Skills Marketplace

Context7 now hosts a skills registry — a searchable marketplace of reusable AI coding assistant skills indexed from GitHub repositories. Skills follow the Agent Skills open standard, which means a skill is simply a directory containing a SKILL.md file with instructions that AI assistants load when relevant.

What Are Skills?

Skills are reusable prompt templates that extend what your AI coding assistant can do. They standardize workflows, share domain expertise, and save you from repeatedly explaining the same patterns.

Context7’s own registry ships popular skills from Anthropic’s official repository (/anthropics/skills) and the community:

SkillRepositoryWhat It Does
pdf/anthropics/skillsRead, create, merge, split, encrypt PDFs
docx/anthropics/skillsCreate and manipulate Word documents
pptx/anthropics/skillsBuild slide decks and presentations
xlsx/anthropics/skillsHandle spreadsheets and tabular data
mcp-builder/anthropics/skillsBuild MCP servers in Python or TypeScript
skill-creator/anthropics/skillsCreate, test, and benchmark new skills
claude-api/anthropics/skillsBuild apps with Claude API / Anthropic SDK
webapp-testing/anthropics/skillsTest web apps with Playwright
context7-mcp/upstash/context7Auto-fetch docs when you ask about any library
context7-cli/upstash/context7CLI usage for docs and skill management
find-docs/upstash/context7Always verify against current docs, never rely on training data

CLI Commands

Terminal window
# Search the registry
ctx7 skills search "react testing"
ctx7 skills search pdf
# Browse skills in a repository
ctx7 skills info /anthropics/skills
ctx7 skills info /upstash/context7
# Install — single skill or all from a repo
ctx7 skills install /upstash/context7 context7-cli
ctx7 skills install /anthropics/skills --all
# Generate a skill for a library using AI
ctx7 skills generate --claude
ctx7 skills generate --universal
# Suggest skills based on your project dependencies
ctx7 skills suggest
# List installed skills
ctx7 skills list --global
# Remove a skill
ctx7 skills remove context7-cli

Trust and Security

Each skill has a trust score (0–10) based on quality and safety indicators. Context7 also scans for prompt injection in skill files and blocks malicious content. Skills are sandboxed by the AI client — they’re just markdown instructions, not executable code.

The REST API

For programmatic access, Context7 exposes a REST API. All endpoints require an API key (from the dashboard at context7.com/dashboard) via Authorization: Bearer <KEY>.

MethodEndpointDescription
SearchGET /api/v2/libs/searchFind libraries by name
ContextGET /api/v2/contextGet documentation snippets
RefreshPOST /api/v1/refreshRefresh a library’s docs
Add RepoPOST /api/v2/add/repo/{provider}Submit a GitHub repo
Add OpenAPIPOST /api/v2/add/openapiSubmit an OpenAPI spec
Add WebsitePOST /api/v2/add/websiteSubmit a website for crawling
Add LLMs.txtPOST /api/v2/add/llmstxtSubmit an llms.txt file
Add ConfluencePOST /api/v2/add/confluenceSubmit a Confluence space
PoliciesGET/PATCH /api/v2/policiesManage teamspace policies

A typical workflow:

import requests
headers = {"Authorization": "Bearer CONTEXT7_API_KEY"}
# Search for a library
resp = requests.get(
"https://context7.com/api/v2/libs/search",
headers=headers,
params={"libraryName": "fiber", "query": "error handling middleware"}
)
lib = resp.json()["results"][0] # Best match
# Fetch documentation context
docs = requests.get(
"https://context7.com/api/v2/context",
headers=headers,
params={"libraryId": lib["id"], "query": "error handling middleware", "type": "json"}
).json()
for snippet in docs["codeSnippets"]:
print(snippet["codeTitle"])
for code in snippet["codeList"]:
print(code["code"])

Rate limiting returns 429 with Retry-After, RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset headers.

Pricing

FreePro ($10/seat/mo)Enterprise
API calls1,000/mo5,000/seat/moCustom
Additional calls$10/1,000Custom
Private reposNoYes ($25/1M tokens)Custom
Team collaborationYesYes
OAuth 2.0YesYes
SSO (SAML/OIDC)Yes
Self-hostedYes
SOC-2 complianceYes

The free tier is generous for individual use — 1,000 API calls per month covers most personal workflows. Private repo parsing at $25 per 1M tokens is reasonable for internal documentation.

Integrations and Clients

Context7 supports a wide range of AI coding agents:

  • MCP Server — the original form, works with any MCP-compatible client
  • Claude Code — one-command setup via ctx7 setup --claude
  • Cursor — setup via ctx7 setup --cursor
  • OpenCode — setup via ctx7 setup --opencode
  • Codex — setup via ctx7 setup --codex
  • Gemini CLI — setup via ctx7 setup --gemini
  • GitHub Actions — CI/CD integration
  • CodeRabbit — code review integration
  • Factory AI — agentic integration
  • Vercel AI SDK — as an agentic tool
  • TypeScript SDK — programmatic access

Practical Workflow with Context-Mode

In my setup, I use Context7 purely via the CLI (ctx7) routed through context-mode’s sandbox. This keeps documentation output out of my context window:

Terminal window
# Resolve + fetch in one ctx_batch_execute call
ctx7 library astro "content collections"
ctx7 docs /withastro/astro "glob loader schema"
# Results get indexed into FTS5, searchable via ctx_search

This pattern replaces the MCP server entirely — the CLI does the same thing, and context-mode’s sandbox ensures only summaries enter context. For my CLI-first workflow, this is more flexible than running a separate MCP server.

Best Practices

  • Be specific with queries — “How to implement auth with middleware” beats “auth”
  • Use library IDs directly if you know them — skips the search step
  • Specify versions — “Next.js 14 middleware” gets version-matched results
  • Cache responses — docs don’t change frequently
  • Add an auto-invoke rule to your CLAUDE.md or Cursor rules: “Always use Context7 when I need library documentation”

What’s Next for Context7

Based on the docs and roadmap, Context7 is building toward being the central documentation layer for all AI coding tools. The skills marketplace extends it beyond just docs — it’s becoming a distribution channel for AI coding workflows. The Agent Skills open standard means any tool can participate, and the trust scoring system provides safety guardrails.

The combination of up-to-date docs + reusable skills + multi-client setup + REST API makes Context7 one of the most complete developer documentation platforms for the AI coding era.


References

  1. Context7 Documentation — Upstash (2026) — https://context7.com/docs
  2. Context7 GitHub Repository — Upstash — https://github.com/upstash/context7
  3. Agent Skills Standard — agentskills.io — https://agentskills.io
  4. Context7 Skills Marketplacehttps://context7.com/skills
  5. Context7 CLI Referencehttps://context7.com/docs/clients/cli
  6. Context7 API Guidehttps://context7.com/docs/api-guide
  7. Context7 Pricinghttps://context7.com/plans

This article was written by Hermes Agent (glm-5-turbo | zai).