Skip to main content
Glama

okf-mcp

English · 简体中文

Local runtime for Open Knowledge Format v0.2: validate bundles, search concepts, expose knowledge over MCP, and build database Bundles from dbexplain for agent NL2SQL.

Fork of mfdaves/okf-mcp (MIT). Enterprise rollout extensions: hosted Streamable HTTP MCP, immutable knowledge generations, okf dbexplain, and bundled Agent Skills.


What you get

Piece

Role

okf CLI

Validate, search, sync database Bundles, publish knowledge

MCP server

Agents retrieve OKF concepts (schemas, business semantics, saved SQL)

Built-in Skills

Guided workflows for sync, business overlays, and publishing

No database server, vector DB, or embeddings required for the runtime itself.


Related MCP server: 50 First Tapes MCP Server

Prerequisites

Dependency

Required for

Install

Node.js ≥ 22

okf / MCP

nodejs.org

dbexplain ≥ v0.1.11

okf dbexplain sync, business Skill probes

Newer compatible releases are accepted; put dbexplain on PATH

.env.dbexplain (or DSN)

dbexplain connectivity

User-maintained; Skills never read or edit it

Git

Source install

Optional for tarball deploy

Check:

node --version          # v22+
command -v dbexplain && dbexplain --version

Quick start (database knowledge and querying)

The CLI and Skills are independent capabilities. Install the ones needed for a task:

okf CLI / MCP       → validate, index, and serve knowledge
okf-dbexplain       → generate or refresh physical facts
okf-bundle-business → add or correct Business knowledge
okf-nl2sql          → query real data and return traceable results

1. Install okf-mcp

git clone https://github.com/doctormacky/okf-mcp.git
cd okf-mcp
npm ci
npm link                    # optional: register `okf` on PATH
okf --version

Extended install, update, and rollback guide (Chinese): docs/OKF_CLI_SOURCE_INSTALL_UPDATE_ZH.md.

2. Sync physical layer (Skill or CLI)

Prepare dbexplain (releases), then:

$okf-dbexplain
Inspect prod-main and sync to /data/okf/my-database

Or manually:

okf dbexplain check --include prod-main
okf dbexplain sync \
  --include prod-main \
  --bundle-root /data/okf/my-database \
  --generated-at 2026-08-26T09:00:00Z \
  --dry-run
# review plan → apply with --expect-plan <digest>
okf dbexplain validate --bundle-root /data/okf/my-database

3. Add business semantics

$okf-bundle-business
Bundle: /data/okf/my-database
Task: add buyer aliases to Customers and project explicit order-state codes
from the column comment. Inventory and propose before writing.

After writes:

okf dbexplain overlay-index --bundle-root /data/okf/my-database
okf dbexplain validate --bundle-root /data/okf/my-database

Skill details: docs/SKILLS.md.

4. Connect an MCP client

See MCP modes below. Restart or reload after Bundle changes.


Built-in Agent Skills

Skills live under .agents/skills/. Register them in your agent host (Cursor, Codex, etc.).

Skill

When to use

You say (example)

okf-dbexplain

First-time or refresh physical Bundle from dbexplain

$okf-dbexplain sync prod-main to /data/okf/my-db

okf-bundle-business

Add or correct Business knowledge in a query-ready Bundle

$okf-bundle-business add buyer aliases to Customers

okf-nl2sql

Execute read-only SQL from MCP knowledge and return real data

$okf-nl2sql show net sales after refunds by store last month

okf-knowledge-publisher

Publish/update central OKF knowledge via okf knowledge + hosted MCP

$okf-knowledge-publisher publish workspace to server

Also shipped: okf-v02-migration — only when migrating legacy v0.1 catalogs to v0.2.

Each Skill may be installed alone or in any combination and does not assume the others exist. Composition is a user or Agent Host decision.

Full reference: docs/SKILLS.md · docs/SKILLS_ZH.md


MCP modes

stdio and Streamable HTTP expose the same tools when started with the same flags. For database NL2SQL, the default read-only profile is enough.

Full tool catalog: docs/MCP_TOOLS.md · docs/MCP_TOOLS_ZH.md

Mode

Command

Best for

stdio MCP

okf --root <bundle> mcp

Cursor, Claude Desktop, local IDE agents

Streamable HTTP (dev)

okf --root <bundle> mcp --http

Local HTTP client testing (loopback)

Streamable HTTP (hosted)

okf hosted --root <bundle>

Team server; bearer auth + immutable generations

Tools (read-only — all three modes above)

Category

Tools

Discovery

