MCP 笔记服务器
一个基于 Python SDK 的 Model Context Protocol (MCP) 服务器实现,提供持久化笔记管理功能。
快速入门
安装
- 确保已安装 Python 3.10 或更高版本。
- 创建虚拟环境:
- Unix/MacOS:
python -m venv .venv && source .venv/bin/activate
- Windows:
python -m venv .venv && .venv\Scripts\activate
- Unix/MacOS:
- 安装依赖:
pip install MCP
启动服务器
运行以下命令启动服务器:
mcp install src/notes
mcp start Notes
基本操作
- 创建笔记:
await client.call_tool("add-note", {"name": "example", "content": "This is a test note"})
- 列出所有笔记:
await client.call_tool("list-all-notes")
- 更新笔记:
await client.call_tool("update-note", {"name": "example", "content": "Updated content"})
- 删除笔记:
await client.call_tool("delete-note", {"name": "example"})
笔记存储在 notes_storage.json
文件中。