Context7
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Intelligent code knowledge graph for AI coding agents — 71% cheaper, 72% faster
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
CODEMESH_PROJECT_ROOTต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
],
"env": {
"CODEMESH_PROJECT_ROOT": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add codemesh --env CODEMESH_PROJECT_ROOT='ใส่ค่าของคุณ' -- npx -y @pyalwin/codemeshเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"codemesh": {
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
],
"env": {
"CODEMESH_PROJECT_ROOT": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"codemesh": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@pyalwin/codemesh"
],
"env": {
"CODEMESH_PROJECT_ROOT": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
CODEMESH_PROJECT_ROOT envค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub pyalwin ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.1.2) เข้า registry 7 เดือนที่ผ่านมา
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย
ในหมวดเดียวกันมี Context7, Codebase Memory, Exa
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
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
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.
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.
| Mode | Alamofire | Excalidraw | VS Code | Swift Compiler[^swift] | 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 |
| Mode | Alamofire | Excalidraw | VS Code | Swift[^swift] | 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 |
| Mode | Alamofire | Excalidraw | VS Code | Swift[^swift] | 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 |
| Mode | Alamofire[^alamo] | 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 |
| 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 Compiler[^swift] | $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.
npm install -g @pyalwin/codemesh
Or run directly without installing:
npx -y @pyalwin/codemesh --help
Build from source
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.
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
Codemesh offers two ways to integrate with AI agents:
Option A: MCP Server (structured tool calls)
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; ifHash avoids 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 checkBest for: Opus, structured workflows, enrichment/write-back
Option B: CLI Mode (via Bash — zero MCP overhead)
No MCP config needed. The agent calls codemesh directly via Bash:
export CODEMESH_PROJECT_ROOT=/path/to/your/project
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
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
| 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 |
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
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.
Claude Code (CLI)
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" } } } }
Claude Desktop (macOS / Windows app)
Edit claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json%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 — stop the agent from wandering your codebase
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
ตัดมาแค่ช่วงต้น อ่านต่อใน repo