Skip to main content
Glama
mcp-knowledge-base

mcp-knowledge-base

mcp-knowledge-base

一个Model Context Protocol(MCP)服务器,向 MCP 客户端(Claude Desktop、IDE 或任何代理)暴露笔记知识库。它演示了 MCP 服务器提供的两样东西:工具(模型可以调用的操作)和资源(模型可以读取的数据)。使用 TypeScript 编写,通过 stdio 运行。

mcp typescript

它提供了什么

工具(src/server.ts):

Tool

Purpose

search_notes

跨知识库进行关键词搜索(标题/标签/内容加权)

add_note

添加新笔记

get_note

按 id 获取单条笔记

资源: 每条笔记都可以通过 note://{id} 读取,并提供列表——因此客户端可以将知识库作为数据浏览,而不仅仅是调用工具。

领域逻辑(笔记存储 + 搜索排序)位于 src/notes.ts 中,与协议层分离。

Related MCP server: simple-mcp-example

与 MCP 客户端一起使用

构建它,然后将客户端指向该二进制文件。例如,在 Claude Desktop 的 claude_desktop_config.json 中:

{
  "mcpServers": {
    "knowledge-base": { "command": "node", "args": ["/abs/path/to/dist/index.js"] }
  }
}
npm install && npm run build
node dist/index.js     # speaks MCP over stdio

测试

npm test

两层,均离线运行:

  • 单元测试 — 笔记存储和搜索排序。

  • 集成测试 — 一个真实的 MCP Client 通过内存传输与服务器通信(与客户端通过 stdio 通信的方式相同):它列出工具,调用 search_notes/add_note/get_note,并读取 note:// 资源。共 9 个测试。

许可证

MIT

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • -
    license
    C
    quality
    D
    maintenance
    Enables creating and managing text notes through MCP resources and tools. Provides note creation capabilities and automatic summarization of all stored notes.
    1
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables managing local Markdown notes by creating, viewing, listing, and searching notes and their contents through MCP tools.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables managing notes through add, get, update, delete, and list tools via MCP.
    -