KGraphBLOCK
The Compiler-Aware Operating System Kernel CodeGraph Engine for Token-Efficient Structural Codebase Retrieval
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
English | 中文
Compiler-Aware Kernel Graph Engine · MCP Tool Service
Config-aware · Macro-resolved · Function-pointer-callable · SQLite-native
Design Document →
KGraph indexes what the **compiler** sees — not what the parser guesses.
Why KGraph?
Kernel code is not regular code. It lives behind #ifdef CONFIG_*, inside SYSCALL_DEFINE* macros, behind file_operations function-pointer tables that tree-sitter can't follow. Existing tools (codegraph, semcode) parse syntax — KGraph parses compilation truth.
Result: LLM agents find root-cause paths in 3 tool-calls / ~1.5k tokens where grep-based workflows burn 10k+ tokens and scatter across irrelevant branches.
Workflow at a Glance
Once your kernel has a compile_commands.json, the whole setup is three commands:
# 1. Install kgraph (bundles Python 3.10 + scip-clang, Linux x86-64 only) npm install -g @ajksunkang-aios/kgraph # 2. Wire kgraph's MCP server into your AI agents (auto-detects what's installed) kgraph install # 3. Build the code graph for this kernel (run inside the kernel source dir) cd /path/to/linux kgraph init .
That's it. Restart your agent and ask it structural questions about the kernel — it calls KGraph's MCP tools instead of grepping.
> What functions call ext4_file_read_iter? > What implements ->read_iter across the kernel? > Show me the
738c5cd9d214OBSERVED · 2026-10-11Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add kgraph-eval --env ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} --env ANTHROPIC_AUTH_TOKEN=${ANTHROPIC_AUTH_TOKEN} -- uvx kgraph-eval{
"mcpServers": {
"kgraph-eval": {
"command": "uvx",
"args": [
"kgraph-eval"
],
"env": {
"ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
"ANTHROPIC_AUTH_TOKEN": "${ANTHROPIC_AUTH_TOKEN}"
}
}
}
}Exposed tools (13)
13 read · 0 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
call_path | read | |
find_callees | read | |
find_callers | read | |
find_ops_impls | read | |
find_references | read | |
find_type_definition | read | |
get_callchain | read | |
get_function_body | read | |
get_neighborhood | read | |
get_struct_layout | read | |
get_symbol | read | |
index_status | read | |
search_symbols | read |
Trust audit
BLOCKgrade D · trust 69/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | WARN |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (3 observation(s))
- Network
- declared (13 observation(s))
- Shell
- declared (4 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (13)
console.error('KGraph: secure download failed (cert verification), retrying with --insecure (-k)...');scip_pb2.cpython-310.pyc
if curl --fail --silent "http://127.0.0.1:$PORT/api/status" >/dev/null; then
if ! curl --fail --silent "http://127.0.0.1:$PORT/api/status" >/dev/null; then
URL="http://127.0.0.1:$PORT/graph.html?demo=video"
"> ΔF1 = B−A (positive = more accurate). "
"Δtokens/Δcalls = % saved by B (negative % = B cheaper). "
"| tier | n | ΔF1 | Δtokens | Δcalls |",
name: Eval (KBench retrieval)
- name: Run eval (KBench retrieval A/B)
pytest
protobuf, mcp, trio
thirdparty/scip-clang
Gates applied: no_behavioural_pass.
738c5cd9d214full audit observations/trust-audit/mcp-server/ajksunkang-aios__kgraph.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-11 | 738c5cd9d214 | BLOCK | D | 69 | first audit |
Questions
What is the KGraph MCP server?
The Compiler-Aware Operating System Kernel CodeGraph Engine for Token-Efficient Structural Codebase Retrieval
What tools does KGraph expose?
13 in total: 13 read-only, 0 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is KGraph safe to connect to an agent?
No — not without reading the findings first. The audit graded it D (69/100) and found 1 critical or high issue in the source. Each one is listed on this page with the file and line it is on.
What credentials does KGraph need?
It reads ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How current is this page?
The grade is for one exact copy of the source (738c5cd9d214), read on 2026-10-11. The repository is watched and re-audited when it changes.