# kg

A local MCP server that keeps project memory as a knowledge graph of nodes, edges and facts. Your assistant picks that memory back up in later sessions instead of starting over.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 9
- Author: nnar1o
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/nnar1o/kg
- Updated: 2026-08-05
- HTML: https://affpapa.org/en/nevibecode/mcp/kg

## What it does

\`kg` stores what your assistant knows about a project as a graph, not as a pile of text chunks. Nodes carry types, edges carry relations such as `DEPENDS_ON` or `TRIGGERS`. Graphs live in `~/.kg/graphs` as `*.kg` files, so you can read them, diff them and commit them to git.

You drive it with SCL, short verb-first commands: `find`, `get`, `add`, `modify`, `connect`, `list nodes`, `stats`, `use <graph>`. Node ids follow `<type>:snake_case`, and the type comes from the id prefix.

There is also an automatic path. Point it at a directory and it walks the tree, recognises common file types, pulls symbols out of Rust, Java, JavaScript/TypeScript, Python and C/C++, and builds `GDOC` and `GSEC` nodes with section content for markdown-like documents. That generated index sits apart from your hand-built graph and is safe to leave out of git.

Setup is a local stdio MCP server: add a `command` entry pointing at the absolute path of `kg-mcp` in your client config, then restart the client. The project is in beta, so APIs still move and bugs are expected — don't treat the current graph format as frozen. Install through `cargo install kg-cli`, the install script, or a prebuilt binary from GitHub Releases.

## Requirements
- Needs: a prebuilt binary from the repository releases

## Install

### Claude Code (native platform)

**Install**
- The MCP registry has no launch command for it: see the repository README

## When to use it
- carry architecture decisions across assistant sessions
- map an unfamiliar repository without modelling it by hand
- look up a node by text and inspect its edges
- tie processes, dependencies and rules together with explicit relations
- see which facts the graph is still missing

## Example prompts
- Build the `payments` graph from `docs/payments/overview.md` and `docs/payments/retries.md`, and only add facts grounded in those documents.
- Inspect the `payments` graph: how does payment authorization work and what triggers retries?
- Add a node `concept:smart_fridge` with a description and connect it to `process:compressor_control` with `TRIGGERS`.

## Similar
- [VelesDB Memory](https://affpapa.org/en/nevibecode/mcp/velesdb-memory.md) — MCP server · ★ 100
- [Graphiti Local](https://affpapa.org/en/nevibecode/mcp/graphiti-local.md) — MCP server · ★ 5
- [Turbo Quant Memory](https://affpapa.org/en/nevibecode/mcp/turbo-quant-memory.md) — MCP server · ★ 9
- [Mneme Memory](https://affpapa.org/en/nevibecode/mcp/mneme-memory.md) — MCP server · ★ 182
- [lean-memory](https://affpapa.org/en/nevibecode/mcp/lean-memory.md) — MCP server · ★ 43
- [Reverie](https://affpapa.org/en/nevibecode/mcp/reverie.md) — MCP server · ★ 69

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