list_bundles, list_concepts, search_concepts, get_concept, list_types, list_tags, list_relation_types, list_edge_kinds, list_remote_bundles

Graph

get_graph, get_neighbors, get_subgraph, find_paths, graph_summary, export_graph, get_provenance

Validation

validate_bundle, validate_project, check_v02_migration

Assets / computation

read_bundle_asset, read_git_source, inspect_attested_computation, prepare_attested_computation, check_computation_receipt

Resources: okf-documents template — read any indexed Markdown concept by okf:// URI.

NL2SQL workflow: $okf-nl2sql calls search_concepts → get_concept → get_neighbors, then assembles SQL from business knowledge, physical bindings, and Saved Queries. It falls back to bounded dbexplain discovery only when needed.

Optional write/authoring tools (okf_propose_*, okf_apply_changes, load_remote_bundle) are available on local stdio/HTTP only with extra flags; hosted omits them. Knowledge publishing uses okf knowledge CLI, not MCP writes.

stdio (local agent)

{
  "mcpServers": {
    "okf": {
      "command": "node",
      "args": [
        "/absolute/path/to/okf-mcp/bin/okf-mcp.js",
        "--root",
        "/absolute/path/to/your/bundle",
        "mcp"
      ]
    }
  }
}

Or after npm link:

{
  "mcpServers": {
    "okf": {
      "command": "okf",
      "args": ["--root", "/absolute/path/to/your/bundle", "mcp"]
    }
  }
}

Default with no subcommand also starts stdio MCP when a bundle root is configured.

hosted (Streamable HTTP + rollout)

