Context7
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Code map and memory for AI coding agents: key functions, line ranges, callers, why code changed.
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
ต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"knock": {
"command": "uvx",
"args": [
"knock-mcp",
"serve",
"--repo",
".",
"--toolset",
"map"
]
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add knock -- uvx knock-mcp serve --repo . --toolset mapวางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"knock": {
"command": "uvx",
"args": [
"knock-mcp",
"serve",
"--repo",
".",
"--toolset",
"map"
]
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"knock": {
"type": "stdio",
"command": "uvx",
"args": [
"knock-mcp",
"serve",
"--repo",
".",
"--toolset",
"map"
]
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 6 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub HasanGilani ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.2.0) เข้า registry 3 วันที่ผ่านมา
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Python (uv) ในเครื่องด้วย
ในหมวดเดียวกันมี 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 รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
On a large codebase, Claude Code spends much of each session searching and reading files, often through a sub-agent, before it answers you. knock gives it a map of the code up front: the functions that matter, their exact line ranges, and who calls what. It runs on your machine and needs no API key.
Same question, 8 runs each, on a 4,776-file repo: median cost $0.42 → $0.25 (−40%). Without knock, Claude spawned a sub-agent in 5 of 8 runs. With knock, in none.
claude mcp add knock -- uvx knock-mcp serve --repo . --toolset map
Full code map for Python and JavaScript/TypeScript; functions and classes for Go, Rust, Java and more.
Two real Claude Code sessions on Saleor , abridged: each side's median-cost run out of three. Results vary between runs and repositories; on a small, well-known repo the difference was within noise. Full numbers: docs/benchmark.md · how it was measured: the write-up .
Every new chat with a coding agent starts with amnesia. To answer *"where is X?"* or *"how do we deploy?"* it greps, opens big files, reads them... and next session it does it all over again.
| 😩 Without knock | 😎 With knock | |
|---|---|---|
| First move | grep around, open whole files, or spawn a sub-agent to explore | one map call: the relevant code as a skeleton with exact line ranges |
| Text the agent reads | ~27,000–118,000 characters per question | ~4,300 characters per question |
| Finds "why did we do it this way?" | only if it opens the right doc | decisions and their rationale come back with the answer |
| Remembers yesterday's bug hunt | ❌ | ✅ agents save findings with remember |
| Knows when its notes are outdated | — | ✅ every answer says fresh or stale |
Median characters per task on the held-out benchmark (targeted-grep and grep-and-read baselines vs knock). Fewer characters ≠ an identical cut in your bill; see the FAQ .
You set knock up once, then you just keep using your AI agent as usual. The agent talks to knock in the background; you never have to run knock commands day to day.
From inside the project you work on:
claude mcp add knock -- uvx knock-mcp serve --repo . --toolset map
This uses uv, which downloads and runs knock for you. No uv? Run pipx install knock-mcp (or pip install knock-mcp), then claude mcp add knock -- knock serve --repo . --toolset map.
--toolset map gives the agent three tools (map, open, remember) and is the setup measured in the results below. Leave it out to get the original eight tools.
That's the whole setup. The next time you open Claude Code in that project, knock reads the project and builds its notes automatically. This takes a few seconds for a small project and a minute or two for about 5,000 files; after that it only re-reads files that changed.
[!TIP]
Add this line to your project's
CLAUDE.mdso the agent uses knock when it pays off:
*"Before exploring the repo (how/why questions, unclear bugs, changes across modules, code you can't find with one search), call knock's
maptool with your task. For small edits you can locate with one grep, skip it. Save non-obvious findings withremember."*
In our recordings, knock saved money on investigations in a large codebase but added a small cost to quick edits, so this line matters.
Ask your agent what you'd always ask. Here's what changes behind the scenes:
| You type | What the agent does |
|---|---|
| *"Add rate limiting to the login endpoint"* | asks knock first and gets the login handler's file:line, your middleware conventions and the test setup, then opens only those lines |
| *"Why do we use Postgres instead of Mongo?"* | gets the decision and its reasoning from your docs or ADRs, with a link to the source |
| *"Tests fail with a Redis error, any idea?"* | finds the finding a previous session saved: *"login tests need Redis running"* |
| *(after it figures something out)* | saves it with remember, so tomorrow's session already knows |
Nothing to maintain: when code changes, knock updates its notes, and flags anything that may be outdated.
🖥️ Optional: use knock yourself from the terminal
You never *need* these, but they're handy.
| Command | When you'd use it |
|---|---|
knock map "where are expired checkouts cleaned up?" | see the same code map your agent gets |
knock open SomeClass.method | exact code for a symbol, with its callers and callees |
knock context "how do we deploy?" | ask a question yourself, e.g. when onboarding onto an unfamiliar repo |
knock search "rate limit" | look up what knock knows about a topic |
knock status | check how fresh the notes are and how much knock knows |
knock index . | update the notes right now; your agent normally does this for you |
knock index . --full | rebuild everything from scratch after a huge refactor |
knock forget . --yes | delete everything knock stored about this project |
Want knock to ignore some files? List them in a .knockignore file (same format as .gitignore).
👥 Setting it up for a whole team
Commit a .mcp.json file to your repo, and every teammate's Claude Code picks up knock automatically (each person needs knock installed):
{
"mcpServers": { "knock": { "command": "knock", "args": ["serve", "--repo", ".", "--toolset", "map"] } } }
Each person's notes live on their own machine. Sharing findings across a team isn't supported yet (see Status below).
flowchart LR
A["📁 Your repo code · docs · configs · git log"] -->|"knock index (only changed files)"| B["🗂️ Notes each one points to file + lines + hash"] B --> C[("💾 SQLite on your machine")] C -->|"map"| D["🤖 Your agent"] D -->|"open / Read (verify the real lines)"| A D -->|"remember (save what it learned)"| C
file:line pointers, instead of reading whole files.With --toolset map (recommended):
| Tool | What it does | |
|---|---|---|
map | 🗺️ | Use when you'd otherwise explore. The code relevant to a task as a skeleton: signatures, exact line ranges, what each function uses and catches, who calls it; plus the history behind it and the docs that matter. For change requests, a lighter version with the exact range to read and existing code to copy. |
open | 📄 | Exact, line-numbered code for a function or class with its callers and callees, a line range, or a file's skeleton |
remember | ✍️ | Save a finding for future sessions; it's flagged automatically when the cited files change |
The original 8-tool set (default without --toolset map )
| Tool | What it does | |
|---|---|---|
get_context | 🔎 | Start here when you'd otherwise explore. A ranked package for a task: notes, functions with file:line, files worth opening, related commits, and honest "nothing known about X" gaps |
search_knowledge | 📚 | Search notes, filtered by category (architecture, decision, workflow, …) or folder |
get_knowledge | 🧾 | One note with full provenance: where it came from, when, and whether it is still current |
get_source | 📄 | Read real lines from a file, with secrets redacted. Only files knock indexed |
record_knowledge | ✍️ | Save a finding; duplicates are merged, contradictions flagged |
update_knowledge_status | ✅ | Mark a note verified, or wrong |
get_repository_status | 🩺 | How fresh the index is, plus counts and stats |
refresh_repository | 🔄 | Re-index changed files (takes milliseconds, no AI calls) |
👀 See a real example session (8-tool set, Flask)
On Flask, an agent is told: *"sessions signed with an old key in SECRET_KEY_FALLBACKS are rejected after rotating SECRET_KEY"*.
src/flask/sessions.py:317: SecureCookieSessionInterface.get_signing_serializertests/test_basic.py:374: test_session_secret_key_fallbacksfb54159861 secret key rotation: fix key list ordering and e13373f838 enable secret key rotation {"category": "debugging",
"content": "get_signing_serializer builds the key list as SECRET_KEY_FALLBACKS followed by SECRET_KEY; ordering was fixed in fb54159.", "sources": [{"path": "src/flask/sessions.py", "start_line": 317, "end_line": 335}]}
The next session gets it instantly. If `sessions.py` changes, the note is flagged **stale**.
Measured with a reproducible benchmark: 12 engineering tasks per repo, covering architecture, finding a feature, deployment, bug investigation, design rationale and following conventions.
Held-out repo (full-stack-fastapi-template; knock was never tuned on it):
| Approach | Found the needed facts | Characters read | Tool calls |
|---|---|---|---|
| 🐢 grep + read 3 files | 9 / 12 | 1,215,570 | 72 |
| 🐇 targeted grep + read snippets | 7 / 12 | 328,206 | 60 |
| 🚪 knock | 10 / 12 | 88,962 | 17 |
More numbers, and the fine print
ตัดมาแค่ช่วงต้น อ่านต่อใน repo