Context8 is an intelligent context platform for private code repositories, similar to Context7. It provides semantic retrieval capabilities for private codebases to AI coding assistants (Cursor, Claude Desktop, Windsurf) via the MCP (Model Context Protocol).
- Private Code Indexing: Connect to local directories or remote repositories, using Tree-sitter for AST-based semantic chunking
- Hybrid Retrieval: Combines vector semantic search with BM25 keyword search, fused via RRF (Reciprocal Rank Fusion)
- MCP Protocol Support: Standard MCP tools that work directly in Cursor/Claude Desktop
- Wiki Generation: Auto-generate wiki documentation for your codebase using LLM
- Web Dashboard: Manage projects, search code, monitor tasks, and configure settings
Manage indexed codebases, add local directories or remote repositories.
Auto-generated wiki documentation for your codebase, providing structured navigation and comprehensive guides.
Cross-codebase semantic search with token limit filtering, supporting Code or Info mode.
Real-time monitoring of indexing task progress and history.
Configure AI model providers, including Embedding and LLM API settings.
context8/
├── apps/
│ ├── mcp-server/ # MCP protocol gateway
│ ├── web/ # Next.js web dashboard
│ ├── worker/ # Background task processor
│ └── cli/ # Command-line interface
│
├── packages/
│ ├── database/ # Prisma ORM + PostgreSQL
│ ├── embedding/ # Embedding model client
│ ├── indexer/ # Code indexing logic
│ ├── parser/ # Tree-sitter AST parsing + chunking
│ ├── retriever/ # Hybrid retrieval (vector + BM25)
│ ├── types/ # Shared TypeScript types
│ └── vector-store/ # Qdrant vector database client
│
├── mcp/ # Standalone MCP client package
│
└── deploy/
└── docker-compose.yml # Development infrastructure
# Install pnpm if not installed
npm install -g pnpm
# Install project dependencies
pnpm install# Start PostgreSQL, Redis, Qdrant
pnpm docker:up# Generate Prisma Client
pnpm db:generate
# Run database migrations
pnpm db:push# Start all services
pnpm devResolve a library name to a Context8 library ID.
{
"libraryName": "payment-service"
}Fetch documentation for a library by its ID.
{
"context8CompatibleLibraryID": "/org/project",
"topic": "authentication",
"mode": "code"
}Fetch wiki documentation for a library.
{
"context8CompatibleLibraryID": "/org/project",
"topic": "architecture"
}Delete a project and all its indexed data.
{
"projectId": "project-uuid"
}Add to your MCP configuration file:
{
"mcpServers": {
"context8": {
"command": "node",
"args": ["/path/to/context8/apps/mcp-server/dist/bin/local.js"],
"env": {
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/context8",
"QDRANT_HOST": "localhost",
"QDRANT_PORT": "6333"
}
}
}
}Copy .env.example to .env and configure:
cp .env.example .envMain configuration:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://postgres:postgres@localhost:5432/context8 |
QDRANT_HOST |
Qdrant service host | localhost |
QDRANT_PORT |
Qdrant service port | 6333 |
VOYAGE_API_KEY |
Voyage AI API Key (code embedding) | - |
OPENAI_API_KEY |
OpenAI API Key (for wiki generation) | - |
- Runtime: Node.js 20+ / TypeScript 5.3+
- Monorepo: pnpm + Turborepo
- Framework: MCP SDK, Next.js (Web)
- Database: PostgreSQL 15 + Prisma
- Vector Database: Qdrant
- Code Parsing: Tree-sitter
- Embedding Model: Voyage code-3
- Task Queue: BullMQ + Redis
# Build all packages
pnpm build
# Type checking
pnpm typecheck
# Run tests
pnpm testMIT





