Skip to main content
Glama

codelore

Turn any code repository into a searchable Obsidian vault — then let Claude Code navigate it as a set of MCP tools.

codelore runs a two-phase pipeline:

  1. Summarise — calls claude --print once per file and directory to produce structured markdown documentation

  2. Index — chunks every file at the function/class level, generates developer questions for each chunk, and stores them in a ChromaDB vector index

The result is an Obsidian vault of linked markdown notes and a semantic search index that Claude Code can query as native tools.


How it works

your-repo/
    src/auth/middleware.py   →  AI summary + import graph
    src/db/pool.py           →  AI summary + import graph
    ...
           ↓  codelore ingest
your-repo_vault/
    INDEX.md                 overview + wikilinks to all modules
    src/auth/middleware.md   structured summary of every function
    src/db/pool.md           ...
your-repo_chroma/            ChromaDB: chunks indexed by developer questions

Claude Code reads INDEX.md → directory notes → file notes via the explore_repo tool, and answers "how does X work?" questions via search_code which hits the semantic index.


Related MCP server: obsidian-mcp

Prerequisites

  • Python 3.11+

  • uv — used to run the MCP server and manage dependencies

  • Claude Code CLI — claude.ai/download

    claude --version   # must be on PATH

Install

git clone https://github.com/yourname/codelore
cd codelore
uv sync                        # creates .venv/ and installs all dependencies
source .venv/bin/activate      # Windows: .venv\Scripts\activate

Quick start

# 1. Ingest a local repo (or pass a GitHub URL)
codelore ingest /path/to/your-repo

# Preview cost before running on a large repo
codelore ingest /path/to/your-repo --dry-run

# Re-use cached summaries from a previous run (skips claude calls)
codelore ingest /path/to/your-repo   # prompted automatically if cache exists

# 2. Query from the terminal
codelore query "how does authentication work?" \
  --chroma /path/to/your-repo_chroma

# 3. Print MCP setup instructions
codelore init --vault /path/to/your-repo_vault \
              --chroma /path/to/your-repo_chroma \
              --repo /path/to/your-repo

CLI reference

codelore ingest <repo>

Flag

Description

--vault PATH

Override vault output directory (default: <name>_vault/)

--explanations PATH

Load a pre-generated _explanations.json instead of calling Claude

--dry-run

Print file count and estimated Claude calls without running

--no-llm

Write structural vault (file tree + imports) without any Claude calls

codelore query <question>

Flag

Description

--chroma PATH

ChromaDB directory (or set CODELORE_CHROMA_PATH)

--vault PATH

Vault directory for summary snippets (or set CODELORE_VAULT_ROOT)

-n N

Number of results (default: 5)

codelore init

Prints step-by-step setup instructions and a ready-to-paste MCP config block.

Flag

Description

--vault PATH

Pre-fill vault path in the generated config

--chroma PATH

Pre-fill ChromaDB path in the generated config

--repo PATH

Pre-fill repo root path in the generated config


MCP server setup (Claude Code)

After ingesting, add codelore as an MCP server so Claude Code can call it as tools.

If you cloned the repo, it already includes a .mcp.json at the project root that launches the server via uv. Just make sure uv is installed and run uv sync — the MCP server will start automatically when you open the project in Claude Code.

To set it up manually for a different project, create a .mcp.json in the project root:

{
  "mcpServers": {
    "codelore": {
      "command": "uv",
      "args": ["run", "codelore-mcp"],
      "env": {
        "VIRTUAL_ENV": ""
      }
    }
  }
}

The "VIRTUAL_ENV": "" clears any activated venv so uv uses its own .venv/ without conflicts.

All tools accept vault_root, chroma_path, and repo_root as per-call parameters. To avoid passing them every time, add them to the env block:

{
  "env": {
    "VIRTUAL_ENV": "",
    "CODELORE_VAULT_ROOT": "/path/to/your-repo_vault",
    "CODELORE_CHROMA_PATH": "/path/to/your-repo_chroma",
    "CODELORE_REPO_ROOT": "/path/to/your-repo"
  }
}

codelore init will generate a ready-to-paste config with your actual paths filled in.

Available MCP tools

Tool

Triggers on

search_code

"how does X work?", "where is Y defined?"

explore_repo

"explain this codebase", "give me an overview"

get_active_scope

debugging .mcp.json, sanity-checking resolved paths

find_todos

"what's left to implement?", "show open tasks"

vault_append

"add a note about X", "append my findings to the auth module"

read_guidelines

