ragnarok

io.github.freyr由 GitHub 账号 freyr 发布v1.1.0更新于 Nov 6, 2026

Local RAG search over Obsidian vaults: SQLite hybrid search with local Ollama embeddings.

已验证STDIO仅桌面文件与存储知识与记忆

概览

AI 生成的概览

本地 MCP 服务器,为 Obsidian Markdown 笔记库建立索引,让 Claude Code 通过本地 Ollama 向量做混合检索。

可以做什么
  • 以向量加关键词的混合方式检索笔记,可按 vault、项目、领域、类型或归档状态过滤
  • 按提示找出相似的既有项目、列出某项目的全部笔记,并按状态列出进行中的项目
  • 打开某篇笔记或其中一节,附上链接与反向链接;长笔记先返回大纲
  • 查找包含 Jira 风格工单编号的笔记
  • 建立索引,并从 frontmatter 或路径规则推导笔记元数据,私有路径的笔记不返回
适用场景
适合把笔记、决策和过往工作放在 Obsidian 笔记库中,希望 Claude Code 在退回 grep 之前先找到这些上下文的人。尤其适合希望索引与向量都留在本机的 macOS 用户。
运行要求
在 macOS 上通过 Homebrew 本地运行。需要 Ollama 并拉取嵌入模型、Claude Code 以及 uv(用于安装 Python 3.12);包名为 ragnarok-mcp,通过 uvx 运行。初始化会写入 config.toml、把 Ollama 设为 brew 服务、建立索引并注册服务器。可选环境变量 RAGNAROK_HOME 指定主目录(默认 ~/.ragnarok)。
安装前请注意
初始化在把 Ollama 设为登录服务、以及替换已有 MCP 注册前会先询问;大型笔记库首次建索引耗时较长。私有笔记会被索引,但除非启用 allow_private,否则不会出现在工具结果中。backfill apply 会在备份后向笔记写入 frontmatter 键,应先审阅提案。凭据脱敏基于字面模式匹配,敏感信息仍可能进入索引。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ragnarok

Local RAG search over Obsidian vaults for Claude Code.

ragnarok indexes the Markdown notes of one or more Obsidian vaults on your computer. A local MCP server gives Claude Code search tools over the index. No note leaves the computer: the embeddings come from a local Ollama model, and the index is one SQLite file.

Features

  • Hybrid search. Each query runs a dense search (embeddings in sqlite-vec) and a keyword search (SQLite FTS5 with BM25). Reciprocal rank fusion joins the two lists. The unit of rank is the note, with its best section.
  • Heading chunks. The splitter cuts each note at its headings and joins very short sections.
  • Metadata from frontmatter or path. Each note gets a vault, a project, an area, a type, a status and ticket keys. The frontmatter gives these values first. For a note without them, path rules in the configuration give them.
  • Project search. find_projects finds the earlier projects that a prompt continues or resembles, also when the prompt does not name the project. list_project gives all notes of a project.
  • Always current. Each tool call first scans the vaults for changed notes (usually less than 100 ms) and embeds them. There is no watcher process.
  • Private notes. Notes under the configured private paths are in the index, but the server does not return them. Only the user can open them, with allow_private = true in the configuration.
  • Credential redaction. The indexer and open_note replace literal passwords, tokens and keys with [REDACTED]. The vault files do not change.
  • Frontmatter backfill. ragnarok backfill propose writes a proposal of the missing frontmatter keys for a vault. ragnarok backfill export writes a JSON file with the title and the first lines of each public note that needs a description (credentials removed). Claude writes the descriptions into one or more JSON files, {path: {"description": "...", "type": "..."}}. ragnarok backfill merge <vault> <file>... puts them into the proposal, removes credentials, reports each description of more than 25 words and each row with no description, and replaces a default type with a valid type from Claude. You examine the proposal, then ragnarok backfill apply makes a backup archive of the vault and adds only the missing keys.
  • Evaluation. ragnarok eval compares grep, keyword, dense and hybrid search on your own question sets. ragnarok eval agent compares a Claude Code agent with grep and an agent with the MCP tools.
  • One-command setup. ragnarok init installs the model and the index, and registers the MCP server in Claude Code when the Claude Code plugin does not give it. ragnarok doctor checks the setup.

Requirements

  • macOS with Homebrew. The setup uses brew services for Ollama.
  • Ollama: brew install ollama.
  • Claude Code.
  • uv: brew install uv. uv installs Python 3.12. setup.sh installs uv if it is missing.

Setup

