okf-tools

okf-tools

Enables local semantic search and management of OKF knowledge bundles via MCP tools, with hybrid BM25 and vector search.

Category
访问服务器

README

okf-mcp

Local semantic search over OKF knowledge bundles. No API keys, no cloud services.

Why it exists: Engineers waste hours rediscovering knowledge that already exists — scattered across wikis, Slack, git history, and colleagues' heads. OKF defines a vendor-neutral format (published by Google Cloud Platform) for persisting that knowledge as markdown; okf-mcp makes it queryable and useful in practice. OKF defines the format; okf-mcp provides the tooling layer.

Write markdown files with YAML frontmatter → okf-mcp makes them queryable via hybrid search (BM25 keyword + vector cosine similarity).

Quick Start

# Install (requires Python 3.10+)
git clone https://github.com/hdean-ssp/okf-mcp.git
cd okf-mcp
source activate.sh

# Create a bundle
mkdir ~/my-knowledge && cd ~/my-knowledge
git init && okf init

# Add a concept
okf commit --check-duplicates --json '{
  "title": "Retry Pattern",
  "type": "Pattern",
  "content": "Use exponential backoff with jitter for transient failures.",
  "tags": ["reliability", "networking"]
}'

# Build search index (first run downloads ~30MB embedding model)
# Note: first run takes ~30 seconds to download the model. Subsequent runs are instant.
okf reindex

# Search
okf fetch "how to handle network failures"

What Next?

After completing the Quick Start above:

  • okf fetch "your question" — search your bundle with natural language
  • okf list — browse all concepts
  • okf show <concept-id> — view full concept content
  • okf stats — check bundle health
  • See Use Cases & Examples for real-world workflows
  • See Getting Started for the full guide

Commands

Command Purpose
okf init Initialise a new bundle
okf commit Create a concept
okf fetch <query> Hybrid search (BM25 + semantic)
okf show <id> Display a concept
okf list Browse concepts (filterable)
okf update <id> Modify a concept
okf move <id> <new-id> Move or rename a concept
okf delete <id> Remove a concept
okf reindex Rebuild the vector index
okf stats Bundle statistics

All commands support --format json|text|brief. Output is JSON when piped (agent-friendly), text when interactive.

How It Works

  • Markdown files are the source of truth — the vector index is a derived sidecar, gitignored and rebuildable
  • Hybrid search — combines BM25 keyword matching with vector semantic similarity. No external services.
  • Local embeddings — fastembed + BAAI/bge-small-en-v1.5 (384 dimensions), no API keys
  • Incremental indexing — only re-embeds changed files (mtime comparison)

MCP Server

okf-mcp includes an MCP (Model Context Protocol) server, letting any MCP-compatible client (Kiro, Claude Desktop, etc.) use your knowledge bundle directly.

Quick Start — MCP Server

# Start the server (from within your bundle directory)
okf-mcp

# Or point to a specific bundle
okf-mcp --bundle-path ~/my-knowledge

The server communicates over stdio (JSON-RPC). You don't run it manually for normal use — instead, configure your MCP client to launch it.

Client Configuration

Team/Shared Deployment (recommended — see Team Setup Guide):

Create ~/.kiro/settings/mcp.json on the server:

{
  "mcpServers": {
    "okf-mcp": {
      "command": "/path/to/okf-mcp/.venv/bin/okf-mcp",
      "args": [
        "--bundle-path",
        "/path/to/your/team-bundle"
      ],
      "autoApprove": [
        "commit_concept", "delete_concept", "fetch_concepts",
        "get_stats", "init_bundle", "list_concepts",
        "move_concept", "reindex", "show_concept", "update_concept"
      ]
    }
  }
}

Kiro via Remote-SSH (generic setup — Kiro connects to server, MCP runs locally on server):

{
  "mcpServers": {
    "okf-mcp": {
      "command": "/path/to/okf-mcp/.venv/bin/okf-mcp",
      "args": ["--bundle-path", "/path/to/your/bundle"],
      "autoApprove": [
        "fetch_concepts", "list_concepts", "show_concept",
        "get_stats", "reindex"
      ]
    }
  }
}

Local setup (Kiro and bundle on same machine):

{
  "mcpServers": {
    "okf-mcp": {
      "command": "okf-mcp",
      "args": ["--bundle-path", "/path/to/your/bundle"],
      "autoApprove": [
        "fetch_concepts", "list_concepts", "show_concept",
        "get_stats", "reindex"
      ]
    }
  }
}

See MCP Setup Guide for individual installation or Team Setup Guide for onboarding to the shared deployment.

Available Tools

Tool Description
init_bundle Create a new bundle at a given path
commit_concept Add a new concept (title, type, content, tags)
update_concept Modify fields on an existing concept
move_concept Move or rename a concept
delete_concept Remove a concept
fetch_concepts Semantic/hybrid search with natural language
list_concepts Browse concepts with filters (type, tags, date, path)
show_concept Get full content of a concept
reindex Rebuild the vector search index
get_stats Bundle health statistics

Notes

  • The server starts without a bundle configured — use init_bundle to create one, or pass --bundle-path
  • All tools except init_bundle require a configured bundle
  • Errors are returned as structured MCP tool errors (no stack traces exposed)
  • All logging goes to stderr (stdout is the JSON-RPC channel)

Agent Integration

The MCP server handles agent integration directly — no hooks or CLI wrappers needed.

  • agent/AGENT.md — agent usage guide (when to use, MCP tools reference, workflow pattern)

Agents access the knowledge bundle through MCP tools (fetch_concepts, commit_concept, etc.) rather than shelling out to CLI commands.

Documentation

Development

git clone https://github.com/hdean-ssp/okf-mcp.git
cd okf-mcp
source activate.sh
pip install -e ".[dev]"
pytest

Dev dependencies include pytest, hypothesis (property-based testing), and pytest-asyncio.

Branches

  • main — MCP server and CLI. Focused on the essential loop: init → commit → fetch → reindex, exposed via both CLI and MCP.

License

Apache 2.0

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选