AI 코딩 에이전트에게 지속적이고 쿼리가 가능한 코드 지식 그래프를 제공하여 토큰 사용량을 줄이고 코드베이스 탐색 속도를 높입니다.
다른 이름 pyalwin/codemesh, @pyalwin/codemesh
- 스타
- 0
- Tools
- 10
- 다운로드, 30일
- —
- 최신 버전
- 0.1.2
- 마지막 커밋
- 2026년 11월 2일
- 라이선스
- MIT
Codemesh MCP란?
Codemesh은(는) MCP server입니다. AI 코딩 에이전트에게 지속적이고 쿼리가 가능한 코드 지식 그래프를 제공하여 토큰 사용량을 줄이고 코드베이스 탐색 속도를 높입니다. 10개 도구를 제공합니다. 예: codemesh_map, codemesh_source, codemesh_inspect.
프로젝트 README에서 생성된 요약
Codemesh MCP server 정보
Codemesh는 AI 코딩 에이전트에게 지속적이고 쿼리가 가능한 지식 그래프를 제공하여 코드베이스 탐색을 간소화합니다. 프로젝트를 SQLite 기반 그래프로 인덱싱함으로써, 에이전트는 기존의 grep 방식이나 파일 전체를 읽는 방식에서 발생하는 높은 토큰 비용 없이 심볼, 디렉토리, 파일을 탐색할 수 있습니다. 이 접근 방식은 도구 호출 횟수와 모델로 전송되는 불필요한 컨텍스트 양을 크게 줄여줍니다.
개발자는 MCP 설정에서 프로젝트 루트를 구성하여 Claude Desktop, Claude Code 또는 Cursor와 같은 MCP 호환 클라이언트에 이 MCP server를 통합할 수 있습니다. 이 서버는 네이티브 도구 사용을 위한 구조화된 MCP server 모드와 셸 기반 워크플로우를 위한 CLI 모드의 두 가지 주요 모드를 제공합니다. 특히 에이전트가 탐색 작업에 토큰을 낭비하는 경우가 많은 대규모 코드베이스에서 유용합니다.
단순한 탐색을 넘어, 이 시스템은 에이전트가 요약 및 노트를 그래프에 다시 저장할 수 있는 쓰기 기능(write-back)을 지원합니다. 이를 통해 한 세션 동안 습득한 지식을 향후 상호작용에 활용할 수 있어, 시간이 지남에 따라 코드베이스에 대한 지능이 축적됩니다.
활용 사례
- 1복잡한 디렉토리 구조 탐색에이전트가 매핑 도구를 사용하여 특정 파일이나 디렉토리를 찾기 위해 저장소 계층을 브라우징할 수 있습니다.
- 2특정 심볼의 소스 코드 추출에이전트가 파일 전체를 읽는 대신 특정 함수나 클래스에 대한 정확한 소스 코드만 요청할 수 있습니다.
- 3코드 의존성 체인 분석개발자가 에이전트에게 호출 체인을 따라가며 시스템의 서로 다른 부분이 어떻게 상호작용하는지 분석하도록 요청할 수 있습니다.
- 4학습된 코드베이스 지식 유지에이전트가 파일에 대해 학습한 요약 내용을 그래프에 다시 기록하여 향후 세션에서 활용할 수 있도록 돕습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
Codemesh MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 Codemesh MCP 설치
$ claude mcp add codemesh -- npx -y @pyalwin/codemeshCursor에 Codemesh MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
]
}
}
}VS Code에 Codemesh MCP 설치
.vscode/mcp.json
{
"servers": {
"codemesh": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
]
}
}
}VS Code CLI에 Codemesh MCP 설치
$ code --add-mcp '{"name":"codemesh","type":"stdio","command":"npx","args":["-y","@pyalwin/codemesh"]}'Claude Desktop에 Codemesh MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
]
}
}
}Codex에 Codemesh MCP 설치
$ codex mcp add codemesh -- npx -y @pyalwin/codemeshCodex config.toml에 Codemesh MCP 설치
~/.codex/config.toml
[mcp_servers.codemesh] command = "npx" args = ["-y", "@pyalwin/codemesh"]
Gemini CLI에 Codemesh MCP 설치
$ gemini mcp add -s user codemesh npx -- -y @pyalwin/codemeshGemini settings.json에 Codemesh MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
]
}
}
}Codemesh MCP 도구 10
README에서 감지됨codemesh_mapcodemesh_sourcecodemesh_inspectcodemesh_hydratecodemesh_answercodemesh_explorecodemesh_tracecodemesh_enrichcodemesh_workflowcodemesh_status
| codemesh_map | — | |
| codemesh_source | — | |
| codemesh_inspect | — | |
| codemesh_hydrate | — | |
| codemesh_answer | — | |
| codemesh_explore | — | |
| codemesh_trace | — | |
| codemesh_enrich | — | |
| codemesh_workflow | — | |
| codemesh_status | — |
구성
CODEMESH_PROJECT_ROOTAbsolute path to the local codebase to index
| 이름 | 설명 | 유형 |
|---|---|---|
| CODEMESH_PROJECT_ROOT | Absolute path to the local codebase to index |
자동 검사
2026년 11월 13일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음통과
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨통과
- 모델에 대한 숨겨진 지침 없음통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음통과
README
GitHub에서 보기Codemesh
Intelligent code knowledge graph for AI coding agents
71% cheaper, 72% faster, 82% fewer tool calls vs baseline Grep+Read
on 6 real-world repos (Sonnet 4.6) — from a single codemesh index.
Benchmarks · Quick Start · Integrations · Write-Back · How It Works · API Reference · Full Results
The Problem
AI coding agents waste 40-80% of their tokens on discovery — grepping through files, reading irrelevant code, and rebuilding context they've already seen in previous sessions.
On a 600-file codebase, a typical exploration task involves 10+ file reads before the agent even knows what's relevant.
Before: Agent → Grep → 50 matches → Read 10 files → Understand → Work
After: Agent → codemesh_map → expand chosen branches → read exact symbols → Work
Codemesh is an MCP server that gives agents a persistent, queryable knowledge graph. The graph gets smarter over time: agents write back what they learn, so the next session starts informed.
Benchmarks
Benchmarked on 6 real-world codebases (Alamofire, Excalidraw, VS Code, Swift Compiler, pydantic-validators, pydantic-basemodel) with Claude Sonnet 4.6, compared alongside baseline and graph-based approaches for context.
Full methodology, per-repo breakdowns, and pairwise comparisons: docs/benchmark-results.md | Early pydantic evals
These historical runs used the earlier answer-first workflow. The map-first navigation workflow described below is evaluated in an exploratory Pydantic pilot; the figures in this section should not be read as its measured performance.
Cost
| Mode | Alamofire | Excalidraw | VS Code | Swift Compiler1 | pydantic-validators | pydantic-basemodel | Avg |
|---|---|---|---|---|---|---|---|
| Baseline | $0.54 | $0.89 | $0.21 | $0.83 | $1.32 | $0.78 | $0.76 |
| Codemesh MCP | $0.25 | $0.21 | $0.16 | $0.23 | $0.33 | $0.13 | $0.22 |
| Codemesh CLI | $0.67 | $0.51 | $0.16 | $0.83 | $1.00 | $0.18 | $0.56 |
| Codegraph | $0.37 | $0.56 | $0.57 | $0.74 | $0.29 | $0.19 | $0.45 |
Time
| Mode | Alamofire | Excalidraw | VS Code | Swift1 | pydantic-v | pydantic-b | Avg |
|---|---|---|---|---|---|---|---|
| Baseline | 180s | 191s | 87s | 199s | 352s | 232s | 207s |
| Codemesh MCP | 78s | 45s | 35s | 87s | 72s | 32s | 58s |
| Codemesh CLI | 226s | 177s | 62s | 227s | 235s | 51s | 163s |
| Codegraph | 134s | 180s | 192s | 199s | 75s | 60s | 140s |
Tool calls (agent turns)
| Mode | Alamofire | Excalidraw | VS Code | Swift1 | pydantic-v | pydantic-b | Avg |
|---|---|---|---|---|---|---|---|
| Baseline | 31 | 48 | 12 | 29 | 84 | 65 | 45 |
| Codemesh MCP | 9 | 5 | 3 | 14 | 14 | 3 | 8 |
| Codemesh CLI | 30 | 32 | 12 | 56 | 64 | 9 | 34 |
| Codegraph | 31 | 35 | 44 | 44 | 20 | 12 | 31 |
Quality (1–10, LLM-as-judge)
| Mode | Alamofire2 | Excalidraw | VS Code | Swift Compiler | pydantic-validators | pydantic-basemodel | Avg |
|---|---|---|---|---|---|---|---|
| Baseline | n/a | 9 | 8 | 7 | 2 | 9 | 7.0 |
| Codemesh MCP | 9 | 9 | 7 | 8 | 7 | 7.8 | 7.9 |
| Codemesh CLI | 9 | 7 | 7 | 9 | 1 | 8.4 | 6.9 |
| Codegraph | 8 | 9 | 8.7 | 8 | 8 | 9 | 8.4 |
Cost savings: Codemesh MCP vs Baseline
| Repo | Baseline | Codemesh MCP | Cost saved | Time saved |
|---|---|---|---|---|
| Alamofire | $0.54 | $0.25 | −54% | −57% (180s → 78s) |
| Excalidraw | $0.89 | $0.21 | −76% | −76% (191s → 45s) |
| VS Code | $0.21 | $0.16 | −24% | −60% (87s → 35s) |
| Swift Compiler1 | $0.83 | $0.23 | −72% | −56% (199s → 87s) |
| pydantic-validators | $1.32 | $0.33 | −75% | −79% (352s → 72s) |
| pydantic-basemodel | $0.78 | $0.13 | −83% | −86% (232s → 32s) |
| Average | $0.76 | $0.22 | −71% | −72% |
[!NOTE] Codemesh MCP achieves the lowest cost and fastest time of any mode tested — 71% cheaper and 72% faster than baseline on average across 6 repos, using 82% fewer tool calls (8 vs 45). Quality is comparable to baseline (7.9 vs 7.0); Codegraph edges Codemesh on quality (8.4) but at roughly double the cost ($0.45 vs $0.22). Every repo shows cost and time savings — including the comprehension-heavy queries (Excalidraw, pydantic-basemodel) that regressed in prior builds of codemesh.
Quick Start
1. Install
npm install -g @pyalwin/codemesh
Or run directly without installing:
npx -y @pyalwin/codemesh --help
git clone https://github.com/pyalwin/codemesh.git
cd codemesh
npm install && npm run build
npm link
Verify the install:
codemesh --versionshould print the package version.
2. Index your project
cd /your/project
codemesh index
The default index and retrieval path uses one SQLite database in .codemesh/.
It does not generate embeddings or require a vector database. Existing vector
artifacts from older runs are left untouched but are not used by this path.
Indexed 656 files
Symbols found: 16733
Edges created: 33266
Duration: 10009ms
PageRank: 13843 nodes scored
3. Choose your mode
Codemesh offers two ways to integrate with AI agents:
Add to your Claude Code MCP config (~/.claude/mcp-servers.json or project .mcp.json):
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": ["-y", "@pyalwin/codemesh"],
"env": {
"CODEMESH_PROJECT_ROOT": "/path/to/your/project"
}
}
}
}
The agent gets native MCP tools:
codemesh_map— browse one level of the indexed repository or follow a linkcodemesh_source— read a revision-checked source view by symbol ID;ifHashavoids repeat deliverycodemesh_inspect— inspect an exact symbol and its direct calls with bounded, exact source blockscodemesh_hydrate— verify saved symbol references and reopen exact source after a handoffcodemesh_answer— optional ranked context assemblycodemesh_explore— search, context (multi-target), impactcodemesh_trace— follow call chainscodemesh_enrich/codemesh_workflow— write backcodemesh_recall— retrieve notes and workflows with freshness statuscodemesh_status— health check
Best for: Opus, structured workflows, enrichment/write-back
No MCP config needed. The agent calls codemesh directly via Bash:
export CODEMESH_PROJECT_ROOT=/path/to/your/project
# Navigate one level at a time, then read a selected symbol:
codemesh explore map
codemesh explore map --node 'dir:src'
codemesh explore map --node 'file:src/server.ts'
codemesh explore source 'symbol:src/server.ts:createServer'
codemesh explore source 'symbol:src/server.ts:createServer' --mode preview
codemesh explore inspect 'symbol:src/server.ts:createServer' --depth 1 --max-symbols 4 --compact
codemesh explore hydrate --references '[{"id":"symbol:src/server.ts:createServer","bodyHash":"HASH"}]' --compact
# Other exploration commands:
codemesh explore search "request flow"
codemesh explore context Source/Core/Session.swift Source/Core/Request.swift
codemesh explore trace Session.request --depth 5
codemesh explore recall --path src/server.ts
codemesh remember --path src/server.ts --summary "Server tool registration" --session my-task
Exploration and write commands return JSON to stdout. No MCP server process is required.
Best for: Sonnet/Haiku, speed-sensitive workflows, simpler setup
Which mode should I use?
| MCP Server | CLI Mode | |
|---|---|---|
| Setup | MCP config file | Just export CODEMESH_PROJECT_ROOT |
| Invocation | Persistent MCP process | CLI subprocess |
| Enrichment | Native codemesh_enrich tool |
codemesh remember ... |
| Retrieval | Shared SQLite-backed handlers | Same handlers and JSON data |
| Recommended | Hosts with reliable MCP tool use | Deterministic shell workflows |
4. Use it
The agent can choose a path through the persistent graph before reading code:
You: "Find how pydantic handles validation"
Agent calls: codemesh_map({})
gets: immediate repository directories and files, each with an ID
Agent calls: codemesh_map({ node: "dir:pydantic" })
gets: immediate files and subdirectories
Agent calls: codemesh_map({ node: "file:pydantic/main.py" })
gets: top-level symbols, including BaseModel
Agent calls: codemesh_map({ node: "symbol:pydantic/main.py:BaseModel" })
gets: methods, including model_validate
Agent calls: codemesh_source({ id: "symbol:pydantic/main.py:BaseModel.model_validate" })
reads: only the selected symbol's source
Agent calls: codemesh_enrich({ path: "pydantic/functional_validators.py",
summary: "Primary V2 validator API..." })
saves: summary for next session
Client Integrations
Codemesh speaks the Model Context Protocol, so any MCP-compatible client can use it. Paste one of the snippets below, restart the client, and the codemesh_* tools show up in the agent's toolbox.
Add to ~/.claude/mcp-servers.json (user-wide) or .mcp.json (project-local):
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": ["-y", "@pyalwin/codemesh"],
"env": {
"CODEMESH_PROJECT_ROOT": "/absolute/path/to/your/project"
}
}
}
}
Edit claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": ["-y", "@pyalwin/codemesh"],
"env": {
"CODEMESH_PROJECT_ROOT": "/absolute/path/to/your/project"
}
}
}
}
Restart Claude Desktop. Codemesh's tools will appear in the tool picker (hammer icon).
Cursor reads .cursor/mcp.json per project (or ~/.cursor/mcp.json for all projects):
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": ["-y", "@pyalwin/codemesh"],
"env": {
"CODEMESH_PROJECT_ROOT": "${workspaceFolder}"
}
}
}
}
Open Settings → MCP, confirm codemesh is green, then mention it in a prompt (@codemesh how does auth work?) to nudge the agent toward graph queries instead of recursive Grep.
Add to ~/.continue/config.json under experimental.modelContextProtocolServers:
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@pyalwin/codemesh"],
"env": {
"CODEMESH_PROJECT_ROOT": "/absolute/path/to/your/project"
}
}
}
]
}
}
Agent Write-Back: the graph that gets smarter
Every other code-intelligence tool indexes your repo once and hands the agent a read-only view. Codemesh lets the agent teach the graph as it works — summaries, workflows, and cross-concept links persist across sessions and survive re-indexing.
// Session 1 — agent reads unfamiliar code, then writes back what it learned.
codemesh_enrich({
path: "pydantic/functional_validators.py",
summary: "Primary V2 validator API. `@field_validator` wraps "
+ "`_decorators.FieldValidatorDecoratorInfo`; `mode='before'|'after'` "
+ "toggles pre/post-coercion execution. Extends BaseValidator.",
sessionId: "validation-investigation-1"
})
// Session 1 — agent traces a multi-file flow, records the path.
codemesh_workflow({
name: "pydantic field validation",
description: "Request → BaseModel.__init__ → SchemaValidator → field_validator",
files: [
"pydantic/main.py",
"pydantic/_internal/_model_construction.py",
"pydantic/functional_validators.py"
]
})
// Session 2 (days later) — another agent navigates the same indexed code.
codemesh_map({ node: "file:pydantic/functional_validators.py" })
// → returns stable symbol IDs without reading their bodies.
codemesh_explore({ action: "context", path: "pydantic/functional_validators.py" })
// → includes the earlier agent's concept alongside indexed relationships.
The graph now knows things no static analyzer could infer: why a file matters, which files move together, what a maintainer called a concept. Re-indexing rebuilds the structural layer (files, symbols, imports, calls) but preserves every enrichment — entries only go stale when their referenced files change.
See codemesh_enrich and codemesh_workflow under MCP Tools.
How It Works
┌──────────────────────────────────┐
│ Knowledge Graph │
│ │
│ ┌──────────┐ ┌───────────────┐ │
│ │Structural│ │ Semantic │ │
│ │ (auto) │ │ (agents) │ │
│ │ │ │ │ │
│ │ files │ │ summaries │ │
│ │ symbols │ │ workflows │ │
│ │ imports │ │ concepts │ │
│ │ calls │ │ enrichments │ │
│ └──────────┘ └───────────────┘ │
│ │
│ ┌──────────┐ ┌───────────────┐ │
│ │ Git │ │ Search │ │
│ │ Intel │ │ │ │
│ │ │ │ FTS5 (exact) │ │
│ │ hotspots │ │ Trigram (fuzzy)│ │
│ │ co-change│ │ notes + cache │ │
│ │ churn │ │ PageRank │ │
│ └──────────┘ └───────────────┘ │
│ │
│ SQLite only │
└────────────┬──────────────────────┘
│
┌────────────┴──────────────────────┐
│ MCP Server / CLI (shared core) │
│ │
│ map · source · answer · explore │
│ trace · recall · enrich · workflow │
│ status │
└────────────────────────────────────┘
Structural layer (automatic) — Tree-sitter parses your code into files, symbols (functions, classes, methods), and relationships (imports, calls, extends). Rebuilt on each index.
Semantic layer (agent-built) — As agents work with your code, they write back summaries and workflow paths. These survive re-indexing and accumulate across sessions. Invalidated when referenced files change.
MCP Tools
| Tool | Purpose | Example |
|---|---|---|
codemesh_map |
Bounded, one-level navigation through directories, files, symbols, and graph links | codemesh_map({ node: "dir:src", limit: 30 }) |
codemesh_source |
Exact source for a selected symbol ID | codemesh_source({ id: "symbol:src/auth.ts:login" }) |
codemesh_inspect |
Exact source for a symbol plus direct call evidence, within a byte and symbol budget | codemesh_inspect({ id: "symbol:src/auth.ts:login", depth: 1 }) |
codemesh_hydrate |
Verify saved symbol references and reopen exact source after context loss | codemesh_hydrate({ references: [{ id: "symbol:src/auth.ts:login", bodyHash: "..." }] }) |
codemesh_answer |
Optional ranked context assembly with source snippets | codemesh_answer({ question: "How does auth work?" }) |
codemesh_explore |
Search, context (multi-target), impact analysis | codemesh_explore({ action: "search", query: "auth" }) |
codemesh_trace |
Follow call chains with source code | codemesh_trace({ symbol: "login", depth: 5 }) |
codemesh_enrich |
Write back what you learned for future sessions | codemesh_enrich({ path: "src/auth.py", summary: "..." }) |
codemesh_workflow |
Record multi-file workflow paths | codemesh_workflow({ name: "login flow", files: [...] }) |
codemesh_status |
Graph health check | codemesh_status() |
Footnotes
-
Swift Compiler's codemesh index failed to complete (indexer regression on 30k+ file codebases — see known issues). The codemesh numbers above reflect agent behavior with an empty retrieval graph, falling back to Read + LSP — still ahead of baseline, but unrepresentative of codemesh's capability on a properly-indexed Swift repo. ↩ ↩2 ↩3 ↩4
-
Baseline for Alamofire hit a judge error (score recorded as 0 but not meaningful); excluded from the Baseline average. ↩
Codemesh MCP 질문
Codemesh MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add codemesh -- npx -y @pyalwin/codemesh를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
Codemesh MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
Codemesh MCP는 어떤 도구를 제공하나요?
10개 도구를 제공합니다. 예: codemesh_map, codemesh_source, codemesh_inspect, codemesh_hydrate, codemesh_answer.
Codemesh가 AI 에이전트의 성능을 어떻게 향상시키나요?
에이전트가 파일을 검색(grep)하거나 불필요한 코드를 읽는 대신, 저장소를 매핑하고 정확한 심볼을 읽을 수 있도록 지속적인 지식 그래프를 제공합니다.
Codemesh를 사용하려면 벡터 데이터베이스가 필요한가요?
아니요, .codemesh/ 디렉토리에 위치한 단일 SQLite 데이터베이스를 사용하며 임베딩을 생성하지 않습니다.