Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

An MCP server that acts as an AI mentor for any codebase using dual-layer indexing, enabling codebase initialization, tutorial generation, and semantic search.

README.md

MCP Codebase Mentor

An MCP (Model Context Protocol) server that acts as an AI mentor for any codebase using dual-layer indexing.

Features

  • Universal language support - AI handles all programming languages
  • Complete file coverage - Indexes code, tests, configs, and docs
  • Smart filtering - Respects .gitignore and applies sensible defaults
  • Semantic search - Vector-based code search using LlamaIndex
  • Tutorial generation - Creates structured learning guides with architecture diagrams

Installation

# Clone the repository
git clone <repository-url>
cd mcp-codebase

# Install dependencies
npm install

# Build the project
npm run build

Usage with Cursor/Claude

Add to your MCP configuration:

{
  "mcpServers": {
    "codebase-mentor": {
      "command": "node",
      "args": ["/path/to/mcp-codebase/dist/index.js"]
    }
  }
}

Available Tools

init_codebase

Initialize and index a codebase for AI mentoring.

init_codebase(rootPath: "/path/to/your/project")

This will:

  1. Crawl the directory structure (respecting .gitignore)
  2. Analyze each file with AI to extract summaries, imports, and exports
  3. Build a manifest with file metadata and dependency graph
  4. Create a vector index for semantic search

Output files:

  • .mcp_manifest.json - File metadata and dependency graph
  • .mcp_index/ - Vector index for semantic search

generate_tutorial

Generate a comprehensive "Zero to Hero" tutorial for a codebase.

generate_tutorial(rootPath: "/path/to/your/project", focusTopic?: "authentication")

Creates:

  • Project overview and architecture
  • Mermaid.js dependency diagrams
  • Structured learning path (chapters)
  • Key insights and patterns

search_codebase

Perform semantic search across a codebase.

search_codebase(rootPath: "/path/to/your/project", query: "how is authentication handled?")

Returns relevant code snippets with:

  • File paths and line numbers
  • Relevance scores
  • File context and summaries

Project Structure

mcp-codebase/
├── src/
│   ├── index.ts                    # MCP server entry point
│   ├── tools/
│   │   ├── init.ts                 # init_codebase implementation
│   │   ├── tutorial.ts             # generate_tutorial implementation
│   │   └── search.ts               # search_codebase implementation
│   ├── core/
│   │   ├── crawler.ts              # File system walker (.gitignore aware)
│   │   ├── analyzer.ts             # LLM-based file analysis
│   │   ├── manifest.ts             # Manifest CRUD operations
│   │   └── vectorIndex.ts          # LlamaIndex integration
│   ├── utils/
│   │   ├── fileFilter.ts           # Smart file filtering logic
│   │   ├── languageDetect.ts       # Language/file type detection
│   │   ├── progress.ts             # Progress reporter
│   │   └── git.ts                  # Git metadata extraction
│   ├── prompts/
│   │   ├── analyze.ts              # Universal file analysis prompt
│   │   └── curriculum.ts           # Tutorial generation prompt
│   └── types/
│       ├── manifest.ts             # Manifest type definitions
│       └── mcp.ts                  # MCP tool interfaces
├── package.json
├── tsconfig.json
└── README.md

Development

# Type checking
npm run typecheck

# Development mode with auto-reload
npm run dev

# Build for production
npm run build

Performance Expectations

For a typical repository:

  • 500 files: ~10-15 minutes (mostly AI analysis)
  • 1000 files: ~20-30 minutes
  • 5000 files: ~2 hours

Initialization is a one-time operation. Subsequent queries use the cached index.

Storage

For a 500-file repository (~50MB source):

  • Manifest: ~100-200 KB
  • Vector Index: ~5-10 MB
  • Total overhead: ~20% of source size

Limitations

  1. LLM Dependency: Initialization requires an MCP host with sampling capability
  2. No Incremental Updates: Re-run init_codebase when files change significantly
  3. Binary Files: Skipped (images, PDFs, executables)
  4. Very Large Files: May hit LLM context limits (>100K tokens)

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Search servers.