kg-cli 0.1.6

A knowledge graph CLI tool for managing structured information
Documentation

kg — local knowledge graph CLI

CI Release License

Beta — This software is in active development. APIs may change.

A fast CLI for managing JSON knowledge graphs with native MCP server support. Built for LLM chat workflows: plain text by default, --json for machines.

Features

  • Graph operations — create, query, merge, diff, backup
  • Search — full-text and BM25 ranking
  • MCP server — first-class tool integration for AI assistants
  • TUI browser — interactive graph exploration
  • Quality analysis — find missing descriptions, facts, edge gaps
  • Import — CSV, JSON, Markdown/YAML frontmatter

Install

Quick (curl)

  curl -sSL https://raw.githubusercontent.com/nnar1o/kg/master/install.sh | sh

From crates.io

cargo install kg-cli

From source

cargo install --path . --locked --root ~/.local
export PATH="$HOME/.local/bin:$PATH"

Or build manually: cargo build --release

Quick start

kg init                           # print init prompts
kg create mygraph                 # create graph
kg mygraph node find query        # search
kg mygraph node get id             # view node
kg mygraph node add id --type Concept --name "Label"
kg mygraph edge add source REL target
kg mygraph quality missing-facts  # quality check

See kg --help for all commands.

MCP Server

The primary way to integrate with LLMs:

./target/release/kg-mcp

Config for OpenCode/Claude Desktop:

{
  "mcpServers": {
    "kg": {
      "command": "/path/to/kg-mcp"
    }
  }
}

Tools: node find/get/add/modify/remove, edge add/remove, stats, check, audit, quality, export-html, feedback, and a shell-like kg tool for multi-command scripts.

See docs/mcp.md for full docs.

Documentation

Detailed guides in docs/: