pi-codebase-memory-mcp

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

pi-codebase-memory-mcp

A pi package that bridges the codebase-memory-mcp server into pi as native tools. Gives your agent a fast, local tree-sitter knowledge graph of your repos — structural code search, call-path tracing, architecture overviews, and change-impact analysis in milliseconds, with far fewer tokens than file-by-file grepping.

Requirements

The codebase-memory-mcp binary installed locally:

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash

(macOS/Linux; Windows via install.ps1. Also on Homebrew, Scoop, AUR, npm, PyPI.) The binary is resolved from CBM_MCP_BIN, then ~/.local/bin/codebase-memory-mcp, then your PATH.

Install

pi install npm:pi-codebase-memory-mcp

Or try it without installing:

pi -e npm:pi-codebase-memory-mcp

What you get

  • Extension — spawns the local codebase-memory-mcp server over stdio, discovers its tools dynamically, and registers each as a pi tool with a cbm_ prefix.
  • cbm_connect tool — always available, so the agent can start (or restart) the server mid-session and pick up newly discovered tools immediately.
  • Safety gatecbm_delete_project pops a confirmation dialog before wiping a project's graph (disable with CBM_CONFIRM=off).
  • Skillcodebase-memory, teaching the agent the index → search → trace → query workflow.

Tools (discovered dynamically)

Indexing: cbm_index_repository, cbm_list_projects, cbm_delete_project, cbm_index_status

Querying: cbm_search_graph, cbm_trace_path, cbm_detect_changes, cbm_query_graph, cbm_get_graph_schema, cbm_get_code_snippet, cbm_get_architecture, cbm_search_code, cbm_manage_adr, cbm_ingest_traces

Example prompts

  • "Index this project."
  • "What calls ProcessOrder?"
  • "Find every function matching .*Handler.*."
  • "Give me an architecture overview of this repo."
  • "What's the blast radius of my current git changes?"
  • "Show the source for the Search function."

Configuration

Environment variable Default Purpose
CBM_MCP_BIN (auto) Absolute path to the codebase-memory-mcp binary (overrides auto-detection)
CBM_CONFIRM on Set to off to skip the confirmation dialog for cbm_delete_project

Notes

  • Tools are discovered at connection time; the set may change between server versions.
  • If the binary isn't installed when pi starts, pi still starts normally — install it, then ask the agent to connect (cbm_connect).
  • Index with an absolute repo_path. After the first index, a background watcher keeps the graph fresh.

License

MIT