LLM Wiki MCP Server
Uses OpenAI-compatible APIs for LLM-based ingestion and chat answering, as well as optional semantic embeddings for retrieval.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LLM Wiki MCP Server 查一下 Agent 是什么"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🧠 LLM Wiki — 轻量个人知识库 MCP Server
编译一次,持续复利 · 替代传统 RAG 的"每次从零检索"
15 个源文件 · 4 个运行时依赖 · 无 PyTorch / Chroma / LangGraph
这是什么
LLM Wiki 是一个以 编译复利 为核心的个人知识库工具。它将原始素材编译为带双向链接的结构化 Wiki 页面,而不是像传统 RAG 那样每次查询从零检索碎片。
┌─ 原始素材 ──→ LLM 编译 ──→ 互联 Wiki 页
┌─ query ────┤ ├─→ 结构化回答
└─ 检索 ──────→ BM25 + [可选向量] + RRF + 链接扩展 ──────→ 相关片段可作为 MCP Server 接入 Claude Desktop / Cursor 等任意 MCP Agent,也自带交互式对话框。
Related MCP server: LLM Wiki MCP
快速开始
安装
pip install fastmcp openai pyyaml python-dotenv或克隆后本地安装:
git clone https://github.com/COOLFEATHER/LLMwiki_mcp.git
cd LLMwiki_mcp
pip install -e .启动对话
python3 chat.py界面:
╔══════════════════════════════════════════════╗
║ 🧠 LLM Wiki — 个人知识库对话 ║
╚══════════════════════════════════════════════╝
📡 检索: 向量 + BM25 + RRF + 链接扩展
🎯 Embed: 本地 TF-IDF
🤖 回答: 纯检索
📚 Wiki: 6 页
you> 查一下 Agent 是什么
📄 Agent → Agent 是能感知环境、自主决策、执行动作的系统...作为 MCP Server 启动
llm-wiki-server两种回答模式
模式 | 命令 | 说明 |
纯检索(默认) |
| 直接返回 Wiki 片段,零延迟,无需 API key |
LLM 回答 |
| 检索后让 LLM 组织回答,更易读,需要 API key |
对话中输入 /llm 随时切换。
5 个 MCP 工具
工具 | 说明 | 需要 API key |
| 混合检索 + 链接扩展,返回相关 Wiki 片段 | ❌ |
| 读取 Wiki 页全文(含 frontmatter) | ❌ |
| 新建 Wiki 页,自动建索引 | ❌ |
| 编译原始素材为 Wiki 页(提取概念/建链/标矛盾) | ✅ |
| 全量重建检索索引 | ❌ |
直接调用示例
import server
# 查知识库(无需 API key)
print(server.query("什么是 Agent"))
# 读 Wiki 页
print(server.read_wiki("LLM_Wiki"))
# 写新页(自动建索引)
server.write_wiki("设计模式", "# 设计模式\n\n正文...", tags="编程,架构")
# 编译素材(需要 API key)
print(server.ingest("data/raw/笔记.md"))环境变量
变量 | 默认值 | 说明 |
| — | LLM chat API key(ingest 和 --llm 模式需要) |
| — | 兼容 OpenAI 接口的地址,如 |
|
| 对话模型名 |
|
| Embedding 模式: |
| — | Embedding API key( |
| — | Embedding API 地址 |
|
| Embedding 模型名 |
Embedding 三模式
模式 | 设置 | 检索链路 | 依赖 | 效果 |
local(默认) |
| TF-IDF 向量 + BM25 + RRF + 链接扩展 | 纯 numpy | 本地可用,零配置 |
api | + | 语义向量 + BM25 + RRF + 链接扩展 | openai | 语义理解更好 |
off |
| BM25 + 链接扩展 | 无 | 最轻量 |
数据架构
data/
├── raw/ 原始素材(只增不改,不可变真源)
├── wiki/ 编译产物(frontmatter + markdown)
│ ├── Agent.md
│ ├── LLM_Wiki.md
│ └── ...
├── links.json 双向链接图谱(自动维护)
└── index.json 检索索引(自动重建)三层架构:
Raw Sources — 原始素材,不可变、可重编译
Wiki — LLM 编译产物,
[[双向链接]]互联,派生可重建Schema —
SCHEMA.md维护手册,约束页面规范
轻量化对比
重量级依赖 | 本项目的替代 | 节省 |
sentence-transformers + PyTorch (~2GB) | API embedding / 本地 TF-IDF | ~2GB |
chromadb + duckdb (~500MB) | 扁平 JSON 向量索引(纯 Python) | ~500MB |
langgraph + langchain-core (~50MB) | 5 个 MCP 工具直接调用 | ~50MB |
rank-bm25 + jieba (~10MB) | 自实现 BM25(80 行) | ~10MB |
watchdog (~1MB) | 按需重建,无常驻监听 | ~1MB |
安装体积 < 30MB,核心代码 ~1600 行。
设计要点
无 reranker:Wiki 编译期已做整合/交叉引用/矛盾标注,检索对象是预蒸馏结构,"Wiki 即 reranker"
链接扩展检索:BM25/向量找入口页 → 沿
[[双向链接]]图遍历扩 N 跳,比纯语义召回更准、更可解释自实现 BM25:纯 Python ~80 行,内置中文分词 fallback,无外部依赖
Ingest 编译循环:1 份原始素材 → LLM 提取概念 → 自动创建/更新 3-15 个互联 Wiki 页
接入 MCP Agent
{
"mcpServers": {
"llm-wiki": {
"command": "llm-wiki-server",
"env": {
"OPENAI_API_KEY": "sk-...",
"OPENAI_BASE_URL": "https://api.deepseek.com"
}
}
}
}许可证
MIT
Available Tools
5 toolsingestA
编译一份原始素材为 Wiki 页(提取概念/建链/标矛盾)。
Inputs: raw_path (required). Returns: result
queryA
混合检索 + 链接扩展,返回相关 Wiki 片段。
Inputs: question (required). Returns: result
read_wikiA
读取一个 Wiki 页全文(含 frontmatter)。
Inputs: page (required). Returns: result
rebuild_indexA
全量重建向量 + BM25 索引(从现有 Wiki 页)。
Inputs: no named parameters. Returns: result
write_wikiA
新建一个 Wiki 页(自动生成 frontmatter)。
Inputs: body (required), title (required), tags, page_type. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct operation: query for retrieval, write_wiki for creating pages, read_wiki for reading pages, rebuild_index for indexing maintenance, and ingest for processing raw material into wiki pages. There is minimal overlap, and descriptions clarify any potential confusion.
The naming pattern is mixed: two tools use verb_noun style (write_wiki, read_wiki), one uses verb_noun but for a different object (rebuild_index), while two tools are single-word verbs (query, ingest). This inconsistency makes the set less predictable, though still readable.
With 5 tools, the set is well-scoped for a wiki server, covering creation, reading, searching, indexing, and ingestion. It is neither too thin nor too heavy, and each tool serves a clear purpose.
The set covers create, read, query, index rebuild, and ingestion, but notably lacks update and delete operations for wiki pages. This creates a gap in the typical CRUD lifecycle, which agents may need to work around.
Maintenance
Related MCP Connectors
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Your personal library, readable by AI agents: durable snapshots, hybrid search, 46 MCP tools.
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
1
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLocal MCP server for indexing personal knowledge into SQLite with hybrid search, chunk-level citations, memory tools, and agent orchestration.4MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for persistent, compounding markdown wikis maintained by LLMs. Enables incremental knowledge base building with interlinked pages, search, and raw source management.1MIT
- AlicenseNot gradedqualityBmaintenanceLocal-first MCP server for retrieval over markdown wikilink vaults, offering hybrid vector+lexical search, note reading, neighbor expansion, and recent activity tracking with fully local embeddings and no network egress.MIT
- FlicenseNot gradedqualityAmaintenanceExposes a local hybrid (vector + BM25) index of scattered notes, docs, PDFs, and chat logs to AI hosts like Claude Desktop, Cursor, and Cline, letting agents search and get cited answers. It publishes a set of tools, resources, and prompts so any MCP-compatible client can query that knowledge base with section-level citations.-