grepnotes

grepnotes

Enables coding agents to search local notes via BM25 keyword ranking, returning relevant passages with file paths and line numbers, fully offline with zero dependencies.

Category
访问服务器

README

grepnotes

Search your notes from Claude Code, Cursor, or any MCP client. Zero dependencies, runs fully offline.

CI Python 3.10+ License: MIT Dependencies: 0

Point grepnotes at a folder of notes, docs or runbooks. It becomes an MCP server that any coding agent — Claude Code, Cursor, Cline, Zed — can search instead of reading whole files into context.

$ grepnotes search "why are jobs piling up while CPU is idle"

deployment.md:9  [11.6999]  Scaling the worker pool
  Workers autoscale on queue depth, not CPU. If jobs are piling up while CPU
  looks idle, the bottleneck is almost always the database connection pool.

postgres.md:3  [0.7389]  Connection pooling
  Every service goes through pgbouncer in transaction mode. Prepared statements
  are disabled because transaction mode does not keep them across checkouts.

deployment.md:3  [0.5434]  Rolling back a release
  If the error rate crosses two percent, roll back before investigating.
  Run `deployctl rollback --to previous` and confirm the health check turns green.
  Never roll back the database migration in the same step; migrations are
  forward-only by design.

Why

Agents are good at reasoning and bad at knowing where things are written down. The usual fix is to paste whole documents into the prompt, which is slow, expensive, and pushes out the context the agent actually needed.

grepnotes gives the agent a search tool instead. It returns the three or four passages that matter, with file path and line number, so the agent can pull the full document only when it decides it needs to.

Every other tool in this space wants an embedding API, a vector database, or a Docker Compose file. grepnotes is BM25 ranking over a JSON index, written against the Python standard library. No install step beyond the package itself, nothing leaves your machine, and no third-party code in your supply chain.

Try it in 30 seconds

Nothing to install — there are no dependencies to resolve.

git clone https://github.com/LuthfiMirza/grepnotes && cd grepnotes
python -m grepnotes search "rollback policy" --path examples/notes

Install

pip install grepnotes

Or install the clone so the grepnotes command is available everywhere. The -e flag keeps it editable, so your changes take effect without reinstalling:

pip install -e .
grepnotes --version

If your shell reports grepnotes: command not found, Python's script directory is not on your PATH. Either add it, or use python -m grepnotes in place of grepnotes in every command below.

Use it as an MCP server

Claude Code

claude mcp add grepnotes -- grepnotes serve --path ~/notes

Cursor, Cline, Zed and anything else that reads mcpServers

{
  "mcpServers": {
    "grepnotes": {
      "command": "grepnotes",
      "args": ["serve", "--path", "/absolute/path/to/your/notes"]
    }
  }
}

If grepnotes is not on your PATH, use "command": "python" with "args": ["-m", "grepnotes", "serve", "--path", "..."] instead.

Restart the client and confirm the server is connected — in Claude Code, run /mcp and look for grepnotes in the list. The agent now has three tools:

Tool What it does
search_notes Ranked passages for a query, with path, heading and line number
read_note Full text of one document, once the agent decides it needs it
list_notes Every indexed document and its headings, for orientation

The index refreshes itself on each call, so edits to your notes show up without restarting the server.

CLI

grepnotes index [path]           # build or refresh the index
grepnotes search "query"         # search from the terminal
grepnotes serve --path ~/notes   # run as an MCP server over stdio
grepnotes stats                  # what is currently indexed

Useful flags: --force re-reads every file, -n sets the result count, --full prints whole passages, --ext picks which file types to index (.md, .markdown, .mdx, .txt, .rst, .org by default).

How it works

  1. Chunk. Documents are split on markdown headings, then on paragraph boundaries if a section runs past 1200 characters. Headings inside code fences are ignored. Each chunk keeps its heading and starting line.
  2. Index. Tokens are lowercased and stripped of accents, so Indonesian, English and most Latin-script text work without a language-specific tokenizer. Term frequencies land in .grepnotes/index.json.
  3. Rank. Standard BM25 (k1=1.5, b=0.75) over the chunks.
  4. Refresh. Files are stamped with mtime and size, so a rebuild only re-reads what actually changed.

Indexing is roughly linear in corpus size, and a few thousand notes index in under a second. The index is a plain JSON file you can inspect or delete.

Limits, stated honestly

  • Keyword ranking, not semantic. BM25 matches words. If your query and your notes use entirely different vocabulary, it will miss. This is the deliberate trade for having no model and no dependencies. Semantic reranking as an optional extra is the obvious next step — see the issues.
  • Latin-script tokenizer. Chinese, Japanese, Korean and Thai need word segmentation that the current tokenizer does not do.
  • Whole index in memory. Fine up to tens of thousands of chunks. Past that it wants a real inverted index on disk.
  • No stemming. "running" and "run" are separate terms today.

Contributing

Tests are plain unittest, no runner to install:

python -m unittest discover -s tests -v

Pull requests are welcome. The one hard rule is that the runtime stays at zero dependencies — CI enforces it. Optional features belong behind an extra.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选