# codemesh [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/pyalwin/codemesh  
**GitHub Stars:** 0  
**npm Downloads (last month):** 199  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codemesh

## Description
Intelligent code knowledge graph for AI coding agents — 71% cheaper, 72% faster

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "codemesh": {
    "command": "npx",
    "args": ["-y","@pyalwin/codemesh"],
    "env": {
      "CODEMESH_PROJECT_ROOT": ""
    }
  }
}
```

**Requires environment variables:** `CODEMESH_PROJECT_ROOT` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What codemesh MCP server does

The codemesh MCP server turns a repository into a queryable graph of files, symbols, and relationships. Agents can navigate the graph a level at a time, select relevant branches, and then request exact source for chosen symbols instead of repeatedly searching and reading broad file ranges. The index is stored in a `.codemesh/` directory within the project and uses SQLite for the default indexing and retrieval path.

The graph can also retain information learned during agent work. Notes and workflows can be written back, then retrieved later with freshness information. This makes the codemesh MCP server suitable for repeated work on the same codebase, especially when discovery is a significant part of each task.

The README reports tests on six repositories comparing MCP retrieval with baseline Grep and Read workflows. Across those historical runs, the MCP mode averaged lower cost, shorter elapsed time, and fewer agent turns. The results are benchmark observations rather than a guarantee for a particular repository; one documented Swift Compiler run did not complete indexing because of a regression affecting codebases with more than 30,000 files.

## How it works

First install the package and run `codemesh index` from the project directory. Indexing discovers files and symbols, creates graph edges, and calculates PageRank scores. The default path does not generate embeddings and does not require a vector database. Older vector artifacts may remain on disk, but they are not used by this retrieval path.

After indexing, configure an MCP client to start the package with `npx`. The server reads the project location from `CODEMESH_PROJECT_ROOT`. Agents can begin with a map view, follow links to files or symbols, and request bounded source blocks only after selecting a target. Source responses can be revision-checked, and a supplied hash can prevent sending the same content again.

A separate CLI mode is available through Bash. It returns JSON and does not require an MCP server process, so it can be used when an agent is already able to invoke local commands. The MCP mode is presented in the README as the structured-call option, while CLI mode is presented as the lower-overhead alternative.

## Setup and configuration

Install globally with:

```bash
npm install -g @pyalwin/codemesh
```

Alternatively, run it without a global installation using `npx -y @pyalwin/codemesh`. From the repository to analyze, execute:

```bash
codemesh index
```

Verify an installation with `codemesh --version`.

## Tools and capabilities

The codemesh MCP server exposes these documented tool groups:

- `codemesh_map` browses one repository level or follows a graph link.
- `codemesh_source` returns revision-checked source for a symbol and can avoid repeat delivery with `ifHash`.
- `codemesh_inspect` examines an exact symbol and direct calls using bounded source blocks.
- `codemesh_hydrate` validates saved symbol references and reopens source after a handoff.
- `codemesh_answer` optionally assembles ranked context.
- `codemesh_explore` supports search, multi-target context, and impact exploration.
- `codemesh_trace` follows call chains.
- `codemesh_enrich` and `codemesh_workflow` write information back to the graph.
- `codemesh_recall` retrieves notes and workflows with freshness status.
- `codemesh_status` checks server health.

The command-line interface provides corresponding exploration commands for maps, source, inspection, hydration, search, context, tracing, recall, and remembering notes.

## Limitations and notes

The documented benchmark figures come from six real-world repositories and use Claude Sonnet 4.6. They should not be treated as universal performance measurements. The README specifically notes that the Swift Compiler index failed to complete because of an indexer regression on a 30,000-plus-file codebase. A correctly indexed project may behave differently from that benchmark case.

The default path relies on one SQLite database rather than embeddings or a vector store. Existing vector files are not automatically removed, but they are ignored by the current default retrieval path. MCP and CLI are separate operating modes: MCP requires client configuration, while CLI mode uses local Bash commands instead.

_Full upstream README: https://allmcps.com/mcp/codemesh/readme_