ragnarok is on PyPI as ragnarok-mcp and in the MCP Registry as io.github.freyr/ragnarok.

With the Claude Code plugin (no clone)

In Claude Code:

text
/plugin marketplace add freyr/ragnarok-claude-plugin/plugin install ragnarok@ragnarok

Then in a terminal:

bash
uvx ragnarok-mcp init

The plugin starts the server with uvx ragnarok-mcp serve and adds the search guidance to each session. The home folder is ~/.ragnarok. To use a different folder, set RAGNAROK_HOME in the env of ~/.claude/settings.json and in your shell.

From a checkout

bash
git clone https://github.com/freyr/ragnarok.gitcd ragnarok./setup.sh                      # installs uv if needed, then runs `ragnarok init`

The checkout is the home folder.

What init does

ragnarok init does six steps. It skips each step that is already done:

  1. It writes config.toml from config.example.toml. It asks for the vault root, the folder that holds your vault folders, and adds each subfolder as a vault.
  2. It checks that Ollama is installed.
  3. It runs Ollama as a login service with brew services start ollama (it asks first). If Ollama runs outside brew services, for example ollama serve in a terminal, init stops it and starts the service.
  4. It pulls the embedding model.
  5. It builds the index. A vault with 1,500 notes takes approximately 12 minutes on an Apple Silicon Mac.
  6. When the plugin ragnarok gives the MCP server, it removes a registration at the user scope (it asks first). Else it registers the MCP server ragnarok in Claude Code at the user scope (it asks before it replaces another registration).

Restart Claude Code after step 6. ragnarok doctor checks the same six parts and prints the fix for each failure.

Before step 5, examine config.toml: remove a folder that is not a vault, and add your private paths. A later change of the configuration applies at the next ragnarok index or MCP tool call, with no restart.

Use in Claude Code

The server gives six tools:

ToolWhat it does
searchHybrid search over the notes. Filters: vault, project, area, type, archived.
find_projectsThe projects that match a prompt, with the summary and the matching notes of each project.
list_projectAll notes of one project.
open_projectsThe open projects (state: in-progress and paused by default), grouped by state, newest update first.
open_noteThe text of a note or of one section, with its links and backlinks. A note of more than 4,000 words gives an outline: each section with its heading path, words and first sentence.
find_by_jiraThe notes that contain a ticket key, for example ABC-123.

The plugin adds the guidance below to each session itself, with the plugin tool names mcp__plugin_ragnarok_ragnarok__*. Without the plugin, Claude Code loads MCP tools on demand. To make Claude use them before grep, add a short instruction to your ~/.claude/CLAUDE.md file, for example:

markdown
## Finding notes: ragnarok first
The `ragnarok` MCP server indexes my Obsidian vaults. Use it before Grep or Glob whenever you look fornotes, earlier work or context:
- `find_projects`: the prompt continues or resembles earlier work and names no project. Then call  `list_project` on the best match (look at the top 3).- `search`: facts, decisions, how something was done. Filters: vault, project, area, type.- `open_note`: read a note or one section, with its links and backlinks. A long note gives its outline first; open the section you need by heading.- `open_projects`: which projects are in progress or paused.- `find_by_jira`: a ticket key such as `OPS-77`.
The tools are deferred. Load them in one call before the first use:`ToolSearch` with `select:mcp__ragnarok__search,mcp__ragnarok__find_projects,mcp__ragnarok__list_project,mcp__ragnarok__open_projects,mcp__ragnarok__open_note,mcp__ragnarok__find_by_jira`.
If the tools are absent (for example on a computer without ragnarok), fall back to Grep and say so.Results can be unrelated: read the text before you rely on it, and cite note paths. Private notes arerefused by design; do not work around the refusal with Read or Grep.

Adapting to your vaults

docs/vault-requirements.md tells how a vault must look to get the most from ragnarok: headings, project folders, SUMMARY.md, frontmatter and private folders.

The default path rules expect <vault>/<area>/<project>/note.md. If your vaults look different, the repo skill .claude/skills/adapt-vault/ guides Claude Code through the changes. Open Claude Code in the checkout and ask it to adapt ragnarok to your vaults. The skill:

  1. runs ragnarok survey on each vault;
  2. agrees the private folders with you, before any other change and before a new vault goes into vaults;
  3. writes the path rules into config.toml, checked with ragnarok inspect;
  4. runs the frontmatter backfill, if you agree, with your review before apply;
  5. writes a small evaluation set from your notes and runs ragnarok eval mechanical;
  6. adds the guidance above to your ~/.claude/CLAUDE.md, after it asks you.

