myAI内存同步
](https://smithery.ai/server/@Jktfe/myaimemory-mcp)
厌倦了每次开始新的聊天时都向克劳德重复自己的话吗? myAI Memory Sync是一个改变游戏规则的MCP工具,可以在所有Claude界面上无缝同步您的偏好、个人详细信息和代码标准!只需更新一次,您的更改就会立即出现在任何地方——从Claude Desktop到Claude Code、Windsurf和Claude.ai web。借助我们先进的缓存系统,与内存相关的查询速度提高了2000倍!停止在重复的指令上浪费代币,享受真正个性化的人工智能体验。
myAImemory mcp与其他内存工具的比较
虽然AI系统存在几种优秀的内存工具,但myAImemory mcp作为模型上下文协议(mcp)工具具有特定的用途:
| 工具 | 主要焦点 | 隐私模型 | 整合 | 独特优势 |
|---|---|---|---|---|
| myA内存mcp | 跨Claude界面的用户偏好 | 本地优先,不向外部服务器发送数据 | Claude特定的MCP | 具有高性能缓存的跨平台同步 |
| Graphiti | 时态知识图 | 数据库依赖 | 通用代理框架 | 知识表示中的时态感知 |
| Letta/MemGPT | 有状态代理框架 | 基于服务器 | 多模型支持 | 完整的代理架构 |
| Mem0 | 个性化人工智能交互 | 基于API | 多角色模型 | 多层内存层次结构 |
| Memary | 用于代理的类人记忆 | 图形数据库 | 以代理为中心 | 人类记忆模拟 |
| Cognee | AI应用程序的可靠内存 | 多种存储选项 | 以数据管道为重点 | 广泛的数据源集成 |
myAImemory mcp的主要优势:
- 隐私第一:所有数据都保留在您的设备上,个人信息不会发送到外部服务器
- 演出:利用Claude的缓存功能大幅提高速度
- 简洁:在所有Claude界面上对您的偏好进行自然语言更新
- MCP集成:专为无缝集成而打造的Claude MCP
🚀 快速开始
# Clone repository
git clone https://github.com/Jktfe/myaimemory-mcp.git
cd myaimemory-mcp
# Install dependencies
npm install
# Build TypeScript code
npm run build
# Start MCP server (with stdio transport)
npm start
# Or start with HTTP transport
npm run start:http🧠 服务器选项
统一服务器脚本支持多种选项:
# Start with stdio transport (default)
./start-server.sh
# Start with HTTP transport
./start-server.sh --http
# Start with HTTP transport on custom port
./start-server.sh --http --port=8080
# Start with direct implementation (no SDK)
./start-server.sh --direct
# Start with direct implementation and HTTP transport
./start-server.sh --direct --http
# Enable debug mode
./start-server.sh --debug🔄 直接同步方法(简单替代方案)
对于不需要运行MCP服务器的更简单的方法,您可以使用统一的CLI:
# One-time sync of all memory files
npm run sync
# Or for emergency sync (fixes permissions)
npm run sync:emergency此脚本将:
- 读取“myAI Master.md”文件
- 更新项目中的所有CLAUDE.md文件
- 更新您的Windsurf内存设置
- 所有这些都不需要在git存储库中存储敏感信息
🔒 隐私与安全
- 包含您个人信息的“myAI Master.md”文件不在git跟踪范围内
- 为了保护您的隐私,所有CLAUDE.md文件也被排除在外
- 使用随附的
.gitignore确保敏感文件保持私密
🗣️ 支持的自然语言命令
您可以使用以下自然语言模式与myAI Memory进行交互:
| 命令模式 | 示例 | 目的 |
|---|---|---|
Use myAI Memory to remember [information] | “使用myAI内存记住我更喜欢TypeScript而不是JavaScript” | 根据内容将信息添加到相应的部分 |
Remember that [information] | “记住我住在伦敦” | 为记忆添加信息的更短替代方案 |
Add to my memory that [information] | “添加到我的记忆中,我有两辆车” | 另一种添加信息到记忆中的方法 |
Use myAI Memory to add to [section] [information] | “使用myAI内存添加到编码首选项我更喜欢黑暗模式” | 将信息添加到特定部分 |
Update my [section] to include that [information] | “更新我的用户信息,包括我的生日是3月29日” | 用新信息更新特定部分 |
注意:要在所有平台上执行完全同步,请使用命令行: node sync-memory.js
You: Use myAI Memory to remember I prefer TypeScript over JavaScript
Claude: ✅ Added to your Coding Preferences! I'll remember you prefer TypeScript over JavaScript.📋 安装选项
选项1:直接安装(推荐)
从npm安装:
npm install -g myai-memory-sync启动服务器:
# Start with stdio transport (default)
myai
# Start with HTTP transport
myai server --transport http
# Process memory commands
myai remember "I prefer dark mode"
# Sync across platforms
myai sync选项2:从源代码运行
从源代码克隆和构建:
git clone https://github.com/Jktfe/myaimemory-mcp.git
cd myaimemory-mcp
npm install
npm run build
npm start # Start with stdio transport
# or
npm run start:http # Start with HTTP transport选项3:Docker
使用Docker构建和运行:
docker build -t myai-memory-sync .
docker run -v myai-memory:/app/data -p 3000:3000 myai-memory-sync🔌 MCP配置
Claude桌面配置
将此添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"myai-memory-sync": {
"command": "npx",
"args": [
"-y",
"myai"
],
"env": {
"TEMPLATE_PATH": "/path/to/custom/template.md",
"ENABLE_ANTHROPIC": "true",
"ANTHROPIC_API_KEY": "your-api-key-here"
}
}
}
}Claude.ai与Smithery
- 访问 Smithery.ai
- 添加myAI内存同步MCP:
@Jktfe/myaimemory-mcp- 在Smithery设置中使用API密钥进行配置
Windsurf集成
在Windsurf中,添加您的 .codeium/config.json:
{
"mcp": {
"servers": {
"myai-memory-sync": {
"command": "npx",
"args": [
"-y",
"myai"
]
}
}
}
}HTTP服务器模式
对于HTTP传输而不是stdio:
# Using npm scripts:
npm run start:http
# Using the unified CLI:
myai server --transport http
# Using the shell script with custom port:
./start-server.sh --http --port=8080
# Using environment variable:
PORT=8080 npm run start:http环境变量
创建一个 .env 具有以下选项的文件:
# Basic configuration
DEBUG=true # Enable debug logging
TEMPLATE_PATH=./data/template.md # Custom template location
PORT=3000 # Port for HTTP transport (default: 3000)
USE_DIRECT=true # Use direct implementation (no SDK)
# Platform-specific paths
WINDSURF_MEMORY_PATH=~/.codeium/windsurf/memories/global_rules.md
CLAUDE_PROJECTS_PATH=~/CascadeProjects
# Performance optimization
ENABLE_ANTHROPIC=true # Enable Anthropic API integration
ANTHROPIC_API_KEY=your-api-key # Your Anthropic API key
ENABLE_PROMPT_CACHE=true # Enable prompt caching system
CACHE_TTL=300000 # Cache TTL in milliseconds (5 minutes)
# Claude web sync (optional)
CLAUDE_WEB_SYNC_ENABLED=false # Enable Claude.ai web synchronization
CLAUDE_WEB_EMAIL=you@email.com # Your Claude.ai email
CLAUDE_WEB_HEADLESS=true # Run browser in headless mode🧙♂️ 系统快速集成
为了获得最佳效果,请将以下内容添加到您的Claude系统提示中:
Memory Integration Instructions:
When you receive a command that starts with "use myAI Memory to", you should:
1. Process the rest of the instruction as a memory management command
2. Try to determine the appropriate section to update based on the content
3. Use the myAI Memory Sync MCP to update your memory
4. Confirm the update with a brief acknowledgment
For example:
"use myAI Memory to remember I prefer dark mode"
→ Update the preferences section with dark mode preference
When asked questions about preferences or personal information, first check your memory via the myAI Memory Sync MCP. Always reference information from memory rather than making assumptions.✨ 特性
- 🔄 跨平台同步:更新一次,到处同步
- ⚡ 闪电般快速召回:缓存系统性能提升高达2000倍
- 🗣️ 自然语言接口:只需自然交谈即可更新您的偏好
- 🧩 多个人资料:轻松在不同预设之间切换
- 🔐 注重安全:具有.gitignore保护的本地存储
- 🛠️ 开发者友好:具有全面API的完整TypeScript实现
🧩 核心架构
myAI内存同步使用具有以下关键组件的模块化架构:
- 模板解析器:结构化内存对象和markdown之间的双向转换
- 模板存储:具有内存和文件系统缓存的持久存储
- 平台同步器:实现
PlatformSyncer每个目标平台的界面 - 语言处理器:从自然语言内存命令中提取结构化数据
- 内存缓存服务:通过多级缓存策略优化性能
🔍 详细功能
跨平台同步
- ClaudeCodeSyncer:更新所有存储库中的CLAUDE.md文件
- WindsurfSyncer:在Windsurf环境中管理global_rules.md
- ClaudeWebyncer:可选的基于Puppeter的与Claude.ai web界面的同步
智能内存管理
- 基于模式的提取:将自然语言转换为结构化键值对
- 截面检测算法:自动确定新记忆的适当部分
- 内存模板格式:基于Markdown的结构,包括部分、描述和键值项
- 上下文保护:更新内存部分,同时保留其他模板内容
性能优化
- 多级缓存:模板和节级别的内存缓存
- 基于TTL的缓存管理:缓存内容的可配置生存时间
- 预热:模板更新后缓存预填充
- 可选的Anthropic API集成:将与内存相关的查询速度提高到2000倍
安全
- 当地第一建筑:所有数据都保留在您的设备上
- Gitignore管理:自动将CLAUDE.md添加到所有存储库中的.gitignore
- 文件权限处理:修复权限问题以实现最大兼容性
- 加密存储:与加密文件系统兼容
📋 内存模板格式
系统使用结构化的markdown格式来组织您的偏好:
# myAI Memory
# User Information
## Use this information if you need to reference them directly
-~- Name: Your Name
-~- Location: Your Location
-~- Likes: Reading, Hiking, Technology
# General Response Style
## Use this in every response
-~- Style: Friendly and concise
-~- Use UK English Spellings: true
-~- Include emojis when appropriate: true
# Coding Preferences
## General Preference when responding to coding questions
-~- I prefer TypeScript over JavaScript
-~- Show step-by-step explanations🛠️ 技术实现
内存模板架构
interface MemoryTemplate {
sections: TemplateSection[];
}
interface TemplateSection {
title: string;
description: string;
items: TemplateItem[];
}
interface TemplateItem {
key: string;
value: string;
}平台同步接口
interface PlatformSyncer {
sync(templateContent: string): Promise;
}
type PlatformType = 'claude-web' | 'claude-code' | 'windsurf' | 'master';
interface SyncStatus {
platform: PlatformType;
success: boolean;
message: string;
}🔌 MCP集成API
myAI内存同步工具实现了具有以下功能的模型上下文协议(MCP):
| 功能 | 说明 | 参数 |
|---|---|---|
get_template | 检索完整内存模板 | 无 |
get_section | 检索特定节 | sectionName: string |
update_section | 更新特定部分 | sectionName: string, content: string |
update_template | 替换整个模板 | content: string |
list_presets | 列出可用预设 | 无 |
load_preset | 加载特定预设 | presetName: string |
create_preset | 创建新预设 | presetName: string |
sync_platforms | 跨平台同步 | platform?: string |
list_platforms | 列出可用平台 | 无 |
自然语言接口
用户可以通过自然语言命令与系统交互:
You: Use myAI Memory to remember I prefer TypeScript over JavaScript
Claude: ✅ Added to your Coding Preferences! I'll remember you prefer TypeScript over JavaScript.
You: Use myAI Memory to load preset developer
Claude: ✅ Loaded developer preset! I'll now use your developer preferences.🧙♂️ 高级用法
内存预设
轻松在不同角色之间切换:
You: Use myAI Memory to list presets
Claude: Available presets: personal, work, developer
You: Use myAI Memory to load preset developer
Claude: ✅ Loaded developer preset!紧急同步
当您需要修复所有平台的同步问题时:
# Sync everything immediately
./emergency-sync.sh命令行接口
# View all available commands
node dist/cli.js --help
# Process memory commands directly
node dist/cli.js --remember "remember I prefer dark mode"
# Start HTTP server for SSE transport
npm run start:http
# Start stdio server for MCP transport
npm run start开发工作流程
# Run in development mode with auto-reload
npm run dev
# Run in development mode with HTTP server
npm run dev:http
# Watch TypeScript compilation
npm run build:watch
# Run tests
npm test
# Run specific test
npm test -- -t "platformSync"
# Lint code
npm run lint
# Type check without emitting files
npm run typecheck⚡ 性能基准
我们的缓存系统提供了令人难以置信的性能改进:
| 操作 | 无缓存 | 有缓存 | 改进 |
|---|---|---|---|
| 内存查询 | ~2000ms | ~1ms | 2000x |
| 分段查找 | ~1600ms | ~0.8ms | 2000x |
| 模板解析 | ~120ms | ~0.1ms | 1200x |
| 平台同步 | ~850ms | ~350ms | 2.4x |
🔒 安全与隐私
我们认真对待您的隐私:
- 所有数据都保留在您的设备上
- CLAUDE.md文件会自动添加到.gitignore中
- 不向外部服务器发送数据(使用可选的Anthropic API集成时除外)
- 与加密文件系统配合使用,实现最高安全性
🛠️ 故障排除
常见问题
- CLAUDE.md未更新
- 检查文件权限 ls -la CLAUDE.md - 尝试与进行紧急同步 ./emergency-sync.sh - 验证您的平台路径 .env 文件
- MCP连接故障
- 确保MCP服务器正在运行 ps aux | grep myai-memory - 检查Claude Desktop日志中的MCP错误 - 验证您的Claude Desktop配置文件
- 缓存问题
- 使用清除缓存 node dist/cli.js --clear-cache - 验证Anthropic API密钥设置正确 - 使用检查内存文件完整性 node dist/cli.js --validate
- 自然语言命令不起作用
- 确保使用支持的命令模式之一(请参阅支持的自然语言命令部分) - 如果克劳德无法识别您的命令,请尝试其他模式 - 要跨所有平台同步,请使用direct脚本: node sync-memory.js
手动同步
如果您在使用自然语言命令或MCP服务器时遇到问题:
# Direct sync approach (most reliable)
cd /path/to/myAImemory
node sync-memory.js
# Alternative emergency sync (if permissions need fixing)
cd /path/to/myAImemory
./safe-memory.sh sync这些方法直接从主文件读取并更新所有平台,而不依赖于MCP服务器或自然语言处理。
日志和调试
启用调试模式以查看详细日志:
DEBUG=true npm run start日志文件存储在:
- Linux/macOS:
~/.local/share/myai-memory/logs/ - 窗户:
%APPDATA%\myai-memory\logs\
🤝 贡献
欢迎投稿!请随时提交拉取请求。
- 分叉存储库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add some amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
我们遵循标准的Git工作流程和CI流程:
- 所有PR都需要通过测试和测试
- 新功能应包括测试
- 重大变更应更新文件
- 遵循现有的代码风格和模式
📚 文档
有关更详细的文档,请参阅 维基.
API文档可在 /docs 目录:
# Generate API documentation
npm run docs📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
📬 联系
项目链接:
______________________________________________________________________
Made with ❤️ for the AI community
