Lybrary

io.github.vibhu-dixit由 GitHub 账号 vibhu-dixit 发布v0.3.2更新于 Oct 24, 2026

Local codebase memory and repository code search for Codex, Claude Code, and MCP coding agents.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

Lybrary 是一个本地代码库记忆服务器,为仓库建立索引,让编程助手在读取整份文件前先搜索其中的函数、类和文件。

可以做什么
按精确符号或 SQLite 全文索引搜索已索引的仓库,语义嵌入搜索作为后备,返回排序后的路径、符号、行范围和带编号的摘录,可选返回完整片段内容。查看当前生效的仓库根目录和索引健康状况。触发增量、全量或按路径范围的重新索引。索引支持 Python、JavaScript、TypeScript、TSX、Go、Rust、Java、C 和 C++,后台文件监视器会刷新变更的文件。
适用场景
适合编程助手跨会话在同一仓库中工作、需要定位某个功能或追踪调用路径,而不想反复进行大范围搜索和读取大文件的场景。最适合使用受支持语言、且你愿意在本地建立索引的仓库。
运行要求
需要本地 Python 环境并从 PyPI 安装 lybrary 包,并在每个要索引的仓库中运行 lybrary start 以建立索引并启动文件监视守护进程。MCP 服务器以带 mcp 参数的 stdio 命令注册。首次索引可能下载本地嵌入模型;不需要 API 密钥或托管数据库。
安装前请注意
后台守护进程在终端关闭后仍会运行,直到被停止;它会监视并索引仓库文件,因此应在忽略文件中排除敏感路径。助手可通过 memory_update 触发重新索引,更改设置后需要全量重建。索引保留在本机,但助手可以读取索引中的源码摘录。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Lybrary,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Lybrary — local codebase memory for coding agents

Lybrary indexes a repository by code structure and gives Codex, Claude Code, and other MCP clients a searchable map of its functions, classes, and files. It runs locally, watches for changes, and lets an agent find relevant source lines before opening whole files.

PyPI · Documentation · Agent setup guide · Source · Issues

If you want a coding agent to set this up, ask it to find and install a local MCP code search tool for the repository and point it to the agent setup guide. The guide identifies the PyPI package, source repository, install command, and checks that confirm the agent is using this repo's index.

Start in any repository

Install once, then run lybrary start in each folder you want indexed:

bash
pip install lybrarycd /path/to/your/repolybrary startlybrary status

start creates .lybrary/ if needed, builds the index, and runs a file-watching daemon in the background. It keeps running after the terminal closes. Run lybrary stop in that repository to stop it. The first indexing run may download the local embedding model; later runs use the cache.

Each repository has its own index and .lybrary/config.toml. The index stays on your machine; no API key or hosted database is required.

Connect an agent

Register the MCP server once on your machine. Start your agent in an indexed repository, then ask it to call memory_status to confirm the root and chunk count.

Codex

Codex users can install Lybrary's setup skill from the repository's plugin marketplace:

bash
codex plugin marketplace add vibhu-dixit/lybrarycodex plugin add lybrary@lybrary

The plugin helps with setup; register the local MCP server separately:

bash
codex mcp add lybrary -- lybrary mcpcodex mcp list

Add this to that repository's AGENTS.md if you want Codex to use the memory consistently:

markdown
When .lybrary/index.db exists, use Lybrary memory_query before broad code searches or reading multiple files. Inspect the returned source paths and lines before editing. If the index is absent or the tool fails, use normal search.

Claude Code

Claude Code users can install the repository's plugin, which registers the MCP server and includes a setup skill:

bash
claude plugin marketplace add vibhu-dixit/lybraryclaude plugin install lybrary@lybrary

The Python package must also be installed with pip install lybrary. Or register the MCP server directly without the plugin:

bash
claude mcp add --scope user --transport stdio lybrary -- lybrary mcpclaude mcp list

In Claude Code, /mcp shows connection status. Put the same instruction in the repository's CLAUDE.md. Registration makes the tool available; the instruction helps the agent choose it when useful.

For another stdio MCP client, configure command lybrary with argument mcp. See the setup guides.

What the agent gets

memory_query checks exact symbols and an SQLite FTS5 index first. Strong lexical matches avoid loading the embedding model; semantic search remains a fallback when wording does not match the code. Its default response gives ranked paths, symbols, line ranges, and compact numbered excerpts. If a trace crosses a named call missing from the first result, query that symbol once. Set include_content=true when a full chunk is needed.

memory_status reports the active repository and index health. memory_update triggers incremental, full, or path-scoped re-indexing.

This can avoid repeated broad searches and large file reads, especially when the agent needs to locate a feature across sessions. Actual token use depends on the task, the agent's tool choices, and how much source it still needs to inspect. The benchmark guide explains how to compare complete runs rather than infer savings from the size of one response.

Make it fit your repo

Edit .lybrary/config.toml to choose the embedding model and device, chunk sizes, indexed languages, excluded paths, and file-watcher debounce. Add Git-style ignore patterns to .lybrary/ignore. Re-run lybrary index --full after changing settings that affect stored chunks or embeddings.

Supported parsers: Python, JavaScript, TypeScript, TSX, Go, Rust, Java, C, and C++. The indexer uses tree-sitter boundaries and refreshes changed files while the daemon is running.

CLI

CommandPurpose
lybrary startInitialize, index, and watch the current repository
lybrary stopStop its background daemon
lybrary statusShow daemon and index status
lybrary query "authentication flow"Search from the terminal
lybrary index --fullRebuild the index
lybrary logsShow daemon logs
lybrary mcpRun the stdio MCP server

If an agent starts above the indexed repository, pass that repository's absolute path as repo_root to the MCP tool, or start the agent inside it.

Measure the effect

From a source checkout, compare the same read-only question with and without Lybrary:

bash
python benchmark.py /path/to/indexed/repo "Trace how interview invitations are sent"

The script records both answers, tool calls, and total, cached, and uncached input tokens under .lybrary/benchmarks/. Check answer correctness first; one question does not establish typical savings.

Contribute

Issues and pull requests are welcome. For a local checkout:

bash
pip install -e ".[dev]"pytest

Lybrary is MIT licensed. See the changelog for releases.

来源:README.md,提交 7a59db4

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.3.2最新Oct 13, 2026
  2. v0.3.0Oct 13, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。