architectural guidelines doc (optional)

estimate_cost

"how many claude calls would this take?"

ingest_repo

"ingest this repo"

rebuild_vault

rebuild vault from saved explanations

sync_vault

incremental re-index after code changes


codelore generates an Obsidian-compatible vault, and several codelore tools are designed to hand off to the Obsidian Local REST API MCP for direct vault operations. Setting this up unlocks:

  • vault_read — read any vault note directly (the sole path for reading vault notes; codelore's read_vault_node is unregistered/disabled for now and can be restored if the Obsidian MCP proves unreliable)

  • vault_append — safely append notes to existing vault files without overwriting

  • search_simple — plain-text search across your vault as a fallback when semantic search returns no results

Setup

  1. Install the Obsidian Local REST API plugin in Obsidian.

  2. Enable the plugin and copy the API key from its settings.

  3. Add the following to your .mcp.json alongside the codelore entry:

{
  "mcpServers": {
    "obsidian": {
      "type": "http",
      "url": "http://127.0.0.1:27123/mcp/",
      "headers": {
        "Authorization": "Bearer <your-api-key>"
      }
    }
  }
}

Once both MCP servers are running, Claude will automatically use them together:

  • search_code (codelore) → falls back to search_simple (Obsidian MCP) → falls back to raw file grep

  • vault_append (codelore) resolves the right vault note, then calls vault_append (Obsidian MCP) to append safely

  • explore_repo and find_todos direct Claude to use vault_read (Obsidian MCP) for follow-up note reading

Note: The Obsidian MCP vault_write tool overwrites files entirely and is not used by codelore tools. It will only be called if you explicitly ask for it by name.


Supported languages

Language

Extensions

Chunking

Python

.py

AST (function + class level)

JavaScript / TypeScript

.js .jsx .ts .tsx .mjs

tree-sitter

Go

.go

tree-sitter

Java

.java

tree-sitter

Kotlin

.kt

tree-sitter

Scala

.scala

tree-sitter

C#

.cs

tree-sitter

Haskell

.hs .lhs

tree-sitter

Elixir

.ex .exs

tree-sitter

Lua

.lua

tree-sitter

Shell

.sh .bash

tree-sitter

Dart

.dart

whole-file

R

.r .R

whole-file

Non-code files (.md, .json, .yaml, .toml, .sql, .proto, .graphql) are also indexed for context.


Incremental re-indexing

After code changes, sync only the modified files instead of re-running the full pipeline:

# via MCP tool (in Claude Code):
"sync the vault for /path/to/repo"   →  calls sync_vault(dry_run=True) first

# or directly:
sync_vault(repo_path="/path/to/repo", explanations_json_path="..._explanations.json", dry_run=True)
sync_vault(repo_path="/path/to/repo", explanations_json_path="..._explanations.json", dry_run=False)

Requires the repo to be a git repository (uses git diff against the SHA saved during ingestion).


Architecture

codelore/
  main.py          CLI entry point (ingest / query / init subcommands)
  ingest.py        build file/directory graph, write vault markdown
  explain.py       collect files, call Claude CLI for summaries
  llm.py           Claude CLI wrapper, prompt templates
  nodes.py         FileNode / DirectoryNode / IndexNode → markdown
  generate_questions.py  chunk-level question generation + ChromaDB indexing
  parsers/         language-specific import graph + chunk extraction
    _treesitter.py shared tree-sitter helper
    python.py      stdlib ast
    javascript.py  tree-sitter-javascript / tree-sitter-typescript
    go.py          tree-sitter-go
    jvm.py         tree-sitter-java / tree-sitter-kotlin / tree-sitter-scala
    csharp.py      tree-sitter-c-sharp
    haskell.py     tree-sitter-haskell
    elixir.py      tree-sitter-elixir
    lua.py         tree-sitter-lua
    shell.py       tree-sitter-bash
    ...
  query/
    retrieval.py   search_chunks, bfs_vault, grep_todos, git_file_log
mcp_server.py      FastMCP server exposing 9 tools

License

MIT

Available Tools

10 tools
estimate_costA

Estimate how many Claude CLI calls ingesting a repo will require.

Use this BEFORE running ingest_repo on a large codebase to understand the scope. Reports file counts by language and the total number of 'claude --print' subprocess calls that will be made.

Does not call Claude or modify anything — safe to run at any time.

Inputs: repo_path (required). Returns: result

explore_repoA

Get a structured overview of the repo by traversing the vault graph.

Use this for onboarding questions: 'explain the repo', 'where do I start', 'give me an overview of the codebase', or 'what are the main components'. Starts from the vault INDEX and traverses breadth-first, returning summaries at increasing depth so you can understand the repo from the top down.

To drill into a specific node after this overview, use the Obsidian MCP vault_read tool.

GUARDRAIL: Never call the Obsidian MCP vault_write tool unless the user explicitly requests it by name.

vault_root is optional — omit to use CODELORE_VAULT_ROOT, or pass it explicitly to explore a different repo's vault without reconfiguring. Resolves against the configured target repo (see server instructions) — not necessarily the current working directory.

Inputs: max_depth, vault_root. Returns: result

find_todosA

Find TODO/FIXME comments and recent git activity for relevant files.

Use this for project progress or task management questions: 'what's left to do', 'what needs work in the parser', 'what files are incomplete', 'show me open tasks'. Searches for the most relevant files via semantic search, then scans them for TODO/FIXME/HACK comments and shows recent git commits.

After identifying open tasks, you may use the Obsidian MCP vault_append tool to add notes or progress updates to the relevant vault files without overwriting existing content. Use vault_read (Obsidian MCP) to read the file before appending.

GUARDRAIL: Never call the Obsidian MCP vault_write tool unless the user explicitly requests it by name.

vault_root, chroma_path, and repo_root are optional — omit to use env vars, or pass them explicitly to query a different repo. Resolves against the configured target repo (see server instructions) — not necessarily the current working directory.

Inputs: query (required), n_files, repo_root, vault_root, +1 more. Returns: result

get_active_scopeA

Report which repo this codelore server is currently scoped to — useful to sanity-check before a multi-step task, or to debug a misconfigured .mcp.json. Not required before calling other tools: they already refuse to resolve to codelore's own source on their own.

Inputs: repo_root, vault_root, chroma_path. Returns: result

ingest_repoA

Ingest a code repository into codelore — generates the vault and search index.

Accepts either a local directory path or a GitHub URL (https://github.com/owner/repo). Runs the full pipeline:

  1. Generates AI summaries for every file and directory via Claude CLI

  2. Writes an Obsidian-compatible vault of markdown notes

  3. Indexes code chunks as developer questions into ChromaDB

extra_frontmatter_json — optional JSON object of extra fields to add to every vault note's frontmatter, e.g. '{"project": "myapp", "status": "draft", "tags": ["backend", "python"]}'. Strings, numbers, booleans, and flat lists are all supported. These fields are merged after the built-in fields.

After ingestion, the tool prints the vault and chroma paths. Pass these as vault_root and chroma_path to the query tools, or set them as env vars.

WARNING: calls 'claude --print' once per file + directory + chunk. Run estimate_cost first on large repos.

Inputs: repo_path_or_url (required), vault_output_path, extra_frontmatter_json. Returns: result

read_guidelinesA

Return the project's architectural guidelines and coding conventions.

Use this for questions about coding style, architectural patterns, conventions, how to structure new code, or what rules the project follows.

GUARDRAIL: Never call the Obsidian MCP vault_write tool unless the user explicitly requests it by name.

guidelines_path is optional — omit to use CODELORE_GUIDELINES_PATH, or pass a path directly to read any guidelines document without reconfiguring.

Inputs: guidelines_path. Returns: result

rebuild_vaultA

Rebuild the vault and search index from an existing explanations file.

Use this to re-run vault generation WITHOUT making any Claude CLI calls for file summaries. Useful when you want to re-index after code changes but already have summaries, or to iterate on vault structure without LLM cost.

extra_frontmatter_json — optional JSON object of extra fields to add to every vault note's frontmatter, e.g. '{"project": "myapp", "status": "draft", "tags": ["backend", "python"]}'. Strings, numbers, booleans, and flat lists are all supported.

Note: ChromaDB question generation still calls Claude once per chunk — only the file/directory summaries are skipped (they're loaded from JSON).

The explanations.json is saved automatically by ingest_repo.

Inputs: repo_path (required), explanations_json_path (required), vault_output_path, extra_frontmatter_json. Returns: result

search_codeA

Search the codebase using semantic similarity.

Use this for functional questions: how something works, where a function is defined, what a module does, or any vague/underspecified question about code behaviour. Searches a question-indexed vector database and returns the most relevant code chunks together with their vault summary.

Each result is labeled Confidence: high or low based on whether its cosine distance is within max_distance (default 1.35 — tune it lower for stricter matching, higher to allow more speculative results through).

FALLBACK — if this tool returns no results or all results are labeled low confidence, call the Obsidian MCP search_simple tool with the same query for a plain-text search across vault notes; do not grep the repo's source as a substitute for search — the vault is the source of truth for locating relevant code.

Once you've located relevant code via a result's file_path (an absolute path into the target repo, not the vault), reading that file directly with Read/Grep is expected and normal when you need exact/current detail the vault summary doesn't cover — the vault summarizes, it doesn't replace the source.

After finding results, use the Obsidian MCP vault_read tool to read full vault notes — try the vault-relative path first, and fall back to the absolute path if the Obsidian MCP rejects it (path format depends on how the Obsidian MCP server resolves paths against the vault root).

GUARDRAIL: Never call the Obsidian MCP vault_write tool unless the user explicitly requests it by name.

vault_root and chroma_path are optional — if omitted, the server uses the CODELORE_VAULT_ROOT and CODELORE_CHROMA_PATH environment variables. Pass them explicitly to query a different repo without reconfiguring the server. Resolves against the configured target repo (see server instructions) — not necessarily the current working directory.

Inputs: query (required), n_results, vault_root, chroma_path, +1 more. Returns: result

sync_vaultA

Detect and apply repo changes since the last ingest.

Use this to keep the vault and search index in sync after code changes without re-processing the entire repo. Uses git diff against the commit SHA saved during the last ingest_repo run.

dry_run=True (default): reports changed, new, and deleted files — no changes made. dry_run=False: for each modified file, regenerates its summary and asks Claude whether it's a REAL conflict vs. the existing vault note (not just phrasing/ comment/formatting drift). Only real conflicts replace the note and reindex that file's ChromaDB questions — everything else is left as-is. Either way, the vault note gets a Sync Log entry noting the commit that was checked. New files are ingested for the first time; deleted files are removed.

Always run with dry_run=True first to review the change set, then call again with dry_run=False to apply. Requires the repo to be a git repository.

Inputs: repo_path (required), explanations_json_path (required), dry_run, vault_root, +1 more. Returns: result

vault_appendA

Find the most relevant vault note for a user's annotation query and return its path so the Obsidian MCP vault_append tool can safely append to it.

Use this when the user wants to add notes, progress updates, or observations to a vault file based on what they're currently doing — for example: 'add a note about the parser edge case', 'mark this TODO as resolved', 'append my findings on the auth module'.

WORKFLOW:

  1. This tool resolves the target vault note path via semantic search.

  2. Use the Obsidian MCP vault_read tool to read the current content of that file before appending.

  3. Use the Obsidian MCP vault_append tool to add the new content to the end of the file. vault_append never overwrites existing content.

GUARDRAIL: Use vault_append (Obsidian MCP) for all note additions. Never call the Obsidian MCP vault_write tool unless the user explicitly requests it by name — vault_write overwrites the entire file.

Returns the resolved vault note path (both relative and absolute forms — try the relative one first, and fall back to the absolute one if the Obsidian MCP rejects it) so you can craft a contextual append. Use the Obsidian MCP vault_read tool on that path first to see the note's existing content before appending.

vault_root and chroma_path are optional — omit to use env vars.

Inputs: query (required), vault_root, chroma_path. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool targets a distinct operation: estimation, exploration, search, ingestion, syncing, etc. There is no overlap or ambiguity in their purposes.

    Naming Consistency5/5

    All tool names follow the verb_noun snake_case pattern consistently (e.g., estimate_cost, explore_repo, find_todos). Even informal terms like 'todos' fit the pattern.

    Tool Count5/5

    10 tools cover the full lifecycle of repository ingestion and querying without being excessive or thin. The count is well-scoped for the server's purpose.

    Completeness4/5

    The tool set covers estimation, ingestion, exploration, search, syncing, and annotation assistance. Missing a delete tool, but the core workflows are complete.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude Code with deep access to an Obsidian vault through 28 tools for structural analysis, semantic retrieval, and git-backed timeseries tracking. It transforms your vault into a live knowledge base that Claude can search, navigate, and reason about using its knowledge graph.
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Give Claude (and any MCP client) real agent access to your Obsidian vault — graph traversal, Dataview queries, daily-note awareness, and more.
      25
      25 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives Claude AI direct access to your Obsidian vault, enabling natural language search, note creation, file management, and automated workflows.
      5,325 npm
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude with read, search, and write access to an Obsidian vault through MCP tools.
      5,325 npm
      Apache 2.0