LeanKG Knowledge Graph

v1.0.0Knowledge & Memorystable

LeanKG: Stop Burning Tokens. Start Coding Lean.

antigravityclaude-codeconcise-contextcursorgemini
Share:
190
Stars
0
Downloads
0
Weekly
0/5

What is LeanKG Knowledge Graph?

LeanKG Knowledge Graph is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to leankg: stop burning tokens. start coding lean.

LeanKG: Stop Burning Tokens. Start Coding Lean.

This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • LeanKG: Stop Burning Tokens. Start Coding Lean.

Use Cases

Token-efficient knowledge representation
Graph-based context management
Reduce context overhead
FreePeak

Maintainer

LicenseApache-2.0
Languagerust
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx leankg

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use LeanKG Knowledge Graph

LeanKG is a token-efficient knowledge graph MCP server built in Rust that indexes your codebase into a graph database and exposes 40 MCP tools for querying relationships, calculating blast radius, finding dependencies, and visualizing microservice topologies without flooding the AI context window. It supports both SQLite (for local single-developer use) and RocksDB (for team deployments), and integrates with Claude Code, Cursor, OpenCode, Gemini, Kilo, and Antigravity. Developers use LeanKG to give AI agents precise, structured knowledge about large codebases rather than pasting raw files, dramatically reducing token usage while improving code navigation accuracy.

Prerequisites

  • Rust 1.75+ (if building from source) or use the install script for pre-built binaries
  • macOS or Linux operating system
  • Docker and Docker Compose (optional, for RocksDB team deployment mode)
  • An MCP-compatible client: Claude Code, Cursor, Gemini CLI, OpenCode, or Kilo
1

Install LeanKG using the one-line install script

Use the official install script and specify your target client. Supported targets are: opencode, cursor, claude, gemini, kilo, antigravity.

curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- claude
2

Initialize LeanKG in your project

Run `leankg init` in your project root to set up the knowledge graph database. Then index your source directory.

cd /path/to/your/project
leankg init
leankg index ./src
3

(Optional) Enable file watching for continuous indexing

Start the file watcher to automatically update the knowledge graph as you edit code, keeping the graph in sync with your changes.

leankg watch ./src
4

Configure Claude Desktop manually (if not using the install script)

Add LeanKG as an MCP server in claude_desktop_config.json pointing to the leankg binary and your project database.

{
  "mcpServers": {
    "leankg": {
      "command": "leankg",
      "args": ["mcp"],
      "env": {
        "LEANKG_DB_ENGINE": "sqlite",
        "LEANKG_AUTO_INDEX": "1"
      }
    }
  }
}
5

Verify token savings and explore the knowledge graph

Use the LeanKG CLI to check your graph metrics and token savings, and optionally launch the web UI for visual exploration.

leankg metrics --json           # View token savings statistics
leankg impact src/main.rs --depth 3  # Calculate blast radius for a file
leankg web                      # Launch visual graph UI at localhost:8080

LeanKG Knowledge Graph Examples

Client configuration

Claude Desktop config for LeanKG with SQLite storage and auto-indexing enabled

{
  "mcpServers": {
    "leankg": {
      "command": "leankg",
      "args": ["mcp"],
      "env": {
        "LEANKG_DB_ENGINE": "sqlite",
        "LEANKG_AUTO_INDEX": "1",
        "LEANKG_CACHE_MAX_TOKENS": "500000"
      }
    }
  }
}

Prompts to try

Queries that leverage LeanKG's graph-based code knowledge to help with large codebases

- "What files would be affected if I change the UserService class?"
- "Show me the dependency graph for the authentication module"
- "Which functions call the database connection pool directly?"
- "What is the blast radius of modifying src/api/routes.rs?"

Troubleshooting LeanKG Knowledge Graph

'leankg: command not found' after installation

The install script places the binary in ~/.local/bin or ~/bin. Ensure this directory is in your PATH by adding `export PATH="$HOME/.local/bin:$PATH"` to your shell profile (.bashrc or .zshrc) and reloading with `source ~/.zshrc`.

Knowledge graph is out of date after code changes

Run `leankg index ./src` again to reindex, or start the file watcher with `leankg watch ./src` to keep the graph synchronized automatically as files change.

High memory usage with large codebases

Reduce the memory-mapped I/O window by setting `LEANKG_MMAP_SIZE` to a smaller value (e.g. 33554432 for 32 MiB), or switch to RocksDB storage with `LEANKG_DB_ENGINE=rocksdb` which handles larger datasets more efficiently.

Frequently Asked Questions about LeanKG Knowledge Graph

What is LeanKG Knowledge Graph?

LeanKG Knowledge Graph is a Model Context Protocol (MCP) server that leankg: stop burning tokens. start coding lean. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install LeanKG Knowledge Graph?

Follow the installation instructions on the LeanKG Knowledge Graph GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with LeanKG Knowledge Graph?

LeanKG Knowledge Graph works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is LeanKG Knowledge Graph free to use?

Yes, LeanKG Knowledge Graph is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Knowledge & Memory MCP Servers

Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "leankg": { "command": "npx", "args": ["-y", "leankg"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use LeanKG Knowledge Graph?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides