Kg

by nnar1o

Not rated
GitHub

About

Lightweight knowledge graph Browse Kg MCP Server for Claude, Cursor, VS Code, and other AI agents.

Details

Author
nnar1o
Categories
Database, Knowledge Base, Other

Setup

Install Kg in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/nnar1o/kg

Follow the installation instructions in the repository README, then restart your MCP client.

Beta- APIs may still change and some bugs are still expected.

kggives your AI assistant persistent, structured, editable project memory stored locally as a knowledge graph.

Instead of relying only on document chunk retrieval, you can keep architecture, decisions, incidents, rules, dependencies, and workflows in a graph that is readable, reviewable, and Git-friendly.

Use it when you want your assistant to understand an existing project across sessions — not start from zero every time.

- Persistent memory— keep project knowledge between conversations
- Structured, not fuzzy— inspect nodes, edges, facts, and gaps directly
- Editable and reviewable— store graphs as.kgfiles with readable diffs
- Local-first— your project memory stays on your machine in git-friendly format
- Works with MCP clients— connect it as a local stdio MCP server

Classic RAG is good for retrieving text chunks from documents.

- stable project memory instead of repeated retrieval
- explicit facts, relations, and dependencies
- graph updates during real work with the assistant
- something you can inspect, version, diff, and improve over time

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

You can also download a ready binary from GitHub Releases.

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

- restart your AI client,
- confirm thekgMCP server is available,
- start using the prompts below.

Full MCP setup and reference:docs/mcp.md

kgunderstands short, verb-first English commands (SCL — Simple Command Language). The active graph is resolved from your config automatically.

find "compressor defrost" get concept:refrigerator add concept:smart_fridge --name "Smart Fridge" --description "Connected refrigerator" modify concept:smart_fridge --importance 0.9 remove concept:old_idea connect process:compressor_control TRIGGERS process:auto_defrost disconnect process:compressor_control TRIGGERS process:auto_defrost list nodes stats use fridge help

Format:<type>:snake_case— e.g.concept:fridge,bug:door_seal,process:compressor_cycle.

HAS USES STORED_IN TRIGGERS CREATED_BY AFFECTED_BY AVAILABLE_IN DOCUMENTED_IN DEPENDS_ON TRANSITIONS DECIDED_BY GOVERNED_BY READS_FROM

- Flags go after positional args. Quote multiword values.
- Separate commands with;or newlines. Lines starting with#are comments.
- Useuse <graph>to switch graphs within a script.
- Canonicalkg <graph> node find ...commands still work as fallback.
- Full SCL reference:
docs/scl.md

This is the first workflow for a new project: ask the assistant to create or extend a graph from your documentation.

By default, graphs are stored in~/.kg/graphsas.kgfiles.

You are connected to kg-mcp. Project graph name: payments Build or extend this graph from the project documentation I provide. Use payments as the graph name for all graph operations. Only add facts grounded in source material. If an important fact is missing and can be inferred safely from the provided docs, update the graph. If something is ambiguous, ask or record it as a note instead of inventing facts.
Use kg-mcp to build or extend the payments graph from these documents: - docs/payments/overview.md - docs/payments/retries.md - docs/payments/providers.md Only add facts grounded in the documents. If something is ambiguous, keep it out of the graph or record it as a note. When you finish, summarize what was added, what remains unclear, and what document should be ingested next.

Longer prompt for this workflow:docs/ai-prompt-graph-from-docs.md

For a ready-made repository example, runcargo run --bin repo-exampleto generaterepo-example.kgfrom this repo.

kgcan turn an existing folder into a graph automatically. It scans the directory tree, recognizes many common file types, extracts symbols for Rust, Java, JavaScript/TypeScript, Python, and C/C++, and keeps the generated structure separate from the manual graph.

For markdown-like documents, it also creates document (GDOC) and chapter (GSEC) nodes with section content.

It is a fast way to get a useful map of a codebase or workspace without modeling everything by hand. The generated index is local, refreshable, and safe to ignore in git.

