使用说明
MCP Notes服务器
用于管理具有持久存储的笔记的模型上下文协议(MCP)服务器实现。
特性
- 创建、阅读、更新和删除笔记
- 使用JSON的持久存储
- 创建和修改的时间戳跟踪
- 通过提示进行笔记摘要
- 使用note://URI方案进行基于资源的访问
安装
通过Smithery安装
通过以下方式自动安装Claude Desktop的笔记 史密瑟里:
npx -y @smithery/cli install notes --client claude
手动安装
- 确保您安装了Python 3.10或更高版本
- 创建虚拟环境:
python -m venv .venv # On Unix/MacOS: source .venv/bin/activate # On Windows: .venv\Scripts\activate - 安装要求:
pip install MCP
项目结构
notes/
├── __init__.py # Package initialization
├── server.py # Main server implementation
├── storage.py # Note persistence layer
├── resources.py # Resource handling (note:// URIs)
├── prompts.py # LLM prompt generation
└── tools/ # Server tools
├── __init__.py # Tools package initialization
├── list_tools.py # Tool listing functionality
└── handle_tools.py # Tool handling implementation
可用工具
add-note:创建新笔记list-all-notes:显示所有存储的笔记update-note:修改现有注释delete-note:删除注释
用法
-
启动服务器:
mcp install src/notes mcp start Notes -
示例操作:
# Create a note await client.call_tool("add-note", { "name": "example", "content": "This is a test note" }) # List all notes await client.call_tool("list-all-notes") # Update a note await client.call_tool("update-note", { "name": "example", "content": "Updated content" }) # Delete a note await client.call_tool("delete-note", { "name": "example" })
存储
笔记存储在 notes_storage.json 具有以下结构:
{
"note_name": {
"content": "Note content",
"created_at": "2025-01-12T11:28:16.721704",
"modified_at": "2025-01-12T11:28:16.721704"
}
}
资源访问
笔记可以作为资源使用 note:// URI方案:
- 列出资源:将所有可用笔记作为资源返回
- 阅读资源:使用访问特定笔记
note://internal/note_name
快速生成
服务器包括用于笔记摘要的提示生成功能:
- 支持简短和详细的摘要
- 设置语言模型输入的注释格式
- 可通过“摘要注释”提示获取
发展
要修改或扩展服务器,请执行以下操作:
- 克隆存储库
- 安装开发依赖项
- 在相应模块中进行更改
- 部署前进行彻底测试
测试
测试应包括:
- 基本CRUD操作
- 多张纸币处理
- 错误案例
- 资源访问
- 快速生成
许可证
[在此处添加您的许可证]