Skip to main content
MCP server CX Codex

kg — knowledge graph MCP server for Claude Code and Codex

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.

Open on GitHub

What kg 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.

What it helps with

  • 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 for the agent

  • 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.

How to install kg

Install

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

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about kg

How do I install kg in Claude Code?

Install the CLI with cargo install kg-cli. Then register kg-mcp as a local stdio MCP server in your client config, setting command to its absolute path, and restart the client.

What does kg do?

It gives your assistant persistent project memory as a graph of nodes, edges, facts and gaps. The graph stays on your machine in *.kg files you can read, edit and version.

How is kg different from RAG?

RAG retrieves text chunks from documents. kg keeps explicit facts, dependencies and relations that you update while working and read as structure rather than as a set of excerpts.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor