okf-kit
Turn any website into a book you agent can read
README
okf-kit
Turn any website into a portable, agent-ready knowledge bundle — no LLM required to start.
<p align="center"><img src="docs/assets/demo.svg" alt="okf-kit: build a docs site into an OKF bundle, chat with it, and serve it to a coding agent — no API key" width="760"></p>
okf-kit crawls a site into a
Google Open Knowledge Format (OKF)
bundle: a directory of markdown concept files with YAML frontmatter and
per-directory index.md listings that any agent can navigate with plain file
reads. Build it, keep it in sync as the site changes, publish it, and chat with
it — locally, with your own key, or fully offline via Ollama.
pip install okf-kit
okf build https://docs.example.com -o docs-okf # crawl → OKF bundle (no key, no browser)
okf chat docs-okf --provider ollama # chat offline, no key
Or zero-install with uv:
uvx --from okf-kit okf build https://docs.example.com -o docs-okf
Part of the calknowledge ecosystem — okf-kit is the lightweight, open library; calknowledge is the full platform (LLM enrichment, RAG export, retrieval evals, GUI) built on top of it.
Why
Everyone re-crawls and re-indexes the same docs privately and badly. okf-kit makes a website's knowledge a portable artifact:
- Agents can read an OKF bundle; they can't read your website. The bundle is navigable markdown — no scraping, no SDK, no runtime.
- Faithful markdown, not text soup. Real extraction (headings, code, tables), boilerplate filtered, JS-rendered when needed.
- Self-maintaining.
okf syncupdates only what changed, so a published bundle in git produces small delta commits and never goes stale. - Works with any LLM, or none. Chat via OpenAI, Ollama, vLLM, OpenRouter, or Claude — or get a zero-key retrieval answer with citations.
Install
pip install okf-kit # core: build / sync / validate / zip / list / get / visualize
pip install "okf-kit[chat]" # okf chat via OpenAI-compatible providers (OpenAI, Ollama, …)
pip install "okf-kit[anthropic]" # Claude as a chat provider
pip install "okf-kit[js]" # crawl JavaScript-rendered sites (pulls a Playwright Chromium)
pip install "okf-kit[mcp]" # serve bundles to Claude Code / Cursor over MCP
pip install "okf-kit[enrich]" # okf build --enrich (LLM descriptions + tags)
The default install has no browser and no LLM SDK — it installs in seconds.
Tip: install into a dedicated virtualenv so okf-kit's dependencies don't mix with your other projects:
python3 -m venv ~/okf && ~/okf/bin/pip install okf-kitThis also avoids clashes if an existing environment already pins packages like
lxml(e.g. a priorcrawl4aiinstall) — a plain install would otherwise bump them.
Commands
Build
okf build https://docs.example.com -o docs-okf --max-depth 3 --max-pages 200
Domain-restricted BFS crawl → an OKF bundle: pages/ mirror with frontmatter
concepts, a .okf-kit/state.json for sync, and an index.md in every directory
for agent navigation. Validated on exit. No API key needed.
By default the crawl is scoped to the seed's path section — okf build https://doc.rust-lang.org/book/ stays under /book/ and won't wander into the
rest of the host. Override with --path-prefix PATH (a narrower/different
scope) or --all-paths (the whole host). Other flags: --js (JS-rendered
sites — build hints when a site needs it), --no-robots, --enrich (add LLM
descriptions/tags — needs [enrich] + OPENAI_API_KEY).
Sync
okf sync docs-okf
Re-crawls the same site and updates only the delta — added pages written,
changed pages rewritten, removed pages deleted, unchanged pages left
byte-for-byte (stable git diffs). A safety valve aborts on a suspiciously empty
re-crawl (--force overrides).
Chat
okf chat docs-okf --provider ollama # offline, no key
okf chat docs-okf --provider openai --trace # any provider, with citations + a navigation trace
okf chat docs-okf # no provider → zero-key retrieval answer
okf chat docs-okf --resume # continue the last session (history is local)
The agent navigates the bundle (list_directory / read_concept) to the most
specific concept and answers only from what it read, citing the paths.
--provider |
Endpoint | Key |
|---|---|---|
openai |
OpenAI | OPENAI_API_KEY |
ollama |
localhost:11434 (local) |
none |
openrouter |
OpenRouter | OPENROUTER_API_KEY |
anthropic |
Claude | ANTHROPIC_API_KEY |
custom |
--base-url |
as configured |
Chat history is stored locally at ~/.okf/chats/<bundle>/.
Visualize
okf visualize docs-okf # -> docs-okf/graph.html
A self-contained interactive graph (nodes = concepts, edges = internal links);
no backend, no CDN — open the HTML from file://.
Serve over MCP
okf serve-mcp docs-okf # or --all for every downloaded bundle
Exposes list_bundles / list_directory / read_concept / search_bundle over
stdio MCP for Claude Code/Desktop, Cursor, and any MCP client.
Or run it as a container (the included Dockerfile bakes in the rust-book
bundle):
docker build -t okf-kit-mcp .
docker run -i --rm okf-kit-mcp # speaks MCP over stdio; serve another bundle: … okf-kit-mcp okf serve-mcp <name>
Registry
okf list --remote # browse published bundles
okf get backstage-docs # download, validate, install to ~/.okf/bundles/
okf list # your local bundles
Package for hand-off
okf zip docs-okf # -> docs-okf.zip, ready to publish or share
Publishing
See docs/PUBLISHING.md — build a bundle, ship it as a release zip with a weekly self-sync Action, and add it to the awesome-okf-kit registry. Publish only content you may redistribute.
Bundle layout
docs-okf/
index.md root directory listing (reserved, no frontmatter)
log.md build/sync history
pages/ one concept per page (frontmatter + body + citations)
index.md directory listing (every directory has one)
home.md
docs/…
.okf-kit/state.json crawl config, per-page content hashes, link edges
Development
pip install -e ".[dev]", then pytest -q (37 tests, fully offline) and
ruff check okf_kit tests. See CONTRIBUTING.md and the
CHANGELOG.
License
Apache-2.0.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。