Skip to main content
Glama

atlas

一个只跑在本机的个人知识库:把 Markdown、文本和 PDF 收进来,用 BM25 + 向量混合检索 把它们翻出来,再通过命令行、本地网页或 MCP 交给别的 agent 用。

没有云服务,没有 embedding API,没有上传。

它能做什么

能力

说明

摄取

.md / .markdown / .txt / .pdf,目录递归,按 mtime + size 跳过没变的文件

切块

按 Markdown 标题分段,长段落按标点断开,块之间保留 120 字重叠

关键词检索

SQLite FTS5 的 BM25,中文靠 trigram 也能命中

向量检索

256 维哈希词袋向量:英文按词、中文单字 + 相邻二元组,子线性词频 × IDF,余弦相似度

混合排序

0.6 × 排名归一化 BM25 + 0.4 × 余弦,兼顾精确词和「意思接近」

本地网页

搜索框、三种模式、每次查询的耗时与分数明细

MCP server

stdio JSON-RPC 2.0,暴露 search_knowledge 与 get_document

向量这块不是神经网络嵌入——是零依赖、可复现的哈希词袋。它擅长找「用词相近」的片段,不擅长跨语言或深层语义;想要真正的语义检索,可以换成本地小模型,接口就在 atlas/embed.py。

Related MCP server: doc-rag-mcp

安装

pipx install git+https://github.com/AAAAyano206/atlas

快速开始

atlas init
atlas ingest ~/notes ~/Documents/读书笔记
atlas search "SQLite 的 WAL 模式"
atlas ask "为什么 FTS5 的中文要配 trigram?"
atlas docs
atlas stats

search 的结果带三列分数:

 1. /Users/ayano/notes/sqlite.md  § WAL
    SQLite 的 WAL 模式让读写不互相阻塞…… 
    score 0.812 · bm25 1.000 · cosine 0.531

本地网页

atlas serve          # http://127.0.0.1:8766

给 agent 用(MCP)

atlas mcp

在支持 MCP 的客户端里这样配:

{
  "mcpServers": {
    "atlas": { "command": "atlas", "args": ["mcp"] }
  }
}

客户端 initialize 之后会看到两个工具:

  • search_knowledge:{ "query": "...", "limit": 8, "mode": "hybrid" }

  • get_document:{ "path": "notes/sqlite.md" } 或 { "id": 3 }

命令

命令

作用

atlas init

建库(默认 ~/.atlas/atlas.db,ATLAS_DB 或 --db 可改)

atlas ingest <路径…>

摄取文件或目录,-v 看逐文件结果

atlas search <词> [-n N] [--mode hybrid|bm25|vector]

搜索

atlas ask <问题>

摘录式回答(取最相关的几段)

atlas docs / atlas show --id N

列文档 / 看全文

atlas stats

文档与片段数

atlas rm --id N / --path P

删一篇

atlas serve [--port 8766]

本地网页

atlas mcp

MCP server

数据与隐私

  • 只有 ~/.atlas/atlas.db(或你指定的位置)一个文件,删掉就等于没发生过。

  • 不联网、不调用任何模型;PDF 用 pypdf 本地解析。

  • 网页与 MCP 都只监听 127.0.0.1 / stdio。

开发

git clone https://github.com/AAAAyano206/atlas
cd atlas
uv venv --python 3.9 && uv pip install -e ".[dev]"
pytest -q

模块:chunk(切块)、embed(向量)、db(SQLite/FTS5)、ingest(摄取)、search(混合检索)、web(网页)、mcp(MCP)、cli。

发版

改 atlas/__init__.py 与 pyproject.toml 的版本号,写 CHANGELOG.md,然后:

git tag -a v0.2.0 -m "atlas v0.2.0"
git push origin v0.2.0

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Serves an offline knowledge base — an aggregated corpus of reference works plus a RAG index over them and the user's own documents — to any local AI model over MCP. Enables offline assistants such as Open WebUI, OpenCode, or Jan to ground answers in searchable, provenance-tracked local content without any network connection.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Turns any folder of PDFs, markdown, and text files into a local, queryable knowledge base exposed as an MCP server. Enables MCP-compatible agents to semantically search indexed documents, retrieve relevant passages with source and relevance scores, list or reindex documents, and inspect cache and token usage — instead of reading whole files into context.
      1
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes a local hybrid (vector + BM25) index of scattered notes, docs, PDFs, and chat logs to AI hosts like Claude Desktop, Cursor, and Cline, letting agents search and get cited answers. It publishes a set of tools, resources, and prompts so any MCP-compatible client can query that knowledge base with section-level citations.
      -