Introducing a new way to review your PRs.

Read the announcement

upstash / context7

Context7 Platform -- Up-to-date docs for AI agents

View on GitHub

13 documents · Updated Nov 16, 2026

overview

Knowledge Base updated: 2026-11-16

Knowledge Base Index

1. Orientation

This repository is the Context7 monorepo: it ships the Context7 MCP server, client SDKs/tools, CLI setup flows, editor/agent plugin assets, and documentation/content used to integrate Context7 into developer tools. The highest-level flow is: clients or editor agents discover/install a Context7 integration, call the MCP/server or SDK tooling, and receive Context7 documentation/search results from the external Context7 service.

Main parts:

  • packages/mcp — primary Context7 MCP server package.
  • packages/sdk — TypeScript SDK client and command wrappers for Context7 APIs.
  • packages/cli — command-line setup and integration helpers.
  • packages/admin-mcp — Admin MCP runtime, API endpoints, and browser console/demo UI.
  • packages/tools-ai-sdk, packages/pi, packages/opencode — integration packages and tool/skill surfaces for AI agents.
  • plugins, rules, skills, .claude-plugin, .cursor-plugin — distributable editor/agent plugin metadata and instruction assets.
  • docs, i18n, public — product documentation, localized README files, OpenAPI/content assets, and public images.
  • examples/eve-docs-agent — example app showing a docs agent integration.

Critical state is mostly external to this repo: Context7 library/search data and authentication/service state live behind the remote Context7 APIs. In-repo state is primarily static package metadata, documentation content, plugin manifests, prompts/rules/skills, test fixtures, and local/editor configuration templates.

2. Architecture diagrams

flowchart LR
  subgraph Clients[Developer and agent clients]
    Editors[Editor/agent plugins]
    CLI[packages/cli]
    Example[examples/eve-docs-agent]
  end

  subgraph Core[Core runtime packages]
    MCP[packages/mcp]
    SDK[packages/sdk]
    AdminRuntime[packages/admin-mcp runtime]
    AdminAPI[packages/admin-mcp API/UI]
  end

  subgraph Integrations[Integration packages]
    ToolsAI[packages/tools-ai-sdk]
    PI[packages/pi]
    OpenCode[packages/opencode]
    RulesSkills[rules and skills]
  end

  subgraph Content[Content and distribution]
    Docs[docs and i18n]
    Public[public assets]
    Plugins[plugins and marketplace manifests]
  end

  External[External Context7 APIs]

  Editors --> Plugins
  Editors --> MCP
  CLI --> MCP
  Example --> SDK
  ToolsAI --> SDK
  PI --> SDK
  OpenCode --> RulesSkills
  AdminAPI --> AdminRuntime
  MCP --> External
  SDK --> External
  AdminRuntime --> External
  Docs --> Public
sequenceDiagram
  participant Agent as Editor/Agent client
  participant Plugin as Plugin or rule asset
  participant MCP as packages/mcp server
  participant API as External Context7 API
  participant Docs as Context7 docs result

  Agent->>Plugin: Load Context7 instructions/config
  Agent->>MCP: Invoke Context7 MCP tool
  MCP->>API: Resolve/search/fetch library docs
  API-->>MCP: Return library metadata/content
  MCP-->>Agent: Tool response with docs context
  Agent-->>Docs: Uses returned context in answer
flowchart TD
  User[User runs CLI/setup] --> CLI[packages/cli commands]
  CLI --> Detect[Detect target client/config]
  Detect --> Assets[plugins, rules, skills]
  Assets --> Install[Write or reference integration config]
  Install --> Client[Editor or agent runtime]
  Client --> MCP[Context7 MCP server]
flowchart TD
  Browser[Browser console/demo UI] --> API[packages/admin-mcp/api]
  API --> OAuth[OAuth metadata/resource endpoints]
  API --> ServerCard[Server card and ping endpoints]
  API --> Runtime[packages/admin-mcp/src runtime]
  Runtime --> Tools[Admin MCP tools and confirmations]

3. Glossary

  • Context7 — the product represented by this repo; it provides documentation/search context to AI coding tools and agents.
  • MCP — Model Context Protocol, the protocol surface used by packages/mcp and Admin MCP integrations.
  • Admin MCP — the admin-oriented MCP runtime, API handlers, and console UI under packages/admin-mcp.
  • PI — the integration package under packages/pi, containing API/tool/prompt/skill surfaces.
  • Skills/rules — distributable instruction assets under skills/** and rules/** used by agent clients.

4. Codebase-wide invariants

  • The repo is a pnpm TypeScript monorepo: root pnpm-workspace.yaml, root tsconfig*.json, and package-level packages/…/package.json plus packages/…/tsconfig.json define the workspace/package boundaries.
  • First-party packages are rooted under packages/*; every listed package directory (packages/mcp, packages/sdk, packages/cli, packages/admin-mcp, packages/tools-ai-sdk, packages/pi, packages/opencode) has its own package.json and TypeScript configuration.
  • Agent/editor distribution assets are separate from package source: plugin manifests and assets live under plugins/**, .claude-plugin/**, .cursor-plugin/**, while reusable instructions live under rules/** and skills/**.
  • Product documentation and public content are not mixed into package source: MDX/docs config live under docs/**, localized READMEs under i18n/**, and root/public image assets under public/**.
  • Tests are package-owned rather than centralized: examples include packages/mcp/test/**, packages/admin-mcp/test/**, packages/cli/src/__tests__/**, packages/pi/__tests__/**, and packages/…/*.test.ts.

5. Routing table