Context7 MCP Clone

Context7 MCP Clone

Provides up-to-date, version-specific documentation and code examples for software libraries directly to LLMs, enabling resolution of library identifiers and retrieval of relevant documentation with code snippets.

Category
Visit Server

README

Context7 MCP Clone - Up-to-Date Code Documentation for LLMs

A production-ready clone of Context7 MCP that provides up-to-date, version-specific documentation and code examples directly to LLMs and AI code editors.

๐ŸŽฏ Project Status

Phase 2 Complete: Core MCP Server and Backend API ready for development!

Completed Components

  • โœ… pnpm monorepo with workspace configuration
  • โœ… Docker Compose development and production environments
  • โœ… PostgreSQL database schema with migrations
  • โœ… NestJS backend API with authentication
  • โœ… Library and documentation services
  • โœ… MCP server with both tools (resolve-library-id, get-library-docs)
  • โœ… Stdio and HTTP transports for MCP protocol

In Progress

  • ๐Ÿš€ Rate limiting with Redis
  • ๐Ÿš€ Crawler engine with GitHub API and web scraping
  • ๐Ÿš€ Markdown and HTML parsing with code extraction
  • ๐Ÿš€ Next.js web UI with Grafana theme

๐Ÿ“ฆ Project Structure

atamai-mcp/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ mcp-server/           # MCP Protocol Server
โ”‚   โ”œโ”€โ”€ backend-api/          # NestJS REST API
โ”‚   โ”œโ”€โ”€ crawler-engine/       # Documentation Crawler
โ”‚   โ””โ”€โ”€ web-ui/               # Next.js Frontend
โ”œโ”€โ”€ docker/                   # Container configurations
โ”œโ”€โ”€ scripts/                  # Utility scripts
โ”œโ”€โ”€ docker-compose.yml        # Production compose
โ”œโ”€โ”€ docker-compose.dev.yml    # Development compose
โ”œโ”€โ”€ PLAN.md                   # Detailed implementation plan
โ”œโ”€โ”€ TODO.md                   # Task checklist
โ””โ”€โ”€ README.md                 # This file

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 8+
  • Docker & Docker Compose
  • PostgreSQL 16+ (or use docker-compose)

Development Setup

  1. Clone and install dependencies
cd /Users/atamai/develope/atamai-mcp
pnpm install
  1. Set up environment
cp .env.example .env
# Edit .env with your configuration
  1. Start development environment with Docker
docker-compose -f docker-compose.dev.yml up

This starts:

  • PostgreSQL database on port 5432
  • Redis cache on port 6379
  • Backend API on port 5000
  • MCP Server on port 3000
  • Web UI on port 4000
  1. Run migrations
# Migrations run automatically when backend starts
# Or manually run:
cd packages/backend-api
pnpm run migration:run

๐Ÿ“š MCP Server

Tools Available

1. resolve-library-id

Converts a library name to Context7-compatible ID and returns ranked results.

Input:

{
  "libraryName": "react"
}

Output:

{
  "libraries": [
    {
      "id": "/facebook/react",
      "name": "React",
      "description": "A JavaScript library for building user interfaces",
      "ecosystem": "javascript",
      "stars": 220000,
      "benchmarkScore": 98,
      "reputation": "high",
      "codeSnippets": 15420
    }
  ],
  "selected": "/facebook/react",
  "reasoning": "Exact name match with highest benchmark score"
}

2. get-library-docs

Retrieves version-specific documentation and code examples.

Input:

{
  "context7CompatibleLibraryID": "/facebook/react",
  "topic": "hooks",
  "page": 1,
  "mode": "code"
}

Output:

{
  "libraryId": "/facebook/react",
  "library": {
    "name": "React",
    "full_name": "facebook/react",
    "ecosystem": "javascript"
  },
  "version": "18.2.0",
  "topic": "hooks",
  "page": 1,
  "totalPages": 5,
  "documentation": [
    {
      "title": "Using the State Hook",
      "type": "guide",
      "content": "...",
      "codeExamples": [
        {
          "language": "javascript",
          "code": "const [count, setCount] = useState(0);",
          "description": "Basic useState example"
        }
      ],
      "url": "https://react.dev/reference/react/useState"
    }
  ]
}

Running MCP Server

Stdio Mode (for Claude Desktop, Cursor, etc.)

cd packages/mcp-server
pnpm start
# Or with hot reload:
pnpm dev

HTTP Mode