This generatesrepo-example.kgfrom this repository as a local demo.

Ask the Assistant About Facts in the Graph

Once the graph exists, the normal workflow is to ask the assistant to inspect it and answer questions from it.

Use kg-mcp to inspect my existing payments graph. I want to understand: - how payment authorization works, - what triggers retries, - which external providers are involved, - which datastore reads and writes are part of the flow. If the graph is missing critical information, say exactly what is missing.

- "What rules control retries in thepaymentsgraph?"
- "Which systems write to the orders datastore?"
- "What is missing or weak in this graph?"
- "Which nodes and edges explain the authorization flow?"

Add or Update Facts Through the Assistant

You can also ask the assistant to improve the graph while you work.

Use kg-mcp to review my existing payments graph. Find: - missing important nodes, - weak descriptions, - missing facts, - suspicious or low-value edges. Apply safe improvements where possible. Only add facts grounded in the graph, the provided docs, or the current discussion. If something is ambiguous, leave it out or add a note. When you finish, summarize: - what was wrong, - what you changed, - what still needs manual review.

This works best when your main system prompt or project prompt already tells the assistant which graph belongs to the project.

You are connected to kg-mcp. Project graph name: payments. Use this graph for relevant reads and updates in this project. If you notice important missing information that is grounded in the available docs or conversation context, update the graph as part of your work. If uncertain, ask or add a note instead of inventing facts.

kglooks for.kg.tomlin the current directory and its parent directories.

backend = "json" # json backend writes native .kg files by default graph_dir = ".kg/graphs" graph_dirs = ["../shared-graphs", "../team-graphs"] nudge = 20 user_short_uid = "dev_01" [graphs] payments = "graphs/payments.kg"

- backend = "json"is the default and prefers.kgtext graphs.
- backend = "redb"stores graphs in.dbfiles.
- graph_dirsets a primary graph directory.
- graph_dirsadds extra directories scanned bykg listand graph resolution.

The default graph directory is~/.kg/graphs.

- keep the main.kggraph files in git,
- ignore generated sidecars and local operational files,
- treat backup snapshots and event logs as local machine history unless you explicitly want to version them.

.kglog .kgindex .event.log .migration.log .bak .bck..gz

- .kgis the main graph file you usually want to review and commit,
-
.kglogis a local access/feedback log,
- .kgindexis a generated local index,
-
.event.logis a local append-only change timeline,
- .bakis the previous on-disk version from the last write,
-
.bck..gzare periodic compressed backup snapshots,
-
.migration.logis a migration report when older graphs are converted.

*.kgis git-friendly and intentionally structured to make diffs readable and merges easier when several people work on the same graph.

To generate an interactive HTML view of a graph:

kg graph payments export-html --output payments.html

You can keep the generated HTML as a shareable visual snapshot of the current graph.

- docs/mcp.md- MCP setup and tool reference
-
docs/ai-prompt-graph-from-docs.md- longer prompt for document ingestion
-
docs/build-graph-from-docs.md- graph-building workflow from docs
-
docs/troubleshooting.md- common issues

For questions or feedback:nnar10@proton.me

Neo4j graph database server (schema + read/write-cypher) and separate graph database backed memory

Query a hybrid graph (Neo4j) and vector (Qdrant) database for powerful semantic and graph-based document retrieval.

Connects to Neo4j graph databases with ability to use GDS functions ( when available), a read only mode , and set the sample size for schema detection

Integrate the Neo4j graph database with clients through natural language interactions.

MCP server for Neo4j — run Cypher queries, explore schema, and inspect database info over stdio

Interact with and explore graph data in a Neo4j database.

Cognitive memory for AI agents - persistent semantic memory with knowledge graph and adaptive recall

A server for interacting with ArangoDB, a native multi-model database system.

Manage graph-based data models, schemas, and ontologies with CoreModels. 16 MCP tools for visual data modeling with full JSON Schema support.

Query and interact with FalkorDB graph databases using AI models.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.