OpenViSTAI · Agents · Blockchain · Crypto
Menu
MCP & Tooling

LeanKG

LeanKG is a local-first developer tool that parses a codebase into a knowledge graph and exposes graph queries through an MCP server for AI coding tools. It extracts code elements and relationships such as functions, imports, calls, dependencies, tests and documentation, supporting focused search, context retrieval and change-impact analysis.

Independent OpenViST project profile, based on linked sources.

LeanKG — Local codebase indexing for MCP-connected coding tools
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use LeanKG when a supported MCP coding client needs targeted structural context from a local project, particularly for code navigation and dependency or impact questions.

Who it is for

  • Developers who want AI coding assistants to query structured context from a local codebase.
  • Teams or individuals investigating code relationships, test coverage or the likely reach of a change.

Documented uses

  • Find a function, class or file by name or code search.
  • Inspect call chains and direct dependencies or dependents.
  • Estimate which files may be affected by a change.
  • Retrieve focused context for a file and find tests associated with code.
  • Visualize a codebase dependency graph in the optional web interface.
Before you choose

Requirements & limits

The documented workflow runs locally and offers CLI and self-hosted use. Installation instructions include a shell installer, Cargo and building from source.

  • LeanKG is an indexing and MCP layer; an MCP-compatible AI coding tool is needed for the assistant-query workflow.
  • The documentation lists different extracted code structures across its supported languages.
  • Indexing can be scoped by path, language and exclusions, and can run incrementally.
  • The documentation reports that token savings vary by task and that complex impact or debugging queries may time out.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Index a codebase and connect an MCP client

Create a LeanKG index and configure a documented AI coding tool to query it through MCP.

Before you start

  • A project directory containing source files.
  • LeanKG installed and available as the leankg command.
  • An MCP-compatible client with a documented LeanKG configuration.

Steps

  1. Run leankg init in the project directory.

  2. Run leankg index ./src, adjusting the path or using documented language filters and exclusions as needed.

  3. Configure the MCP client to launch leankg mcp-stdio --watch using its documented configuration format.

  4. Start the MCP server through the client; LeanKG can initialize and index the current directory if a LeanKG project is not already present.

Expected outcome

The project has a local code index that the configured MCP client can query, with watch-based updates available.

Guide limitations

  • Supported structures differ by language.
  • Index freshness and query results depend on the project and task; the documentation notes complex impact or debugging queries may time out.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 November 2026
Original website title
LeanKG - Local-First Code Knowledge Graph | Surgical Context for AI Agents · Official homepage title · retained in its source language