🧠 高级AI内存与推理MCP服务器
一个复杂的模型上下文协议(MCP)服务器,它增强了Claude的天才级内存管理和思想树推理能力,灵感来自尖端的人工智能研究。
✨ 主要特点
🏗️ 分级存储系统
- 磁心存储器:15个插槽用于永久、始终可访问的信息
- 工作记忆:75个插槽用于本届会议
- 档案存储器:2000个插槽用于长期存储,具有智能遗忘曲线
- 智能管理:根据重要性和访问模式自动清理
🌳 思想推理之树
- 多路径分析:分析性、创造性、批判性和务实的方法
- 可配置深度:1-5级推理扩展
- 信心评分:每个推理步骤都包括信心评估
- 路径优化:自动选择最高置信度推理路径
📊 高级分析
- 会话语境分析:模式、主题和内存分布
- 认知负荷评估:任务复杂性评估及方法建议
- 内存优化:性能监控和自动调整
- 导出功能:对话记忆的备份和分析
🚀 安装
1.运行安装程序
cd /Volumes/IOSStore/MCP/advanced-ai-mcp
chmod +x setup.sh
./setup.sh2.配置克劳德桌面
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"advanced-ai-server": {
"command": "python",
"args": ["/Volumes/IOSStore/MCP/advanced-ai-mcp/advanced_mcp_server.py"],
"env": {}
}
}
}3.重新启动克劳德桌面
🛠️ 可用工具
内存管理
store_memory(content, memory_type="working", importance=0.5, tags="")
将信息存储在分层存储系统中
# Examples:
store_memory("User prefers detailed technical explanations", "core", 0.9, "preference,communication")
store_memory("Working on advanced MCP server project", "working", 0.7, "project,development")
store_memory("Research notes on Tree-of-Thought reasoning", "archival", 0.6, "research,reasoning")retrieve_memories(query="", memory_type="", limit=10)
搜索和检索存储的记忆
# Examples:
retrieve_memories("user prefer", limit=5)
retrieve_memories(memory_type="core")
retrieve_memories("project", "working", 3)高级推理
advanced_reasoning(problem, max_depth=3)
多路径思想树分析
# Examples:
advanced_reasoning("How should we improve team productivity while maintaining code quality?", 4)
advanced_reasoning("What are the key challenges in implementing AGI safely?", 5)cognitive_load_assessment(task_description)
评估任务复杂性并推荐最佳方法
# Examples:
cognitive_load_assessment("Design a distributed system architecture for real-time data processing")
cognitive_load_assessment("Write a simple function to calculate fibonacci numbers")分析工具
analyze_conversation_context()
使用存储的记忆分析当前对话
# No parameters - analyzes recent conversation patterns, topics, and memory distributionmemory_optimization()
优化内存系统性能
# No parameters - analyzes usage patterns and applies optimizationexport_conversation_memory()
导出内存以进行备份或分析
# No parameters - creates exportable summary of conversation memories💡 使用示例
基本工作流程
# 1. Store important context
store_memory("This is a technical discussion about AI reasoning systems", "working", 0.8, "context,ai,reasoning")
# 2. Analyze complex problems
advanced_reasoning("How can we create more efficient AI reasoning systems?", 4)
# 3. Monitor conversation
analyze_conversation_context()
# 4. Optimize performance
memory_optimization()项目上下文管理
# Store project requirements
store_memory("Building MCP server with memory and reasoning capabilities", "core", 0.9, "project,requirements")
# Store technical decisions
store_memory("Using SQLite for persistence, Tree-of-Thought for reasoning", "working", 0.7, "technical,decisions")
# Analyze project complexity
cognitive_load_assessment("Implement advanced AI reasoning with persistent memory management")研究与分析
# Store research findings
store_memory("OpenAI o3 achieves 87.5% on ARC-AGI benchmark using test-time compute scaling", "archival", 0.8, "research,benchmarks")
# Deep analysis
advanced_reasoning("What are the implications of test-time compute scaling for AGI development?", 5)
# Export for further analysis
export_conversation_memory()🔧 系统架构
存储器层次结构
Core Memory (15 slots)
├── Permanent user preferences
├── Key project information
└── Critical context that should never be forgotten
Working Memory (75 slots)
├── Current session context
├── Active project details
└── Recently accessed information
Archival Memory (2000 slots)
├── Historical conversation data
├── Research notes and findings
└── Long-term knowledge with forgetting curves推理系统
Tree-of-Thought Reasoning
├── Analytical: Logical structure analysis
├── Creative: Alternative perspectives and analogies
├── Critical: Assumption questioning and bias identification
└── Pragmatic: Practical implementation considerations数据库模式
-- Memory storage with metadata
memories (id, content, memory_type, importance, created_at, last_accessed, access_count, tags, context)
-- Complete reasoning chains
reasoning_chains (chain_id, step_id, content, confidence, reasoning_type, parent_step, children, created_at)⚡ 性能特点
智能内存管理
- 基于重要性的保留:高重要性记忆持续时间更长
- 访问模式优化:经常访问的记忆仍然可用
- 忘记曲线:随着时间的推移,实际内存会退化
- 自动清理:保持最佳性能
推理优化
- 基于置信度的路径选择:遵循最高置信度推理路径
- 多战略扩张:使用4种不同的认知方法
- 深度感知缩放:根据推理深度调整置信度
- 链持久性:存储完整的推理过程以供分析
实时分析
- 内存使用统计:跟踪内存分布和模式
- 推理性能指标:分析推理链的有效性
- 对话见解:确定关键主题和讨论模式
- 系统优化:自动性能调优
🔍 故障排除
常见问题
服务器未出现在Claude中:
- 检查配置文件中的JSON语法
- 验证文件路径是否绝对正确
- 完全重新启动克劳德桌面
导入错误:
cd /Volumes/IOSStore/MCP/advanced-ai-mcp
source venv/bin/activate
pip install mcp fastmcp数据库错误:
# Reset database if corrupted
rm advanced_memory.db权限错误:
chmod +x advanced_mcp_server.py
chmod +x setup.sh调试模式
编辑服务器文件以启用详细日志记录:
logging.basicConfig(level=logging.DEBUG)🛡️ 安全与隐私
- 仅限本地存储:所有数据存储在本地SQLite数据库中
- 无外部沟通:服务器完全脱机运行
- 加密存储选项:如果需要,可以加密数据库
- 访问控制:存储系统尊重重要性和访问模式
🔮 高级配置
内存限制(在服务器文件中编辑)
self.memory_limits = {
"core": 20, # Increase for more permanent memory
"working": 100, # Increase for larger working memory
"archival": 3000 # Increase for more long-term storage
}推理深度
# Allow deeper reasoning (up to 7 levels)
max_depth = max(1, min(7, max_depth))数据库位置
# Custom database path
memory_system = AdvancedMemorySystem(db_path="/custom/path/memory.db")📊 性能监控
服务器包括全面监控:
- 内存使用跟踪和优化
- 推理链分析和度量
- 对话模式识别
- 性能调整
🤝 集成提示
最佳实践
- 从上下文开始:将项目/对话上下文存储在核心内存中
- 使用适当的类型:永久核心、会议工作、历史档案
- 标签一致:使用一致的标记以更好地检索
- 评估复杂性:对复杂任务使用认知负荷评估
- 定期监测:定期运行优化和分析工具
工作流程建议
- 项目设置:将需求和上下文存储在核心内存中
- 积极工作:使用工作内存存储当前会话信息
- 复变函数:对难题应用高级推理
- 定期维护:优化内存系统并分析模式
- 知识保存:导出重要记忆进行备份
📈 实际应用
- 软件开发:项目背景、技术决策、代码审查见解
- 研究:文献笔记、假设跟踪、分析模式
- 战略规划:决策框架、选项分析、约束识别
- 学习:概念联系、技能发展跟踪、知识综合
- 问题解决:多角度分析、解决方案评估、实施规划
您的高级AI MCP服务器已准备好为Claude提供复杂的内存和推理能力! 🧠✨
