MCP服务器临时记录
一种模型上下文协议(MCP)服务器,使AI代理能够跨对话和上下文存储和检索临时信息。
目录
目的
Temp Notes MCP Server为AI代理提供了一种简单而强大的方法,可以在多个对话中或处理超过上下文窗口限制的复杂任务时维护状态和上下文。它作为一个临时存储系统,允许代理存储笔记、清单、代码片段和其他以后可以检索的信息。
主要特点
- 跨对话的持久临时存储
- 简单的API,用于阅读、书写和附加注释
- 轻量级,易于与现有工作流集成
- 使复杂的多步骤任务能够分解为可管理的部分
快速开始
- 使用npx将服务器添加到MCP配置中(无需安装):
{
"mcpServers": {
"temp-notes": {
"command": "npx",
"args": ["-y", "@landicefu/temp-notes-mcp-server"],
"disabled": false
}
}
}- 开始在对话中使用它:
// Store information
await use_mcp_tool({
server_name: "temp-notes",
tool_name: "write_note",
arguments: { content: "Important information to remember" }
});
// Retrieve information later
const result = await use_mcp_tool({
server_name: "temp-notes",
tool_name: "read_note",
arguments: {}
});安装
选项1:与npx一起使用(无需安装)
- 将服务器添加到MCP配置中:
{
"mcpServers": {
"temp-notes": {
"command": "npx",
"args": ["-y", "@landicefu/temp-notes-mcp-server"],
"disabled": false
}
}
}此选项直接使用npx运行服务器,无需全局安装。
选项2:从npm安装
- 全局安装软件包:
npm install -g @landicefu/temp-notes-mcp-server- 将服务器添加到MCP配置中:
{
"mcpServers": {
"temp-notes": {
"command": "temp-notes-mcp-server",
"disabled": false
}
}
}选项3:从源代码安装
- 克隆存储库:
git clone https://github.com/landicefu/temp-notes-mcp-server.git
cd temp-notes-mcp-server- 安装依赖项:
npm install- 构建服务器:
npm run build- 将服务器添加到MCP配置中:
{
"mcpServers": {
"temp-notes": {
"command": "node",
"args": ["/path/to/temp-notes-mcp-server/build/index.js"],
"disabled": false
}
}
}工具
Temp Notes MCP服务器提供以下工具:
clear_note
清除当前纸币,使其为空。
{
"type": "object",
"properties": {},
"required": []
}write_note
用新字符串替换当前注释。
{
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content to write to the note"
}
},
"required": ["content"]
}read_note
返回注释的当前内容。
{
"type": "object",
"properties": {},
"required": []
}append_note
将新文本添加到当前注释中,从新行开始。可选地包括分隔线。
{
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content to append to the note"
},
"include_separator": {
"type": "boolean",
"description": "Whether to include a separator line (---) before the new content",
"default": true
}
},
"required": ["content"]
}使用示例
存储任务清单
// Store a checklist for a complex task
await use_mcp_tool({
server_name: "temp-notes",
tool_name: "write_note",
arguments: {
content: "# Project Refactoring Checklist\n\n- [ ] Analyze current architecture\n- [ ] Identify performance bottlenecks\n- [ ] Create new component structure\n- [ ] Implement data layer changes\n- [ ] Update UI components\n- [ ] Write tests\n- [ ] Document changes"
}
});检索存储的信息
// In a new conversation, retrieve the checklist
const result = await use_mcp_tool({
server_name: "temp-notes",
tool_name: "read_note",
arguments: {}
});
// Result contains the previously stored checklist更新进度
// Update the note with progress
await use_mcp_tool({
server_name: "temp-notes",
tool_name: "append_note",
arguments: {
content: "## Architecture Analysis Complete\n\nKey findings:\n- Current structure has circular dependencies\n- Data fetching is inefficient\n- Component reuse is minimal\n\nRecommendation: Implement repository pattern and component composition",
include_separator: true
}
});完成时清除注释
// Clear the note when the task is complete
await use_mcp_tool({
server_name: "temp-notes",
tool_name: "clear_note",
arguments: {}
});用例
1.复杂的编码任务
在处理复杂的编码任务时,人工智能代理经常面临上下文窗口的限制,这使得很难在一次对话中完成所有步骤。Temp Notes MCP服务器允许代理:
- 存储要完成的任务清单
- 包括每个子任务的详细说明
- 注意哪些文件需要针对特定的子任务进行检查
- 跟踪多个对话的进度
- 维护否则会丢失的重要上下文
这使得能够将复杂的任务分解为更小、更易于管理的部分,同时保持整体背景和目标。
2.对话中的语境保护
随着对话时间的延长,上下文窗口可能会变满,限制了代理维护所有相关信息的能力。使用Temp Notes MCP服务器,代理可以:
- 总结当前任务状态
- 记录已完成的步骤和剩余工作
- 存储关键见解和决策
- 概述下一步继续新对话的步骤
这允许用户在不丢失进度或不必重复信息的情况下开始新的对话。
3.跨存储库信息传输
在跨多个存储库或项目工作时,传输相关信息可能很困难。Temp Notes MCP服务器使代理能够:
- 存储来自一个存储库的代码片段
- 保存文件内容以供参考
- 记录一个项目的模式或方法,以应用于另一个项目
- 创建连接多个项目的临时文档
这有助于在不同背景下进行知识转移,而不需要复杂的设置。
4.协同工作流程
多个代理或用户可以通过以下方式在彼此的工作基础上进行构建:
- 存储中间结果供其他代理使用
- 创建可由不同代理更新的共享任务列表
- 记录供他人遵循的方法和途径
- 保持对复杂问题的共同理解
5.学习和实验
在探索新技术或方法时,代理人可以:
- 记录学习资源和参考文献
- 存储示例代码和使用模式
- 跟踪实验及其结果
- 建立技术和解决方案的知识库
6.增量文档
对于需要文件的项目,代理人可以:
- 在多个会话中逐步收集信息
- 在最终确定文档之前组织内容
- 存储可以随时间改进的草稿部分
- 从不同的交互中收集示例和用例
钞票存储
默认情况下,临时笔记MCP服务器将笔记存储在以下位置:
- 在macOS/Linux上:
~/.mcp_config/temp_notes.txt(扩展到/Users/username/.mcp_config/temp_notes.txt) - 在Windows上:
C:\Users\username\.mcp_config\temp_notes.txt
当您第一次写笔记时,会自动创建此文件。如果您尝试读取笔记时文件不存在,服务器将返回一个空字符串,并在您下次写入时创建文件。
服务器处理以下情况:
- 如果读取时文件不存在:返回空字符串
- 如果目录不存在:写入时自动创建目录结构
- 如果文件已损坏或无法访问:返回相应的错误消息
贡献
欢迎投稿!请随时提交拉取请求。
许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