MCP_TRANSPORT=http MCP_SERVER_PORT=3000 pnpm start
# Access SSE endpoint at: http://localhost:3000/mcp/sse

๐Ÿ”Œ Backend API

Authentication

Register

POST /api/v1/auth/register
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "SecurePassword123!"
}

Login

POST /api/v1/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "SecurePassword123!"
}

Libraries

Search Libraries

GET /api/v1/libraries?query=react&ecosystem=javascript&page=1&limit=20
Authorization: Bearer <jwt_token>

Get Library by ID

GET /api/v1/libraries/{id}
Authorization: Bearer <jwt_token>

Get Available Ecosystems

GET /api/v1/libraries/ecosystems
Authorization: Bearer <jwt_token>

Documentation

Get Documentation

GET /api/v1/docs/{libraryId}?topic=hooks&page=1&mode=code
Authorization: Bearer <jwt_token>

Search Documentation

GET /api/v1/docs/search/{query}
Authorization: Bearer <jwt_token>

Swagger Documentation

Once the backend is running, visit:

http://localhost:5000/docs

๐Ÿ“Š Database Schema

Core Tables

  • users - User accounts with tier system
  • api_keys - API key management with rate limits
  • libraries - Library metadata
  • library_versions - Version tracking
  • documentation_pages - Documentation content with full-text search
  • code_examples - Code snippets
  • crawl_jobs - Crawler job tracking
  • api_usage - Usage analytics

Features

  • Full-text search on documentation
  • Trigram similarity for fuzzy matching
  • JSONB metadata support
  • Automatic tsvector updates
  • Materialized views for popular libraries

๐Ÿ”„ Deployment

Production Docker Compose

docker-compose up -d

Environment Variables

See .env.example for all available options:

  • DATABASE_URL - PostgreSQL connection string
  • REDIS_URL - Redis connection string
  • JWT_SECRET - JWT signing key
  • NODE_ENV - production/development
  • API_PREFIX - API base path (default: /api/v1)

Kubernetes Deployment

Deploy manifests are in the plan for Phase 8.

๐Ÿ“ˆ Development Roadmap

Phase 3: Crawler Engine (Weeks 5-6)

  • [ ] BullMQ job queue setup
  • [ ] GitHub crawler with Octokit
  • [ ] Documentation site scraper
  • [ ] Markdown/HTML parsers
  • [ ] Code extraction engine

Phase 4: Web UI (Weeks 7-8)

  • [ ] Next.js 15 setup with App Router
  • [ ] Landing page with purple gradient theme
  • [ ] Documentation browser
  • [ ] Authentication pages

Phase 5: Dashboard & Admin (Weeks 9-10)

  • [ ] User dashboard
  • [ ] API key management
  • [ ] Admin panel
  • [ ] Analytics and charts

Phase 6-10: Completion & Launch

  • [ ] Data seeding
  • [ ] Testing & optimization
  • [ ] Production deployment
  • [ ] Beta & public launch

๐Ÿงช Testing

# Run tests for all packages
pnpm test

# Run tests with coverage
pnpm test:cov

# Watch mode
pnpm test:watch

๐Ÿ“ Code Style

# Format code
pnpm format

# Check formatting
pnpm format:check

# Lint
pnpm lint

# Type check
pnpm type-check

๐Ÿ› Debugging

Backend API

DEBUG=* pnpm dev

MCP Server

DEBUG=* pnpm dev

Docker Logs

docker-compose -f docker-compose.dev.yml logs -f [service-name]

๐Ÿ“– Documentation

  • PLAN.md - Comprehensive implementation plan with architecture
  • TODO.md - Detailed task checklist for all phases
  • API Docs - Available at http://localhost:5000/docs (Swagger)

๐Ÿค Contributing

This is a solo development project. Please follow:

  • TypeScript strict mode
  • ESLint configuration
  • Prettier formatting
  • 80%+ test coverage

๐Ÿ“„ License

MIT

๐ŸŽฏ Key Metrics (Target)

  • Performance: MCP response <200ms (p95)
  • Search: <100ms (p95)
  • Uptime: 99.9%
  • Coverage: 100+ libraries by month 6
  • Users: 1000+ registered by month 3

Next Steps

  1. Run docker-compose -f docker-compose.dev.yml up
  2. Wait for migrations to complete
  3. Visit http://localhost:5000/docs for API documentation
  4. Start using the MCP server with Claude Desktop or Cursor
  5. Reference PLAN.md for detailed architecture and TODO.md for task tracking

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured