kiwiki
A self-hosted Markdown knowledge base and Agent Harness with an MCP server that enables AI agents to read and write notes, providing persistent memory and a shared workspace for multi-agent collaboration.
README
kiwiki
kiwiki is a self-hosted Agent Harness and Markdown knowledge base for humans and AI agents. Notes stay as regular files on disk, the web UI gives you a searchable wiki, and the built-in MCP server lets tools such as Claude Code, Codex, OpenCode, Cursor, ChatGPT, OpenClaw, Hermes, and any MCP client read and write the same knowledge base in parallel.
No hosted account is required. Your Markdown files are the source of truth.
Visit kiwiki.xyz for the project website, FAQ, agent integration guides, and hosting options.
Screenshots



<p align="center"> <img src="docs/assets/screenshots/kiwiki-mobile.png" alt="kiwiki mobile layout" width="360"> </p>
Features
- Multi-Agent Harness — Central knowledge base for Claude Code, Codex, OpenCode, Cursor, ChatGPT, OpenClaw, Hermes, and any MCP-compatible agent. All agents read and write the same wiki in parallel.
- Markdown files with YAML frontmatter — Your file system is the source of truth. No proprietary database, no vendor lock-in, simple to back up.
- 100 % privacy — Self-hosted on your infrastructure. No cloud, no telemetry, no vendor lock-in.
- Per-user isolated wiki folders under
/data/<username>/with role-based access (read/write/admin). - SQLite FTS5 full-text search — Search thousands of Markdown files in milliseconds, including via MCP from your AI.
- Responsive web UI — FastAPI with Jinja2, HTMX, and Toast UI Editor. Works from 4K desktop to mobile.
- Streamable HTTP MCP endpoint at
/mcp(legacy HTTP/SSE at/mcp/sse) with OAuth 2.1 authorization-code flow for ChatGPT-style connectors. - Docker Compose and Helm — One command to start. Kubernetes-ready.
Quick Start
git clone https://github.com/natorus87/kiwiki.git
cd kiwiki
cp .env.example .env
docker compose up -d
Open the web UI:
http://localhost:8082
Use the API key configured in KIWIKI_USERS.
Configuration
All runtime configuration is done through environment variables.
| Variable | Default | Description |
|---|---|---|
KIWIKI_DATA_DIR |
/data |
Data directory for all wiki files |
KIWIKI_USERS |
required | Built-in users in user:key:role format, comma-separated |
KIWIKI_BASE_URL |
http://localhost:8080 |
Public base URL used in MCP and OAuth metadata |
KIWIKI_LOG_LEVEL |
INFO |
Python log level |
KIWIKI_TRUST_PROXY |
true |
Use secure cookies behind a TLS reverse proxy |
KIWIKI_CORS_ORIGINS |
* |
Comma-separated list of allowed CORS origins |
KIWIKI_RATE_LIMIT_ENABLED |
true |
Enables login, read, and write rate limits |
KIWIKI_OAUTH_TOKEN_SECRET |
derived | Optional stable secret for signing OAuth MCP tokens |
KIWIKI_OAUTH_TOKEN_TTL_SECONDS |
86400 |
OAuth access-token lifetime |
KIWIKI_OAUTH_REFRESH_TOKEN_TTL_SECONDS |
2592000 |
OAuth refresh-token lifetime |
Example:
KIWIKI_DATA_DIR=/data
KIWIKI_USERS=admin:<admin-api-key>:admin,writer:<writer-api-key>:write,reader:<reader-api-key>:read
KIWIKI_BASE_URL=https://kiwiki.example.com
KIWIKI_TRUST_PROXY=true
KIWIKI_CORS_ORIGINS=https://kiwiki.example.com
KIWIKI_OAUTH_TOKEN_SECRET=<random-token-signing-secret>
Generate strong keys with:
openssl rand -hex 24
Do not commit real API keys, OAuth secrets, .env files, or local wiki data.
User Model
Each user gets a separate wiki root:
/data/admin/
/data/alice/
/data/bob/
Users cannot read or search another user's files. Web UI requests, REST API calls, search, and MCP tools all run in the authenticated user's namespace.
Roles:
| Role | Permissions |
|---|---|
read |
Read files and search |
write |
Read plus create, edit, move, and reindex |
admin |
Full access, including delete and user management |
ChatGPT and MCP
kiwiki exposes MCP over Streamable HTTP:
https://kiwiki.example.com/mcp
For ChatGPT custom connectors, configure the MCP endpoint as the connector URL. If OAuth is enabled, ChatGPT discovers:
/.well-known/oauth-protected-resource/mcp
/.well-known/oauth-authorization-server/mcp
The OAuth flow uses:
- Authorization code with PKCE
- Signed access tokens
- Refresh tokens
- The
resourceparameter expected by MCP clients - Client ID Metadata Document style client IDs used by ChatGPT
For public deployments, set a stable KIWIKI_OAUTH_TOKEN_SECRET. This keeps connector tokens valid across container restarts while still allowing API-key rotation to revoke access.
Direct bearer-token access is also supported:
curl https://kiwiki.example.com/mcp \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Usage as AI Memory
Configure your AI tools to use kiwiki as persistent memory. The following instruction works for ChatGPT (Custom Instructions → Personalization), Claude (Personalization), and coding agents:
Use kiwiki as my persistent memory. When asked about projects, decisions, recurring topics, personal preferences, or work context, first briefly check kiwiki. Use existing notes as context.
Save new important information in kiwiki when it might be useful later: preferences, decisions, project knowledge, workflows, important facts, and open items. Prefer to update existing files rather than creating new ones. Organize according to the existing structure:
/projects,/decisions,/notes,/sharedand/user. Write short Markdown notes with frontmatter. Do not delete anything without explicit instruction. Also ask in longer chats whether you should save something.
For coding agents (Claude Code, Codex, OpenCode, Cursor), add this instruction to your project's AGENTS.md, CLAUDE.md, or equivalent configuration file.
Agent Harness Setup
When using kiwiki as the Agent Harness for your project, instruct coding agents to connect to kiwiki via MCP. Add the following block to your project's AGENTS.md or CLAUDE.md:
This project uses kiwiki as its Agent Harness and persistent memory.
MCP connection — Connect to the kiwiki MCP server using the appropriate command for your tool:
- Claude Code:
claude mcp add kiwiki http://localhost:8082/mcp --header "Authorization: Bearer <api-key>"- Codex:
codex mcp add kiwiki http://localhost:8082/mcp --header "Authorization: Bearer <api-key>"- OpenCode: configure MCP server in opencode.json
- Cursor: configure MCP server in
.cursor/mcp.jsonOnce connected, use kiwiki as persistent memory (see usage instruction above).
This ensures every coding agent working on the project automatically connects to the shared knowledge base.
MCP Tools
The MCP server exposes tools for common wiki workflows, grouped by required role:
Read (any role)
read_file · read_many · read_lines · fetch · search · grep · find · list_files · list_all_files · file_info · read_index · recent_files · backlinks · related_files · search_status · whoami
Write (write role or admin)
write_file · edit · append_file · create_note · upsert_note · update_frontmatter · preview_edit · replace_many · build_index · reindex_all · tag_index · move_file
Admin (admin role only)
validate_wiki · delete_file · sort
Local Development
Create a virtual environment and install dependencies:
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements-dev.txt
npm ci
Run the app:
KIWIKI_DATA_DIR=./data \
KIWIKI_USERS="admin:dev-key:admin" \
KIWIKI_BASE_URL="http://127.0.0.1:8080" \
KIWIKI_TRUST_PROXY=false \
uvicorn app.main:app --host 127.0.0.1 --port 8080 --reload
Build the frontend motion bundle:
npm run build:motion
Run checks:
ruff check app tests
pytest -q
npm audit --audit-level=high
docker build -t kiwiki:test .
Docker
The default Compose file builds the local image and serves the app on port 8082:
docker compose up -d
docker compose logs -f kiwiki
Persistent data is mounted at:
./data:/data
For public deployments, move real secrets into .env or your secret manager.
Helm
A Helm chart is available under charts/kiwiki.
Install example:
helm upgrade --install kiwiki ./charts/kiwiki \
--set env.KIWIKI_USERS="admin:<admin-api-key>:admin" \
--set env.KIWIKI_BASE_URL="https://kiwiki.example.com" \
--set env.KIWIKI_OAUTH_TOKEN_SECRET="<random-token-signing-secret>"
Review charts/kiwiki/values.yaml before deploying to production.
Repository Hygiene
The repository includes:
- GitHub Actions CI for Ruff, Pytest, frontend build, and Docker build
- Dependabot configuration for Python, npm, and GitHub Actions
- Issue and pull request templates
- Security policy
- MIT license
Ignored local artifacts include .venv/, node_modules/, data/, Python caches, test caches, and local agent configuration.
Security
See SECURITY.md.
Important operational rules:
- Use strong random API keys.
- Set
KIWIKI_TRUST_PROXY=truebehind HTTPS. - Restrict
KIWIKI_CORS_ORIGINSin production. - Set
KIWIKI_OAUTH_TOKEN_SECRETfor public MCP/OAuth deployments. - Do not publish local wiki data or deployment secrets.
License
MIT. See LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。