# Repository Briefing: upstash/context7
> Source: https://repoforai.com/repo/upstash/context7 (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/upstash/context7
- **Official Docs / Website**: https://context7.com
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: A+ (96/100 · Maintenance 35/35 · Adoption 21/25 · Releases 20/20 · License 20/20)
- **Latest Release**: @upstash/context7-mcp@4.9.3 (2026-12-03) — https://github.com/upstash/context7/releases
- **Review Snapshot**: 2026-12-02 (Note: @upstash/context7-mcp@4.9.3 on 2026-12-03 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: MCP, CLI, API
- **Momentum**: 65,830 ★ total (+39 24h / +333 7d) · 3,303 forks
- **Topics**: `llm`, `mcp`, `mcp-server`, `vibe-coding`
- **When to Use**: Best for: Teams using coding agents that frequently need version-specific library examples and can rely on a hosted documentation index. Skip if: Your workflow must run offline, keep task queries inside your network, or use only a pinned and auditable documentation corpus.

## Overview
```text
### Architecture & Core Mechanics
Context7 is a TypeScript monorepo that exposes a hosted documentation index to coding agents. The MCP request path separates library discovery from retrieval: `resolve-library-id` uses the library name and the task to rank candidates; `query-docs` takes the selected ID and task and returns relevant documentation and examples. A known ID lets the agent skip discovery. Running the MCP server locally changes where the adapter runs, not where indexing and retrieval are backed.

The repository uses a pnpm workspace and defines separate build scripts for the SDK, MCP server, and AI SDK tools. The root manifest lists `@inquirer/core` and `@inquirer/type`; that list does not describe every package’s runtime dependencies. The integration surface includes a CLI with agent skills, an MCP server, a TypeScript SDK, Vercel AI SDK tools, and a pi.dev extension. The API backend, parser, and crawler are outside the public source tree.

### Key Capabilities & Differentiators
The main capability is task-specific retrieval of library documentation and code examples. An agent can name a library version in the prompt or supply an exact ID such as `/supabase/supabase` to avoid selecting a similarly named library. The optional `language` field in `query-docs` prioritizes examples in the requested language; it is a ranking hint, not a strict filter or a guarantee that an example exists.

The CLI exposes the same two-step lookup through `ctx7 library` and `ctx7 docs`, useful for agents that can run commands but do not support MCP. Teams building their own agent can integrate through the TypeScript SDK, Vercel AI SDK tools, or REST API. Version lookup depends on index coverage; for version-sensitive changes, check that the excerpts match the installed dependency before applying them.

### Trade-offs & Limitations
Compared with opening upstream docs directly, Context7 gives agents one interface for finding task-relevant excerpts across libraries. The trade is less control over corpus coverage and refresh timing than with a team-managed index or a pinned documentation snapshot. Coverage and content quality can vary across community-contributed entries, and retrieved text should be treated as reference material, not as instructions or a substitute for checking release notes, source, and tests.

Both remote and local MCP setups still depend on the hosted API, its availability, and its rate limits. The task query helps rank results, so keep secrets, unnecessary source code, and customer data out of it. MIT covers the published repository code; it does not provide the private backend or settle the terms for hosted access or redistribution of third-party documentation.

### Hardware & Deployment Guide
For agent workstations, `npx ctx7 setup` requires Node.js 22.13 or newer, authenticates through OAuth, generates an API key, and offers CLI + Skills or MCP setup. The `--cursor`, `--claude`, and `--opencode` flags target specific agents. For manual remote MCP setup, use `https://mcp.context7.com/mcp` and send the key in `Authorization: Bearer YOUR_API_KEY`. An API key is recommended for higher rate limits. This integration does not run model inference locally; load depends on request volume and client-side context handling, not model VRAM.

Local deployment is an MCP adapter option, not an offline deployment of the full service. The v4.9.2 release includes an MCP Bundle and adds task-based waiting while a library’s source is being indexed: code tools can return an MCP task to clients declaring `io.modelcontextprotocol/tasks`, and the API retains the task. Test that path with the client you intend to deploy; clients that do not declare the extension should not be assumed to support the same wait flow.
```

## Key Capabilities
```text
- Tool contract: `resolve-library-id` matches a name in the context of the task; `query-docs` retrieves by exact library ID.
- Retrieval controls: Name the target version in the prompt, bypass matching with a known ID, or use the optional `language` argument to prioritize code examples.
- Integration modes: CLI + Skills works without MCP; MCP gives compatible clients a native tool interface.
- Package boundaries: Separate packages provide the MCP server, `ctx7` CLI, TypeScript SDK, Vercel AI SDK tools, and pi.dev extension.
- Indexing lifecycle: v4.9.2 can return a task during code-source indexing for clients that declare `io.modelcontextprotocol/tasks`; the API retains the task.
- Hosting boundary: The MCP source is MIT-licensed, but the API backend, parser, and crawler are not in the repository.
```

## Quick Start / Clone
```bash
npx ctx7 setup
```
