okf-mcp

okf-mcp

An MCP server that provides LLMs with full read/write access to an Open Knowledge Format (OKF) knowledge bundle, enabling structured, persistent long-term memory.

Category
访问服务器

README

okf-mcp

An MCP server that gives LLMs full read/write access to an Open Knowledge Format (OKF) v0.1 knowledge bundle — usable as structured, persistent long-term memory.

Built with FastMCP and UV.


What is OKF?

OKF represents knowledge as a directory of plain markdown files with YAML frontmatter. Every file is a concept:

---
type: Memory          # REQUIRED — what kind of thing this is
title: Project kickoff notes
description: Key decisions from the 2026-07-12 kickoff meeting
tags: [project-alpha, decisions]
timestamp: 2026-07-12T09:00:00Z
---

# Decisions

- Use OKF as the canonical knowledge format.
- Bundle stored in git alongside the codebase.

Concepts are organised in a directory hierarchy and can cross-link to each other with standard markdown links. Two reserved filenames have special meaning: index.md (directory listing) and log.md (change history).


MCP Tools

Tool Description
list_concepts List all concepts (or a subdirectory)
get_concept Read a full concept by ID
search_concepts Full-text + tag + type search
get_index Read an index.md file
get_log Read a log.md file
create_concept Create a new concept (fails if exists)
update_concept Update body and/or frontmatter fields
delete_concept Delete a concept
update_index Write a custom index.md
generate_index Auto-generate index.md from frontmatter
append_log_entry Append a dated entry to log.md

Quick Start

Requirements

  • Python 3.11+
  • UV

Install

git clone <this-repo>
cd okf-mcp
uv sync

Run (stdio — for MCP clients)

uv run okf-mcp

Run (HTTP — for testing)

uv run fastmcp run src/okf_mcp/server.py:mcp --transport http --port 8000

Run with Docker

The Docker image serves MCP over HTTP on port 8000. Mount the bundle so memories persist when the container is recreated:

docker build -t okf-mcp .
docker run --rm -p 8000:8000 \
  -v okf-bundle:/app/bundle \
  okf-mcp

The MCP endpoint is http://localhost:8000/mcp. To use this repository's local bundle instead of a named Docker volume, run:

docker run --rm \
  --name okf-mcp \
  --user "$(id -u):$(id -g)" \
  -p 8000:8000 \
  --mount type=bind,src=/home/matteo/Documents/Dev/Personal/okf-mcp/bundle,dst=/app/bundle,rw \
  okf-mcp

The --user option prevents Docker from creating root-owned files in the mounted bundle. To run the container in the background:

docker run -d \
  --name okf-mcp \
  --restart unless-stopped \
  --user "$(id -u):$(id -g)" \
  -p 8000:8000 \
  --mount type=bind,src=/home/matteo/Documents/Dev/Personal/okf-mcp/bundle,dst=/app/bundle,rw \
  okf-mcp

Use docker logs -f okf-mcp to view logs and docker stop okf-mcp to stop it.

Configure the bundle path

By default the bundle lives at ./bundle (relative to the working directory). Override it with the OKF_BUNDLE_PATH environment variable:

OKF_BUNDLE_PATH=/path/to/my/bundle uv run okf-mcp

VS Code Integration

Local UV server with GitHub Copilot

  1. Install VS Code and the Python extension.
  2. Install UV.
  3. Install and sign in to the GitHub Copilot extensions.
  4. Open this repository as a folder in VS Code.
  5. Run uv sync once in the integrated terminal.
  6. Open the Command Palette with Ctrl+Shift+P, run MCP: List Servers, select okf-knowledge-server, and choose Start if necessary.
  7. Open Copilot Chat, switch to Agent mode, and allow the server tools when prompted.

The repository includes .vscode/mcp.json. It starts the local server with UV and uses ${workspaceFolder}/bundle as the memory store, so no manual MCP configuration is required in VS Code.

Docker server with GitHub Copilot

If the Docker container is running on port 8000, change .vscode/mcp.json to use the HTTP endpoint instead of the local stdio server:

{
  "servers": {
    "okf-knowledge-server": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Restart the MCP server from the Command Palette after saving the file. Use either the UV configuration or the Docker configuration, not both at the same time.

Cline

Cline uses its own MCP settings file. For the local UV server, configure okf-knowledge-server with the project path and bundle path:

"okf-knowledge-server": {
  "type": "stdio",
  "command": "uv",
  "args": [
    "run",
    "--project",
    "/home/matteo/Documents/Dev/Personal/okf-mcp",
    "okf-mcp"
  ],
  "env": {
    "OKF_BUNDLE_PATH": "/home/matteo/Documents/Dev/Personal/okf-mcp/bundle"
  },
  "disabled": false,
  "autoApprove": []
}

For the Docker server, use an HTTP entry instead:

"okf-knowledge-server": {
  "type": "streamableHttp",
  "url": "http://127.0.0.1:8000/mcp",
  "disabled": false,
  "autoApprove": []
}

After changing Cline's settings, restart or reconnect the MCP server in the Cline MCP panel. Ask Cline to list the available tools; it should show get_concept, create_concept, search_concepts, and the other OKF tools.


Security

  • All file paths are validated against BUNDLE_ROOT to prevent path traversal.
  • Reserved filenames (index.md, log.md) are protected from concept create/update/delete operations.

Project Layout

src/okf_mcp/
├── __init__.py   — exports `mcp`
└── server.py     — FastMCP server with all tools

bundle/           — Default OKF knowledge bundle (git-tracked)
└── index.md      — Bundle root index

推荐服务器

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

官方
精选