It changes only config.toml and adds frontmatter keys. It never moves, renames or deletes a note or a folder.

Configuration

config.toml is in the home folder. A relative path in it is relative to the home folder. config.example.toml explains each key. The most important keys:

KeyWhat
root, vaultsThe folder that holds the vaults, and the vault folders to index.
[vault_paths]The folder of a vault that is not in root, for example kb = "~/code/kb". A note key stays <vault>/<path>.
private_patternsGlob patterns of private notes, for example "Notes/Journal/**".
model, dimensionThe Ollama embedding model and its vector size. A change needs ragnarok index --rebuild.
min_words, max_wordsThe chunk size limits of the splitter. A change needs ragnarok index --rebuild.
project_markersA folder that holds one of these files is a project folder (default DRIVERS.md, SUMMARY.md).
jira_prefixesThe ticket prefixes that find_by_jira knows.
[vault_rules.<vault>]The path rules of one vault: which folder gives the area and the project.

Note metadata

ragnarok reads these frontmatter keys. Each key is optional:

yaml
---project: heating-upgrade     # the project slug; default: from the path rulesarea: home                   # a wide subject; default: from the path rulestype: plan                   # drivers, summary, research, spec, plan, brainstorm, review, decision,                             # guide, reference, meeting, log, template or notestatus: active               # active or archived; a note in an _archive folder, or in a project                             # whose SUMMARY.md has state: superseded or abandoned, is archived; state: done is currentdescription: One sentence about the note, which improves find_projects.jira: [ABC-123]              # ticket keys, in addition to the keys in the text---

Without frontmatter, the path rules give the metadata. The default rules work for a vault with the layout <vault>/<area>/<project>/note.md. For a different layout, add a [vault_rules.<vault>] table. Use ragnarok inspect <note path> to see the metadata of a note.

Commands

CommandWhat it does
ragnarok initSets up this computer (see Setup).
ragnarok doctorChecks the setup.
ragnarok index [--rebuild]Adds, changes and removes notes in the index. After a change of the path rules, the private paths or the markers, it derives the metadata of all notes again, with no new embeddings. When a .md marker file is added or removed, it does the same for the notes under the folder of that file. --rebuild is needed only after a change of model, dimension, min_words or max_words.
ragnarok statusShows the size and the state of the index.
ragnarok search "<query>"Searches from the terminal.
ragnarok inspect <path>...Shows the metadata of notes.
ragnarok chunks <path>... | --statsShows the chunks of notes, or the totals.
ragnarok serveRuns the MCP server on stdio. Claude Code starts it.
ragnarok backfill propose|export|merge|apply <vault> [file...]Proposes, describes and applies missing frontmatter keys. The order is propose, export, Claude writes descriptions, merge <vault> <file>..., you examine the proposal, apply.
ragnarok survey <vault> [--json]Prints the folders, frontmatter keys, marker files, name patterns and ticket prefixes of a vault folder. Run it before you write [vault_rules.<vault>]. It prints no note text.
ragnarok eval mechanical|pool|agentRuns an evaluation on the question sets in data/eval/sets/.

Run each command with uvx ragnarok-mcp, for example uvx ragnarok-mcp search "boiler", or with uv run in the checkout.

Where things are

Everything is in the home folder: RAGNAROK_HOME, else the checkout, else ~/.ragnarok. In a checkout, git ignores config.toml, data/ and logs/.

PathWhat
config.tomlThe configuration of this computer.
data/index.dbThe SQLite index. Copy it to a second computer to skip the first index.
data/backups/The vault archives that backfill apply makes before it writes.
data/proposals/The output of backfill propose and backfill export.
data/eval/Your question sets (sets/), the evaluation results and the mirror of the agent evaluation.
logs/server.logThe MCP server log, one line for each tool call with its time.

Ollama keeps the model in ~/.ollama.

Development

bash
uv run pytestuv run ruff check . && uv run ruff format --check .

Release

  1. Set the version in pyproject.toml and in both version fields of server.json, and add the section to CHANGELOG.md.
  2. After the merge, push the tag: git tag v1.2.3 && git push origin v1.2.3.
  3. The workflow publish.yml checks that the three versions match the tag, runs the tests, publishes the package to PyPI with trusted publishing, then publishes server.json to the MCP Registry.

License

MIT. See LICENSE.

来源:README.md,提交 615ed14

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:软件包安装失败。

版本历史

1
  1. v1.1.0最新Nov 6, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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