Skip to main content
Glama

okf-mcp

Semantic search and CRUD tooling for OKF knowledge bundles. Runs locally, entirely offline.

OKF is a vendor-neutral format (published by Google Cloud Platform) for persisting team knowledge as markdown with YAML frontmatter. okf-mcp indexes those files and makes them searchable via hybrid BM25 + vector cosine similarity. It exposes the same functionality through both a CLI and an MCP server, so humans and AI agents can query the same bundle.

Quick Start

# 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 (downloads ~30MB embedding model on first run)
okf reindex

# search
okf fetch "how to handle network failures"

After that:

  • okf fetch "your question" searches with natural language

  • okf list browses all concepts

  • okf show <concept-id> prints full content

  • okf stats reports bundle health

  • Use Cases & Examples has real-world workflows

  • Getting Started is the full walkthrough

Related MCP server: RAG In A Box MCP Server

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 accept --format json|text|brief. Piped output defaults to JSON; interactive defaults to text.

How It Works

The markdown files in your bundle are the source of truth. The vector index is a derived sidecar (gitignored, rebuildable from scratch with okf reindex --full).

Search combines BM25 keyword matching and vector cosine similarity at a 60/40 weighting. Embeddings come from fastembed using BAAI/bge-small-en-v1.5 (384 dimensions), stored in SQLite via sqlite-vec. Everything runs locally.

Reindexing is incremental by default (mtime-based change detection). Embedding is chunked in small batches to keep memory usage under 500MB even on a 2GB VPS.

MCP Server

The MCP server lets any MCP-compatible client (Kiro, Claude Desktop, etc.) interact with your bundle over stdio JSON-RPC.

# from within your bundle directory
okf-mcp

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

You typically don't run it by hand. 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 (Kiro connects to server, MCP runs 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 the 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 shared deployments.

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

The server can start without a bundle configured. Pass --bundle-path or call init_bundle from the client. All tools except init_bundle require a configured bundle. Errors come back as structured MCP tool errors. Logging goes to stderr (stdout is the JSON-RPC channel).

Agent Integration

Agents interact through the MCP tools directly (fetch_concepts, commit_concept, etc.). See agent/AGENT.md for the usage guide: when to query, when to commit, workflow patterns.

Documentation

Development

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

190 tests across CLI, MCP server, bundle operations, search, sync, and move/rename. Dev dependencies: pytest, hypothesis, pytest-asyncio.

Roadmap

See ROADMAP.md for the production readiness plan — input hardening, data integrity, deployment tooling, and the path to a stable 1.0 release.

License

Apache 2.0

Available Tools

10 tools
commit_conceptC

Commit a new concept to the knowledge bundle.

Creates a concept file with the given title, type, and content. Optionally checks for duplicate concepts before committing.

Inputs: type (required), title (required), content (required), path, +2 more. Returns: result

delete_conceptA

Delete a concept from the bundle by its concept_id.

Inputs: concept_id (required). Returns: result

fetch_conceptsA

Search the knowledge bundle using natural language queries.

Returns a ranked list of matching concepts with scores and snippets. Supports hybrid (semantic + keyword), keyword-only, or semantic-only modes.

Inputs: query (required), mode, tags, type, +2 more. Returns: result

get_statsA

Return bundle health statistics.

Returns concept count, type/tag distributions, last reindex timestamp, and the number of concepts pending re-embedding.

Inputs: no named parameters. Returns: result

init_bundleA

Initialize a new OKF knowledge bundle at the specified path.

Creates .okf/config.json, a root index.md, and updates .gitignore if in a git repo. This is the only tool that does not require a pre-configured bundle.

Inputs: path. Returns: result

list_conceptsB

List concepts in the knowledge bundle with optional filters.

Returns a filtered, sorted list of concepts. Supports filtering by type, tags, modification date, and path prefix.

Inputs: path, tags, type, limit, +1 more. Returns: result

move_conceptA

Move or rename a concept within the bundle.

Changes the concept's location (and therefore its concept_id) without losing content, metadata, or vector-index history. Optionally updates the title in frontmatter at the same time.

Examples:

  • Rename: concept_id="notes/old-name", new_concept_id="notes/new-name"

  • Move: concept_id="drafts/idea", new_concept_id="published/idea"

  • Both: concept_id="tmp/scratch", new_concept_id="guides/setup-guide", new_title="Setup Guide"

Inputs: concept_id (required), new_concept_id (required), new_title. Returns: result

reindexA

Rebuild the vector index for the knowledge bundle.

Performs an incremental reindex by default (only processes changed files). Set full=True to discard the existing index and rebuild from scratch.

Returns a JSON summary with counts of added, updated, removed, skipped concepts and the total number of indexed concepts.

Inputs: full. Returns: result

show_conceptA

Show the full details of a concept by its concept_id.

Returns all frontmatter fields and the complete markdown body.

Inputs: concept_id (required). Returns: result

update_conceptA

Update an existing concept in the bundle.

Applies only the provided fields to the concept, leaving unspecified fields unchanged. Re-embeds the content and updates the vector index.

Inputs: concept_id (required), tags, type, title, +1 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 10 tools

    Disambiguation5/5

    All ten tools have distinct purposes: create, delete, search, stats, init, list, move, reindex, show, update. No overlap or ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., commit_concept, delete_concept). Even reindex fits the pattern as a clear single action.

    Tool Count5/5

    10 tools is ideal for a knowledge bundle manager. Each tool serves a clear purpose without being overwhelming or insufficient.

    Completeness5/5

    The tool surface covers the full lifecycle: init, CRUD (commit, show, list, update, delete), move, reindex, search, and stats. No obvious gaps.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Hybrid semantic search (dense vector + BM25) over local knowledge bases and codebases, exposed as MCP tools for AI agents to search and list knowledge bases.
      -
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables any MCP-compatible AI assistant to search, filter, and retrieve information from a local document collection using a hybrid search pipeline with vector, BM25, reranking, and LLM enrichment.
      4
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      A local OKF-compatible knowledge engine for AI agents. Enables capturing agent conversations, hybrid semantic+keyword search, MCP serving to agents, interactive graph visualization, and OKF bundle export.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides MCP tools for semantic search over personal knowledge sources using pluggable embeddings and local vector indexing.
      1
      MIT