Knowledge Base MCP Server
A zero-dependency MCP server that provides a persistent personal knowledge base for Claude using local JSON file storage. It enables users to manage notes through tools for adding, searching, and indexing content built entirely with Node.js built-ins.
README
🧠 Knowledge Base MCP Server
A zero-dependency Model Context Protocol (MCP) server that gives Claude a persistent personal knowledge base — built entirely with Node.js built-ins.
What is MCP?
The Model Context Protocol is an open standard (by Anthropic) that lets AI assistants talk to external tools and data sources in a structured, secure way. Think of it as a universal plugin system for LLMs.
┌─────────────────┐ JSON-RPC 2.0 ┌──────────────────────┐
│ Claude Desktop │ ◄────── stdio ──────────► │ knowledge-mcp │
│ (MCP host) │ │ (this server) │
└─────────────────┘ └──────────────────────┘
│ │
│ calls tools like kb_search(query="python") │
│ reads resources like kb://notes │
└────────────────────────────────────────────────┘
Every message is a JSON-RPC 2.0 object sent over stdin/stdout.
Architecture
server.js
├── Persistence layer loadDB / saveDB (JSON file in ~/)
├── Business logic noteAdd / noteSearch / noteList / noteDelete / noteStats
├── MCP dispatch table dispatch(method, params, db) → result | error
└── stdio transport readline loop → JSON-RPC framing
The MCP Handshake
client → server: initialize { protocolVersion, clientInfo }
server → client: result { protocolVersion, capabilities, serverInfo }
client → server: notifications/initialized (no response expected)
After this, the client can call any method at any time.
Tools
| Tool | Description |
|---|---|
kb_add |
Store a note with title, content, and optional tags |
kb_search |
Full-text + tag search (AND logic for multiple tags) |
kb_list |
List all notes, optionally filtered by tag |
kb_delete |
Delete a note by ID |
kb_stats |
Summary stats: note count, tag index, newest/oldest |
Resources
| URI | Description |
|---|---|
kb://notes |
Complete JSON dump of all notes |
kb://tags |
Tag → note-list index |
Installation
Prerequisites
- Node.js 18+ (no npm packages required)
Add to Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"knowledge-base": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/knowledge-mcp/server.js"]
}
}
}
Restart Claude Desktop. You'll see a 🔌 icon confirming the server connected.
Add to Claude Code (CLI)
claude mcp add knowledge-base node /absolute/path/to/server.js
Running Manually
# Start the server (stays alive, reads from stdin)
node server.js
# Run unit tests
node server.js --test
# Run integration tests (spawns a real server subprocess)
node integration-test.js
Try it interactively
node server.js
Then paste (hit Enter after each line):
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05"}}
{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"kb_add","arguments":{"title":"Hello","content":"My first note","tags":["demo"]}}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"kb_search","arguments":{"query":"first"}}}
Key Design Decisions
- Zero dependencies — Ships as a single file. Works wherever Node ≥ 18 exists.
- File persistence — Notes survive restarts. DB lives at
~/.knowledge-mcp-db.json. - Strict JSON-RPC — Correct error codes (-32601 method-not-found, -32603 internal, -32700 parse-error) so MCP hosts can handle errors gracefully.
- Notifications handled —
notifications/initializedis a one-way message; the server silently ignores it rather than sending a bogus response. - isError flag — Tool errors use
{ isError: true }per spec, not JSON-RPC errors, so Claude sees the error text rather than a protocol failure.
Data Format
{
"id": "1",
"title": "MCP Guide",
"content": "Model Context Protocol connects AI to tools.",
"tags": ["mcp", "ai"],
"createdAt": "2026-03-09T05:00:00.000Z",
"updatedAt": "2026-03-09T05:00:00.000Z"
}
Extending This Server
To add a new tool:
- Add its logic as a plain function (e.g.
noteUpdate) - Add a descriptor object to the
TOOLSarray - Add a
case 'kb_update':to thetools/callswitch block
That's it — no framework, no codegen, no magic.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。