loci

io.github.IvenKooLab由 GitHub 账号 IvenKooLab 发布v0.4.0更新于 Nov 3, 2026

Cross-session memory and hybrid RAG over your notes and docs. Local-first, with cited answers.

概览

AI 生成的概览

本地优先的知识库 MCP 服务器,让助手在笔记和文档中检索、提问并保存记忆,答案附带引用。

可以做什么
  • 在已索引的笔记和文档中检索与提问,融合向量与 BM25 检索,并给出 file > section 形式的引用
  • 保存或撤回长期记忆,并把知识整理成 wiki 式笔记
  • 查看笔记之间的链接与抽取出的关系
  • 查看各编码代理的记忆、按工具统计和摘要笔记
  • 查看索引统计并触发源目录重新索引
  • 提供笔记资源,以及简报、学习计划和矛盾检查等提示词
适用场景
适合你手上有笔记、项目文档或 Obsidian 库,希望助手能找回其中的决策并给出可核查引用的场景。也适合让多个 AI 工具指向同一实例,共享上下文与长期记忆。
运行要求
以 stdio 方式在本地运行 loci-mcp 命令,来自 PyPI 包 loci-rag;Python 版需 Python 3.11 以上,也可用 Rust 二进制。需要一个通过 LOCI_HOME 指定的实例目录,其中包含带 [llm] 和 [embed] 配置的 config.toml,嵌入端点须支持 /embeddings。API 密钥可通过 BRAIN_LLM_API_KEY 和 BRAIN_EMBED_API_KEY 提供。PDF、Word 与 OCR 支持需额外安装。
安装前请注意
嵌入与对话请求会发送到你配置的服务商,除非使用本地端点,否则笔记内容会离开本机。服务器可写入和删除长期记忆,并重新索引源目录。Web 控制台默认给匿名回环客户端管理员权限;在反向代理或隧道后应关闭 local_admin 并配置基于角色的令牌。不要把凭据放进同步仓库。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[loci — shared memory for your AI tools]

English · 简体中文 · 繁體中文 · 日本語 · 한국어

[CI] [PyPI] [MCP server] [Python 3.11+] [Rust native build] [MIT license]

Turn scattered notes, project docs and agent memories into a knowledge base you can search and ask questions about — as an MCP server, from your terminal, or in the browser.

loci combines vector search with BM25 and returns answers with file > section citations. Your files and index stay on your machine. Embedding and chat requests go to the providers you configure; local endpoints can keep the entire workflow offline.

MCP is the point. Mount loci-mcp in Claude Desktop, Cursor, Cline or any other MCP host and your assistant gets the whole knowledge base as tools. The console and a desktop shell are alternate front-ends to the same index — you never need them.

Quick start · MCP setup · Web console · Usage guide · 中文说明

[loci console — synthetic-data demo]

Actual console UI with fictional demo data. No personal knowledge base, account or API key is connected; counts are illustrative.

Dark theme preview

[loci console — dark theme, fictional demo data]

What you can do

NeedHow loci helps
Find a decision buried in your notesHybrid search across directories, with tag, path and date filters
Ask a question and check the evidenceAnswers cite source sections; optional claim-by-claim verification
Carry context between AI toolsMCP tools share one instance; durable memories are Markdown files
See what each coding agent remembersHarness discovery, file browsing, per-tool stats and digest notes
Manage the knowledge base visuallyBuilt-in Web console for search, Q&A, memories, indexing and audit

Markdown, text, HTML, org-mode and chat exports work out of the box. Optional extras add PDF, Word and OCR support. Keep using your existing note editor or Obsidian vault.

Quick start

Try it first, with nothing configured

bash
pip install loci-ragloci demo

loci demo copies six fictional notes into ./loci-demo-notes, chunks them and answers three example questions — cited down to file > section — with no config.toml, no API key and no network. It is keyword-only (BM25, the same ranking hybrid search fuses with vector hits), which is exactly the point: something runs before you commit a key. Add [embed] later and the same index goes hybrid.

[loci demo — real output, bundled fictional notes]

Actual loci demo output on the bundled sample notes; paths shortened, timings vary.

Index your own notes

Requires Python 3.11+. Start from source so the example configuration is available:

bash
git clone https://github.com/IvenKooLab/loci.gitcd locipython -m pip install -e .cp config.example.toml config.toml