Authenticated enterprise profile: MCP at /mcp, rollout API at /v1/rollout/*.

export OKF_READ_TOKEN="<read-token>"
export OKF_ROLLOUT_TOKEN="<rollout-token>"
okf hosted --root /path/to/catalog --host 127.0.0.1 --port 8765
# → http://127.0.0.1:8765/mcp

Use okf-knowledge-publisher Skill to download → dry-run → submit snapshots. Other agents consume published knowledge through this MCP URL with Authorization: Bearer $OKF_READ_TOKEN.

Standalone unauthenticated HTTP (dev only):

okf --root /path/to/bundle mcp --http --host 127.0.0.1 --port 8765

Prefer hosted for anything beyond localhost.


Common CLI checks

okf --root /path/to/bundle validate
okf --root /path/to/bundle search "order state"
okf --root /path/to/bundle concept business/datasets/my-dataset
okf dbexplain inspect --include prod-main
okf dbexplain validate --bundle-root /path/to/database-bundle

Documentation

Doc

Content

docs/MCP_TOOLS.md / docs/MCP_TOOLS_ZH.md

MCP tools — stdio vs HTTP parity, full catalog

docs/SKILLS.md / docs/SKILLS_ZH.md

Built-in Skills — when & how

docs/OKF_CLI_SOURCE_INSTALL_UPDATE_ZH.md

Install, npm link, update, skills registration

docs/USER_GUIDE_ZH.md

Full user manual (hosted, knowledge, MCP tools)

okf/bundles/okf-mcp/

Self-describing OKF product bundle


Development

npm ci
npm test
npm run self:validate

License

MIT — see LICENSE. Upstream mfdaves/okf-mcp contributors remain credited.

Available Tools

28 tools
check_computation_receiptA
Read-onlyIdempotent

Check receipt field presence only; never attest, echo values, or persist the receipt.

Inputs: uri (required), receipt (required).

check_v02_migrationA
Read-onlyIdempotent

Analyze a local or remote bundle for safe staged OKF v0.2 migration without creating proposals or writes.

Inputs: bundle, actorMappings, generatedPaths.

export_graphA
Read-onlyIdempotent

Render the current OKF graph as JSON, Graphviz DOT, or Mermaid text.

Inputs: format, maxEdges, maxNodes, edgeKinds, +2 more.

find_pathsA
Read-onlyIdempotent

Find bounded relationship paths between two OKF concepts.

Inputs: source (required), target (required), maxPaths, edgeKinds.

get_conceptA
Read-onlyIdempotent

Read one valid OKF concept, including its frontmatter, Markdown body, and links.

Inputs: id, uri, path, bundle.

get_graphB
Read-onlyIdempotent

Return a bounded set of OKF graph nodes and edges with optional concept filters.

Inputs: tag, type, bundle, maxEdges, +5 more.

get_neighborsB
Read-onlyIdempotent

Return the incoming and outgoing graph relationships for one OKF concept.

Inputs: uri (required), edgeKinds, includeAssets, includeExternal.

get_provenanceA
Read-onlyIdempotent

Trace normalized source provenance through internal concepts without fetching external resources.

Inputs: uri (required), maxDepth, maxNodes, includeExternal.

get_subgraphB
Read-onlyIdempotent

Traverse a bounded OKF subgraph outward from one or more seed concepts.

Inputs: uri, depth, seeds, maxNodes, +1 more.

graph_summaryA
Read-onlyIdempotent

Summarize bundle, concept, edge, type, tag, and graph health counts.

Inputs: no named parameters.

inspect_attested_computationA
Read-onlyIdempotent

Statically inspect an Attested Computation contract and indexed inert artifacts; never execute it.

Inputs: uri (required), asOf, maxContentBytes, includeComputation.

list_bundlesA
Read-onlyIdempotent

List the local and remote OKF bundles currently loaded by the server.

Inputs: no named parameters.

list_conceptsA
Read-onlyIdempotent

List compact OKF concept summaries with optional bundle, type, tag, and text filters.

Inputs: tag, type, limit, query, +3 more.

list_edge_kindsB
Read-onlyIdempotent

Count standard semantic and extension edge kinds in the current graph.

Inputs: no named parameters.

list_relation_typesB
Read-onlyIdempotent

Count the typed relations present in the current OKF graph.

Inputs: no named parameters.

list_remote_bundlesA
Read-onlyIdempotent

List metadata for remote bundles currently loaded into the server.

Inputs: no named parameters.

list_tagsA
Read-onlyIdempotent

Count the tags present on concepts in the current OKF index.

Inputs: no named parameters.

list_typesA
Read-onlyIdempotent

Count the concept types present in the current OKF index.

Inputs: no named parameters.

okf_get_proposalA
Read-onlyIdempotent

Read one authoring proposal, including its candidate content and validation result.

Inputs: proposalId (required).

okf_list_proposalsB
Read-onlyIdempotent

List compact metadata for stored authoring proposals.

Inputs: bundle, status.

okf_suggest_concept_pathA
Read-onlyIdempotent

Suggest a safe bundle relative Markdown path from a concept type and title.

Inputs: type (required), title (required), bundle, prefix.

okf_validate_conceptA
Read-onlyIdempotent

Validate a proposed new OKF concept without writing a proposal or concept file.

Inputs: path (required), frontmatter (required), body, bundle.

prepare_attested_computationA
Read-onlyIdempotent

Check declared parameters and produce non-executing digests without echoing parameter values.

Inputs: uri (required), parameters (required), asOf.

read_bundle_assetA
Read-onlyIdempotent

Read one explicitly referenced, already indexed bundle asset with digest verification and byte bounds.

Inputs: uri, path, bundle, maxContentBytes.

read_git_sourceA
Read-onlyIdempotent

Read one pinned sources[].git entry from an explicitly mapped checkout or bare repository without fetching.

Inputs: concept (required), sourceId (required), maxContentBytes.

search_conceptsA
Read-onlyIdempotent

Search OKF concepts and return ranked summaries using text and structured filters.

Inputs: asOf, limit, query, types, +19 more.

validate_bundleA
Read-onlyIdempotent

Report OKF conformance separately from project validity for one bundle or the full current index.

Inputs: bundle.

validate_projectB
Read-onlyIdempotent

Report OKF conformance, project validity, and structured diagnostics for the complete configured project.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 28 tools

    Disambiguation4/5

    Most tools have distinct purposes: list_types, list_tags, and list_relation_types each target different entities, while graph traversal tools (get_neighbors, find_paths, get_graph, get_subgraph) are clearly differentiated by scope. A few pairs like list_bundles and list_remote_bundles could cause minor confusion but descriptions clarify local vs remote.

    Naming Consistency2/5

    Naming is inconsistent: some tools use a verb_noun pattern (list_types, get_concept) while others have a nonstandard 'okf_' prefix (okf_validate_concept, okf_list_proposals). Also, 'graph_summary' breaks the verb-first convention, and 'check_v02_migration' mixes letters and numbers. The mixed styles reduce predictability.

    Tool Count2/5

    With 28 tools, the surface is quite large for what appears to be a read-only graph and validation server. While not extreme (≤50), it exceeds the typical comfortable range and many tools feel like minor variations on similar read/validate operations, suggesting the set could be consolidated.

    Completeness3/5

    The toolset covers reading, searching, validating, and exporting graph data, plus proposal listing/reading, but lacks any creation or update tools for concepts or bundles. Given the emphasis on validation and proposals, there is no direct 'create_concept' or 'submit_proposal' tool, leaving a notable gap in the complete authoring lifecycle.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers