Knowledge Base MCP
Allows ingesting GitHub repositories into the knowledge base by cloning and analyzing their directory structure and key files.
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., "@Knowledge Base MCPsearch for knowledge about semantic search"
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.
Knowledge Base MCP
A cross-project knowledge base MCP server that supports three-layer search (text matching / TF-IDF / semantic vectors) and provides a Web UI for management.
Features
8 MCP Tools — kb_write / kb_read / kb_search / kb_search_semantic / kb_list / kb_delete / kb_update / kb_outline
Three-Layer Search Architecture — P0 text matching + P1 TF-IDF + P2 multilingual semantic vectors, with weighted fusion ranking
Multilingual Semantic Search — Based on
paraphrase-multilingual-MiniLM-L12-v2, supporting cross-lingual retrieval for 50+ languagesDual Transport Modes — Stdio (local MCP client) + HTTP (StreamableHTTP / SSE / REST API)
Web UI — Vite 6 + React 18 + Zustand + Tailwind + Ant Design
Related MCP server: RAG MCP Server
Quick Start
npx One-Click Launch (Recommended)
No need to clone the repository, just run:
# Stdio 模式
npx @dyyz1993/kb-mcp --stdio
# HTTP 模式
npx @dyyz1993/kb-mcp --http --port 19877Global Installation (Optional)
npm install -g @dyyz1993/kb-mcp
kb-mcp --stdioBuild from Source
git clone https://github.com/dyyz1993/knowledge-base-mcp.git
cd knowledge-base-mcp
bun installWhen using semantic search for the first time, you need to download the embedding model in advance:
bun run -e '
import { pipeline, env } from "@huggingface/transformers"
import { join } from "node:path"
import { homedir } from "node:os"
env.localModelPath = join(homedir(), ".cache/huggingface/local-models")
env.allowLocalModels = true
await pipeline("feature-extraction", "Xenova/paraphrase-multilingual-MiniLM-L12-v2", { dtype: "fp32" })
console.log("Model downloaded")
'If the model is not downloaded, semantic search (P2) will be unavailable, but text matching (P0) and TF-IDF (P1) will still work normally.
OpenCode Configuration
Stdio Mode (Recommended for local use)
Edit ~/.config/opencode/opencode.json and add the following to mcp.servers:
{
"mcp": {
"servers": {
"knowledge-base": {
"type": "local",
"command": ["npx", "@dyyz1993/kb-mcp", "--stdio"]
}
}
}
}No manual startup is required; OpenCode will automatically manage the process lifecycle.
StreamableHTTP Mode (Remote Server)
Start the service first:
npx @dyyz1993/kb-mcp --http --port 19877Configuration:
{
"mcp": {
"servers": {
"knowledge-base": {
"type": "streamable-http",
"url": "http://your-server:19877/mcp"
}
}
}
}SSE Mode (Legacy Client)
{
"mcp": {
"servers": {
"knowledge-base": {
"type": "sse",
"url": "http://your-server:19877/sse"
}
}
}
}Web UI
# 先启动 HTTP 服务
npx @dyyz1993/kb-mcp --http --port 19877
# 启动 Web UI
cd web
bun install
bun run devVisit http://localhost:5180, and API requests will be automatically proxied to :19877.
MCP Tools
Tool | Description |
| Save knowledge documents, supporting metadata such as tags, keywords, and source projects |
| Read document content, automatically truncated if over 50 lines |
| Multi-dimensional search for text + keywords + tags |
| Semantic vector search, supporting cross-lingual retrieval |
| Browse document list, filtered by tags or projects |
| Delete documents and update indexes synchronously |
| Update document body, title, tags, and keywords |
| Get the document outline for a specified project |
kb_write Parameters
{
title: string // 文档标题
content: string // 正文(Markdown)
tags: string[] // 标签:tutorial / document / analysis / guide / snippet / best-practice / reference / architecture / troubleshooting / decision
keywords: string[] // 关键词,用于检索
intent: string // 创建意图或使用场景
project_description: string // 当前项目简要描述
source_project?: string // 来源项目路径(自动填充)
source_worktree?: string // 来源 worktree 路径(自动填充)
}REST API
The following endpoints are only available in HTTP mode.
Method | Path | Description |
GET |
| Health check |
GET |
| List all documents |
GET |
| Read a specific document |
POST |
| Comprehensive search (three-layer fusion) |
POST |
| Semantic search |
GET |
| Get project outline |
Search Architecture
查询 → ┌─ P0: 文本匹配(标题/关键词/意图) ──── 权重 0.2
├─ P1: TF-IDF(加权词频 + 余弦相似度) ── 权重 0.3
└─ P2: 语义向量(384维 embedding + 余弦相似度) ── 权重 0.5
↓
加权融合 → 排序返回 TopKLayer | Algorithm | Features | Scenario |
P0 | Substring matching + field weighting | Precise, fast | Known keywords |
P1 | TF-IDF + cosine similarity | Chinese bigram tokenization, weighted fields | Fuzzy matching |
P2 | multilingual-MiniLM + cosine similarity | 50+ languages cross-lingual semantic matching | Natural language queries |
kb_search uses P0, kb_search_semantic uses P2, and HTTP /api/search uses three-layer fusion.
Storage Structure
All data is stored in ~/.knowledge/ (customizable via the KB_DIR environment variable):
~/.knowledge/
├── index.json # 文档索引
├── vectors.json # 语义向量缓存
├── outlines/ # 项目大纲
│ └── {project-slug}.json
├── {id}-{title-slug}.md # 文档文件(YAML frontmatter + Markdown 正文)
└── ...Example of a single document file:
---
id: "abc123xyz"
title: "React Hooks 最佳实践"
tags: ["best-practice"]
keywords: ["react", "hooks", "useEffect"]
intent: "React 开发中 hooks 的常见模式和陷阱"
project_description: "前端组件库项目"
source_project: "/Users/x/project-frontend"
created_at: 1746012345678
---
## 使用 useEffect 的注意事项
...Testing
bun testEnvironment Variables
Variable | Default Value | Description |
|
| Knowledge base storage directory |
|
| HTTP mode port (also available via |
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
Token-free MCP server for structured RevoGrid Core, Pro, and Enterprise knowledge retrieval.
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
Knowledge base MCP for AI agents on iknow.dev. Search, read, and maintain via OAuth.
Related MCP Servers
- AlicenseCqualityDmaintenanceA fund knowledge base server based on Model Context Protocol (MCP), providing query and retrieval functions of fund-related knowledge, and supporting multiple deployment modes and protocols.32Apache 2.0
- AlicenseNot gradedqualityCmaintenanceA RAG knowledge base MCP server that adds vector search and reranking capabilities to opencode, supporting multimodal embeddings, multiple knowledge bases, and local storage.1MIT
- AlicenseNot gradedqualityDmaintenanceA knowledge base MCP server backed by Qdrant vector database with local embeddings for semantic search and document management.6 npm1ISC
- AlicenseAqualityBmaintenanceVendor-neutral MCP server for knowledge retrieval across repositories, offering stable tools for searching, getting, and listing documents with hybrid lexical and optional semantic search.3MIT