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/mcpand 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/**andrules/**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 underrules/**andskills/**. - Product documentation and public content are not mixed into package source: MDX/docs config live under
docs/**, localized READMEs underi18n/**, and root/public image assets underpublic/**. - 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
-
packages/mcp/**-> docs/mcp-server.md -
any change to the primary Context7 MCP server entrypoint, MCP tool registration, MCP schemas, MCP package tests, MCP package build/runtime config, or MCP packaging assets -> docs/mcp-server.md
-
packages/sdk/**-> docs/sdk-client.md -
any change to Context7 SDK client APIs, command wrappers, HTTP/error utilities, SDK type contracts, or SDK tests -> docs/sdk-client.md
-
packages/cli/**-> docs/cli.md -
any change to CLI commands, setup flows, CLI constants/types, CLI utilities, or CLI package build/test configuration -> docs/cli.md
-
packages/admin-mcp/src/**-> docs/admin-mcp-runtime.md -
packages/admin-mcp/scripts/**-> docs/admin-mcp-runtime.md -
packages/admin-mcp/test/**-> docs/admin-mcp-runtime.md -
packages/admin-mcp/LICENSE-> docs/admin-mcp-runtime.md -
packages/admin-mcp/.prettierignore-> docs/admin-mcp-runtime.md -
any change to Admin MCP runtime server/tool/batch/confirmation/console behavior -> docs/admin-mcp-runtime.md
-
packages/admin-mcp/api/**-> docs/admin-mcp-web-api-ui.md -
packages/admin-mcp/public/**-> docs/admin-mcp-web-api-ui.md -
packages/admin-mcp/ui/**-> docs/admin-mcp-web-api-ui.md -
any change to Admin MCP OAuth metadata, protected-resource metadata, server-card, ping endpoints, public assets, browser console, or demo UI -> docs/admin-mcp-web-api-ui.md
-
packages/tools-ai-sdk/**-> docs/tools-ai-sdk.md -
any change to AI SDK exported tools, agent helpers, prompts, tests, or package build configuration -> docs/tools-ai-sdk.md
-
packages/pi/**-> docs/pi.md -
any change to PI API/result formatting, PI prompts, PI tool definitions, PI extensions, PI skills, or PI tests -> docs/pi.md
-
packages/opencode/**-> docs/opencode.md -
any change to the OpenCode integration entrypoint, bundled OpenCode skills, or OpenCode package metadata/build configuration -> docs/opencode.md
-
plugins/**-> docs/editor-agent-plugins.md -
.claude-plugin/**-> docs/editor-agent-plugins.md -
.cursor-plugin/**-> docs/editor-agent-plugins.md -
any change to distributable editor/agent plugin manifests or marketplace metadata -> docs/editor-agent-plugins.md
-
docs/**-> docs/documentation-content.md -
i18n/**-> docs/documentation-content.md -
public/**-> docs/documentation-content.md -
LICENSE-> docs/documentation-content.md -
any change to product docs pages, docs routing/config, OpenAPI docs assets, snippets, images, public docs assets, or localized README content -> docs/documentation-content.md
-
rules/**-> docs/rules-and-skills.md -
skills/**-> docs/rules-and-skills.md -
any change to repository-level Context7 rule files or reusable agent skills -> docs/rules-and-skills.md
-
examples/eve-docs-agent/**-> docs/eve-docs-agent-example.md -
any change to the Eve docs agent example app, its agent implementation, workspace/package setup, deployment/environment templates, or assistant instruction files -> docs/eve-docs-agent-example.md