mcp_initLABSCO SUMMARY
The doc-to-code join is what separates this from a symbol index.
Plenty of tools tell an agent where a function is defined. Answering which files implement a given requirement, and which documentation covers a file, needs documents in the same graph as the code - which is the bet here. The read-only split is the other detail worth planning for: serve queries from one binary and let a separate worker do the writing.
What it is
An indexer that builds a graph of a codebase in Postgres and serves it over MCP. Beyond symbols and dependencies it holds documentation, requirements and workflow concepts, so a question can cross from a written requirement to the code that implements it.
What you get
- Find a file, locate a function definition, and search code elements by name or type
- Call graphs, direct dependencies and dependents, and an impact radius bounded by hop count
- A focused review context - a subgraph plus a structured prompt - for a change you are about to make
- Concept and semantic search over the graph, with a compressed context read when the full context is too large
- Documentation indexed alongside the code, so a requirement ID joins to the files that implement it and back again
- Environment-aware filtering, conflict detection across environments, dead-code and diff-impact analysis
- An agent diary written and read back across sessions, and graph snapshots you can export
Requirements
Postgres with pgvector is the only storage engine and has to be up first; the bundled compose file puts it on port 5433 and LEANKG_PG_URL overrides the connection string. Then init, migrate and index the project. Docker serves MCP on port 9699; installing from source is cargo install leankg. In production the project splits into two binaries - a read-only MCP server that rejects mutating tools, and a worker that owns indexing, watching and embedding.
Setup effort
One command — cargo install leankg
USE CASES
Getting oriented in a repo you have never opened
Start with the overview context, then the architecture, before asking anything specific.
Judging what a change will break
Read the dependents and the impact radius within a hop limit, then pull a focused review context for the files that come back.
Answering which code satisfies a requirement
Index the documentation, then search by requirement and read the traceability both ways - requirement to files, file to docs.
Finding behaviour when you do not know the name
Search by concept and by meaning rather than by symbol, then narrow with a code search once a candidate appears.
Carrying context between sessions
Write what was learned into the agent diary and read it back at the start of the next run.
76 tools
Listed in project docs. Your client may show a different list.
mcp_indexmcp_index_docsmcp_installmcp_statusget_dependenciesget_dependentsget_impact_radiusdetect_changesget_review_contextget_contextctx_readexplain_nodeexport_graph_snapshotexport_htmlget_pr_impactresolve_with_lspget_overview_contextget_team_mapreport_query_outcomeagent_focusagent_diary_writeagent_diary_readget_cluster_skillfind_tunnelscheck_consistencytemporal_querytimelineget_god_nodesquery_graphshortest_pathget_call_graphsearch_codeconcept_searchgenerate_docfind_large_functionsget_tested_byget_files_for_docget_traceabilityget_doc_treeget_code_treefind_related_docsget_clustersrun_raw_queryget_nav_graphfind_routeget_screen_argsget_nav_callersget_service_graphadd_knowledgeupdate_knowledgedelete_knowledgesearch_knowledgeadd_annotationlink_elementadd_documentationadd_ontology_conceptadd_ontology_workflowdelete_ontology_conceptget_upcoming_changespromote_environmentquery_incidentsfind_env_conflictsget_service_contextsemantic_searchkg_contextkg_trace_workflowkg_ontology_statusontology_controlkg_semantic_contextembed_controlset_embed_modelget_architectureindex_prdget_feature_flowget_traceability_matrixBEFORE YOU INSTALL
What to know first
Tools you get
76 tools named in the project's documentation.
Requires
- cargo on PATH
- Postgres with pgvector, running before you index — the bundled compose file serves it on :5433 and LEANKG_PG_URL points at your own
INSTALLATION
Connect your client
Server setup
cargo install leankgLeanKG needs Postgres with pgvector already running: from a LeanKG checkout (git clone https://github.com/FreePeak/LeanKG.git), docker compose up -d postgres serves it on :5433, or set LEANKG_PG_URL to your own. Then, inside your project, run leankg init && leankg migrate && leankg index ./src before connecting a client.
MCP Clients
Claude Code
leankg connect claude-codeIf leankg is not installed yet, the project's installer puts the binary in place and does this wiring in one go: curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- claude
Cursor
leankg connect cursorIf leankg is not installed yet, the project's installer puts the binary in place and does this wiring in one go: curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- cursor
Codex
leankg connect codexGemini
leankg connect geminiIf leankg is not installed yet, the project's installer puts the binary in place and does this wiring in one go: curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- gemini
OpenCode
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- opencodeKilo
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- kiloAntigravity
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- antigravity