Skip to main content
Glama

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

Related MCP server: Axon.MCP.Server

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

Available Tools

3 tools
generate_tutorialA

Generate a comprehensive tutorial/learning guide for a codebase. Creates a "Zero to Hero" tutorial with:

  • Project overview and architecture

  • Mermaid.js dependency diagrams

  • Structured learning path (chapters)

  • Key insights and patterns

Requires init_codebase to be run first.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootPathYesAbsolute path to the codebase root (must have been initialized)
focusTopicNoOptional: Focus the tutorial on a specific topic or area (e.g., 'authentication', 'database')

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the burden of behavioral disclosure. It discloses the prerequisite and outlines the tutorial's content structure (e.g., Mermaid diagrams, learning path). However, it does not clarify whether the tool writes files, modifies the codebase, or what the exact return format is, leaving some behavioral ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening sentence followed by a bulleted list of outputs, and ends with a prerequisite. It is concise and front-loaded, though the bullet list is slightly verbose. There is no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (prerequisite, multiple output types) and no output schema or annotations, the description covers the key purpose and prerequisite but lacks details on return values, error handling, and how focusTopic modifies the output. It is minimally adequate but incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Since schema description coverage is 100%, the baseline for this dimension is 3. The description adds no additional parameter detail beyond the schema; rootPath and focusTopic are not discussed in the description, but the schema already provides adequate descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action (generate a comprehensive tutorial/learning guide) and the resource (codebase). It distinguishes itself from sibling tools init_codebase and search_codebase by focusing on producing a tutorial artifact rather than initializing or searching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states a prerequisite ('Requires init_codebase to be run first'), indicating when it is appropriate to use this tool. It does not explicitly mention alternatives or exclusions, but the prerequisite provides clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

init_codebaseA

Initialize and index a codebase for AI mentoring. This tool:

  • Crawls the directory structure (respecting .gitignore)

  • Analyzes each file to extract summaries, imports, and exports

  • Builds a manifest with file metadata and dependency graph

  • Creates a vector index for semantic search

Run this before using generate_tutorial or search_codebase.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootPathYesAbsolute path to the root directory of the codebase to index

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the main steps (crawling respecting .gitignore, analyzing files, building a manifest, creating a vector index), which is useful. However, it does not explicitly mention whether the tool modifies the codebase, writes files, or is safe to re-run, leaving some behavioral ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a one-line summary, a bulleted list of actions, and a usage directive. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one parameter, no output schema, and no annotations, the description covers purpose, process, and workflow integration well. It could mention what happens with the generated manifest/index, but that is not critical for an initialization step.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema describes rootPath as an absolute path to the codebase root, covering 100% of the parameter's meaning. The description adds no extra parameter details, so the baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool initializes and indexes a codebase for AI mentoring, then lists specific actions like crawling, analyzing, building a manifest, and creating a vector index. It distinguishes itself from sibling tools by being a prerequisite for generate_tutorial and search_codebase.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Run this before using generate_tutorial or search_codebase', providing clear timing context. While it does not state when not to use the tool, the directive is strong and alternatives are implied by their sequencing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_codebaseA

Perform semantic search across a codebase. Uses vector embeddings to find relevant code sections based on natural language queries.

Returns:

  • Matching code snippets with file paths and line numbers

  • Relevance scores

  • File context and summaries

Requires init_codebase to be run first.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language query describing what you're looking for
rootPathYesAbsolute path to the codebase root (must have been initialized)

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the prerequisite and return values, but does not explicitly state that the operation is read-only, nor does it describe error conditions, permissions, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, front-loaded with the main purpose, and uses a bulleted list for return values. Each sentence is informative with no unnecessary fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has only two parameters and no output schema, so the description's explanation of the return format (snippets, scores, file context) is helpful. It covers the essential workflow but omits error behavior and potential resource implications.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both query and rootPath are already well-described in the input schema. The description adds little beyond the schema, paraphrasing that query is natural language and rootPath must be initialized.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it performs semantic search across a codebase using vector embeddings. It is easily distinguished from siblings init_codebase and generate_tutorial.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states that init_codebase must be run first, providing a clear prerequisite. It does not explicitly mention when not to use the tool or alternative options, but the workflow implication is strong.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv1.0.0
    • First observedgenerate_tutorial
    • First observedinit_codebase
    • First observedsearch_codebase

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a distinct responsibility: init_codebase prepares the index, search_codebase queries it, and generate_tutorial creates learning content from the indexed data. There is no overlap in purpose or behavior.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: init_codebase, generate_tutorial, search_codebase. The naming is uniform, predictable, and clearly indicates each tool's action.

Tool Count5/5

With only 3 tools, the server is tightly scoped to its purpose of codebase mentoring. Each tool is essential to the workflow, and the small count is appropriate for a focused toolset.

Completeness5/5

The toolset covers the full lifecycle: initialization, semantic search, and tutorial generation. For the stated domain, there are no obvious missing operations that would leave an agent stuck.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A local MCP server that provides AI coding assistants with semantic search capabilities over codebases. It indexes code using local embeddings and exposes tools for efficient code retrieval, saving tokens and improving response quality.
    31
    4
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that transforms codebases into intelligent, queryable knowledge bases, enabling AI assistants to perform semantic search, explore architecture, and analyze code relationships.
    166
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that gives AI agents structured code understanding and precise code intelligence via local indexing of AST, call graphs, and semantic search.
    76
    4
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that indexes your codebase and gives AI assistants persistent understanding of project structure, dependencies, and history across sessions, with a self-improving multi-agent system for continuous code quality enhancement.
    14
    3
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/skainguyen1412/mcp-codebase'

If you have feedback or need assistance with the MCP directory API, please join our Discord server