Edit config.toml: fill in [llm] and [embed], and change [[sources]].path to your notes directory. The embedding endpoint must support /embeddings; chat and embeddings may use different providers.

bash
loci ingestloci search "deployment decisions"loci ask "What did we decide about deployment, and why?"

Already have a configuration? Install the package with python -m pip install loci-rag and set LOCI_HOME to your instance directory. For optional document support, use python -m pip install 'loci-rag[pdf,docx]'.

API keys can be supplied through BRAIN_LLM_API_KEY and BRAIN_EMBED_API_KEY. After changing the embedding model, rebuild with loci ingest --force.

Using Obsidian? See the vault setup, privacy and compatibility guide.

Web console

bash
loci serve-http

Open 127.0.0.1:8765/ui to browse harness memories, search, ask questions, edit shared notes and inspect indexing activity. Clicking a search result opens an evidence pane with the passage it was cut from — the file > section citation, checkable without leaving the console. The console includes Chinese/English and light/dark switches; no frontend build is required.

By default, anonymous loopback clients have admin access. Behind a reverse proxy or SSH tunnel, set [http] local_admin = false and configure role-based tokens. See access control.

For DeepSeek Harness, loci-dsh brings search, Q&A and memory capture into the Harness workbench through the same HTTP backend.

Connect your AI tools

Point each MCP client at the same LOCI_HOME so they share the same config, index and memory files:

json
{  "mcpServers": {    "loci": {      "command": "loci-mcp",      "env": { "LOCI_HOME": "/absolute/path/to/your/loci-instance" }    }  }}

Use an absolute executable path if your client cannot find loci-mcp. The instance directory must contain your config.toml.

MCP toolsPurpose
brain_search · brain_askRetrieve excerpts or get cited answers
brain_remember · brain_forgetStore or retract durable memories
brain_links · brain_graphExplore note links and extracted relations
brain_wiki · brain_harnessConsolidate knowledge and inspect agent memories
brain_stats · brain_ingestInspect and refresh the index

The server also exposes note resources and briefing, study-plan and contradiction-check prompts. See the MCP guide for details.

[loci-mcp — real JSON-RPC session]

Actual loci-mcp output: initialize, tools/list and prompts/list on the real binary.

Native build (Rust)

The same retrieval pipeline and MCP surface, with no Python runtime to install — one binary, and the index is a single SQLite file instead of a database directory:

bash
cargo build --release -p loci-cli     # in native/./target/release/loci-mcp --config ~/.loci/config.toml./target/release/loci gui             # the same console, served natively

Status: retrieval, a subset of MCP tools, harness discovery, migration and the console are ported. Harness file browsing and digest generation remain Python-only. See native/ for what is ported and the fidelity tests that pin it (chunking, the frozen default tokenizer, the CJK bigram decoy case, RRF, and incremental ingest).

The two builds keep separate store formats (SQLite vs ChromaDB directory), but they exchange data: export from Python with loci export, import in the native build with loci import, which refuses to mix embedding spaces unless you pass --force.

A small daily workflow

bash
loci watch                            # keep changed documents indexedloci remember "Use staging for demos" --title "Demo environment"loci search "demo environment" --tag memoryloci ask "How should I prepare a demo?" --verifyloci harness                          # inspect detected agent memories

Indexing is incremental. Notes stay readable as Markdown. For multiple machines, sync source files and memory notes, then rebuild each local index; keep credentials out of the repository.

See a retrieval session

[loci terminal demo]

The usage guide includes the original bilingual retrieval example and a small evaluation you can rerun against your own corpus.

Documentation

GuideCovers
Usage guide / 中文指南Commands, filters, harness setup, access control and local models
Configuration exampleProvider settings, source directories and runtime options
ArchitectureModules and the retrieval pipeline
Changelog · RoadmapReleased changes and planned work
ContributingDevelopment conventions and offline testing

loci uses the OpenAI-compatible SDK and ChromaDB, with no LangChain or LlamaIndex dependency. BM25, loaders and the MCP transport are implemented in the project.

bash
python -m pip install -e '.[dev,pdf]'pytest  # offline tests; no API keys required

Find loci on Glama, ModelScope and awesome-mcp-servers. Source: GitHub · Gitee. Licensed under MIT.

来源:README.md,提交 190121d

工具

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

版本历史

1
  1. v0.4.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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