使用说明
MCP Notes服务器
一个简单的MCP(消息协调协议)服务器,提供对存储在 ~/DocumentationGenerator/notes/.
设置
- 确保你安装了Python 3.7+
- 创建虚拟环境:
python -m venv venv - 激活虚拟环境:
- 在macOS/Linux上:
source venv/bin/activate - 在Windows上:
venv\Scripts\activate
- 在macOS/Linux上:
- 安装依赖项:
pip install -r requirements.txt
运行服务器
要启动MCP服务器,请执行以下操作:
python notes.py
这将启动服务器 http://0.0.0.0:8000.
API终点
服务器公开以下MCP命令:
list_notes()-获取所有笔记get_note(note_name)-按名称获取特定注释search(query, note_name=None)-按查询字符串搜索笔记
备注格式
注释以JSON文件的形式存储在指定目录中,格式如下:
{
"category": "category",
"summary": "summary of the notes",
"tags": [
{
"tag": "tag of the sub detail",
"summary": "high level business logic of the sub details",
"messages": [
{
"timestamp": "timestamp of the message",
"message": "message content"
},
{
"timestamp": "timestamp of the message",
"message": "message content"
},
...
]
}
]
}
客户端使用示例
下面是一个简单的Python示例,说明如何从客户端连接到MCP服务器:
from mcp.client import MCPClient
# Connect to the MCP server
client = MCPClient("http://localhost:8000")
# List all notes
notes = client.call("notes.list_notes")
# Get a specific note
note = client.call("notes.get_note", note_name="your-note-name")
# Search for notes
search_results = client.call("notes.search", query="important")