Skip to main content
Glama
y1hanh

Headless Codebase Indexer

by y1hanh

Headless Codebase Indexer (MCP Server)

A minimalist, server-side codebase indexing tool built to give autonomous AI agents and language models the deep code-understanding capabilities typically reserved for visual IDEs like Cursor.

Why I built this: When transitioning manual IDE workflows into fully autonomous, server-hosted processes, I hit a wall: unsupervised agents running in the cloud lack structural context. They try to grep their way through massive codebases and end up hallucinating or blowing out their context windows.

Instead of deploying massive, heavy infrastructure, I wrote this lightweight tool to bridge that gap. It headlessly exposes both semantic meaning and strict AST structures via the Model Context Protocol (MCP), giving my automated agents the guardrails they need to navigate codebases securely and predictably.

⚙️ Core Architecture

  • 🧠 Semantic Search: Fast vector embeddings via ChromaDB so agents can search by intent ("find authentication logic") rather than exact strings.

  • 🏗️ Structural Search: Native AST / LSP parsing. Enables exact definitions, references, and full file token structures for TypeScript/JavaScript.

  • ⏱️ Zero-Block Indexing: Background file ingestion so the event loop never freezes while your agents work.

  • 🔄 Live Cache Validation: A built-in watcher (chokidar) instantly invalidates the AST cache when files change on disk.

  • 🔌 Cloud / Local Ready: Runs locally via StdIO for desktop clients (Claude), or securely over HTTP (SSE) behind Bearer token auth for remote pipelines.


Getting Started

You will need the following dependencies:

  1. Node.js (v18+)

  2. An API Key: Set OPENAI_API_KEY, GEMINI_API_KEY, or VOYAGE_API_KEY as an environment variable.

  3. ChromaDB: A local vector database to store the code embeddings.

To start ChromaDB via Docker:

docker run -p 8000:8000 chromadb/chroma

Local Setup (e.g., Claude Desktop)

Since this is an MCP server, it is typically launched by your AI client rather than run manually.

To connect it to Claude Desktop, open your configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on Mac or %APPDATA%\Claude\claude_desktop_config.json on Windows) and add this configuration:

{
  "mcpServers": {
    "codebase-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "codebase-indexer-mcp",
        "<ABSOLUTE_PATH_TO_CODEBASE>"
      ],
      "env": {
        "OPENAI_API_KEY": "sk-your-openai-key-here"
      }
    }
  }
}

Note: Replace OPENAI_API_KEY with GEMINI_API_KEY or VOYAGE_API_KEY if you are using a different provider.

Cloud Setup (SSE / HTTP)

To host the indexer for remote agents, you can run it over HTTP by providing a PORT environment variable:

PORT=3000 API_KEY=your-secret-token npx codebase-indexer-mcp <ABSOLUTE_PATH_TO_CODEBASE>

Remote agents can then connect securely using the Bearer token (your-secret-token) at http://localhost:3000/sse.


Related MCP server: codemogger

🛠️ Use Cases

  1. Deterministic Refactoring I pass the agent a high-level task. It uses semantic_search to map the neighborhood (e.g., finding the "billing provider"), and then strictly enforces get_references to track every upstream caller. It ensures cross-file edits are safe before opening a PR.

  2. Automated Code Reviews in CI/CD A pipeline agent semantically verifies new pull requests against our existing architectural patterns. It leverages structural lookups to definitively prove that upstream dependencies weren't silently broken.

  3. Auditing Technical Debt Instead of manually tracing legacy code, I deploy a background worker. It pulls the get_file_structure to outline massive legacy files, and traces deprecated API usage through exact AST definitions without ever running out of context.

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    -
    quality
    C
    maintenance
    A graph-powered code intelligence engine that indexes codebases into a structural knowledge graph to provide AI agents with deep context on function calls, types, and execution flows. It offers local, zero-dependency tools for hybrid search, impact analysis, and dead code detection across Python, JavaScript, and TypeScript projects.
    Last updated
    724
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    A local code indexing and search library that enables AI agents to perform semantic and keyword searches across codebases using tree-sitter and SQLite. It provides tools for indexing projects and finding precise code definitions without requiring external APIs, Docker, or server infrastructure.
    Last updated
    1,430
    332
    MIT
  • A
    license
    -
    quality
    B
    maintenance
    Indexes codebases and lets AI agents retrieve precise code snippets (functions, classes, routes) instead of reading entire files, reducing token usage and improving accuracy.
    Last updated
    39
    7
    MIT

View all related MCP servers

Related MCP Connectors

  • Give your AI agent a persistent map of your project's structure, dependencies, and bugs.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

  • Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.

View all MCP Connectors

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/y1hanh/codebase-indexer-mcp'

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