Skip to main content
Glama

Brain-MCP

Memory Control Protocol - AI记忆思维管理系统,模拟类人思维记忆过程

❌ 没有Brain-MCP

AI缺乏持久的记忆能力,每次对话都是全新的开始。您会遇到:

❌ 无法记住之前的对话内容

❌ 无法建立知识之间的关联

❌ 无法进行连续的思维过程

❌ 无法学习和积累经验

Related MCP server: celiums-memory

✅ 使用Brain-MCP

Brain-MCP为AI提供完整的记忆管理系统,支持短期记忆、长期记忆和思维过程管理:

✅ 短期记忆: FIFO队列式临时缓存,容量可配置

✅ 长期记忆: 基于图结构的持久化存储,支持关联和搜索

✅ 思维过程管理: 完整的思维链管理系统,支持多类型思考节点

✅ 自动持久化: 每次修改记忆都会自动保存

✅ 认知模式: 支持分析、直觉、创造、批判、元认知等多种模式

🚀 快速开始

要求

  • Node.js >= v18.0.0

  • Claude Desktop、Cursor、VSCode或其他MCP客户端

配置

{
  "mcpServers": {
    "brain": {
      "command": "npx",
      "args": ["-y", "digital-brain-mcp"],
      "env": {
        "BRAIN_MCP_STORAGE_PATH":"./memory_data"
      }
    }
  }
}

🔨 可用工具

Brain-MCP提供以下工具供AI使用:

短期记忆工具

  • addShortTermMemory: 添加临时记忆到短期缓存

  • getShortTermMemory: 获取所有短期记忆(最新优先)

  • clearShortTermMemory: 清空短期记忆

长期记忆工具

  • addLongTermMemory: 创建新的持久化记忆节点

  • getLongTermMemory: 根据ID获取记忆及其关联

  • searchLongTermMemory: 关键词搜索记忆

  • updateLongTermMemory: 更新记忆内容和关联

  • deleteLongTermMemory: 删除记忆节点

  • getAssociations: 获取节点的直接关联

思维过程工具

  • startThoughtProcess: 启动新的思维链

  • addThought: 向思维链添加思考节点

  • branchThought: 从现有思考创建分支

  • evaluateThought: 评估并更新思考的置信度

  • completeThoughtProcess: 完成思维过程并存储结论

  • getCurrentThoughtChain: 获取思维链的当前状态

  • pauseThinking: 暂停活跃的思维过程

  • resumeThinking: 恢复暂停的思维过程

  • switchCognitiveMode: 切换认知模式

  • getOptimalModeForTask: 获取任务推荐的最佳认知模式

  • getThinkingProgress: 获取思维链的进度统计

  • getActiveChains: 获取所有活跃的思维链

  • getThinkingStats: 获取思维过程的总体统计信息

系统管理工具

  • saveMemory: 手动保存记忆到磁盘

  • getMemoryStats: 获取记忆系统统计信息

💡 使用示例

基本记忆操作

// 添加短期记忆
await mcp.addShortTermMemory("用户询问天气情况");

// 添加长期记忆并建立关联
const memoryId = await mcp.addLongTermMemory("北京夏天炎热", ["weather-memory-id"]);

// 搜索记忆
const results = await mcp.searchLongTermMemory("炎热");

思维过程管理

// 启动思维过程
const chainId = await mcp.startThoughtProcess("设计用户友好的产品界面");

// 添加思考节点
await mcp.addThought(chainId, "从用户角度思考主要使用场景", "analysis");
await mcp.addThought(chainId, "采用简约设计风格", "decision");

// 创建分支探索替代方案
const branchId = await mcp.branchThought(thoughtId, "尝试创新交互模式");

// 完成思维过程
await mcp.completeThoughtProcess(chainId, "选择平衡方案:简约为主,适度创新");

🛟 提示

自动保存

所有修改记忆的操作都会自动保存到本地存储,确保数据不会丢失。

记忆关联

使用关联功能建立知识之间的联系,支持深度检索和智能推荐。

思维模式

根据任务类型选择合适的认知模式:

  • 分析模式: 深度推理,多角度分析

  • 直觉模式: 快速联想,模式识别

  • 创造模式: 发散思维,概念组合

  • 批判模式: 质疑验证,逻辑检查

  • 元认知模式: 思考自己的思考过程

💻 开发

克隆项目并安装依赖:

git clone https://github.com/DDguan2010/brain-mcp.git
cd brain-mcp
npm install

构建:

npm run build

运行服务器:

npm start

CLI参数

brain-mcp接受以下CLI参数:

  • --port – 服务器端口(默认3000)

  • --storage-path – 存储路径(默认./memory_data)

  • --auto-save-interval – 自动保存间隔(默认5分钟)

示例:

npm start -- --port 8080 --storage-path ./my_memory

环境变量

可以使用以下环境变量:

  • NODE_ENV: 运行环境(development/production)

  • BRAIN_MCP_STORAGE_PATH: 存储路径

  • BRAIN_MCP_AUTO_SAVE_INTERVAL: 自动保存间隔

示例:

NODE_ENV=production BRAIN_MCP_STORAGE_PATH=./data npm start

🏗️ 架构设计

brain-mcp/
├── src/
│   ├── types.ts              # 类型定义
│   ├── config.ts             # 配置管理
│   ├── short-term-memory.ts  # 短期记忆管理
│   ├── long-term-memory.ts   # 长期记忆管理
│   ├── thinking-process.ts   # 思维过程管理
│   ├── storage.ts            # 文件持久化
│   └── brain-mcp.ts          # 主模块
└── server.ts                 # MCP服务器

📄 许可证

MIT License

🤝 贡献

欢迎提交Issue和Pull Request!


Made by 0.2Studio

Available Tools

24 tools
addLongTermMemoryAdd Long-Term MemoryB

Create a new persistent memory node with optional associations to other nodes

Inputs: text (required), associations. Returns: data, error, success

addShortTermMemoryAdd Short-Term MemoryB

Add a temporary memory to the short-term cache (FIFO, limited capacity)

Inputs: text (required). Returns: error, success

addThoughtAdd ThoughtB

Add a thought to an existing thought chain

Inputs: chainId (required), thought (required), type (required), parentThoughtId, +1 more. Returns: data, error, success

branchThoughtBranch ThoughtB

Create a branch from an existing thought to explore alternative paths

Inputs: thoughtId (required), newThought (required), type, confidence. Returns: data, error, success

clearShortTermMemoryClear Short-Term MemoryB

Clear all short-term memories

Inputs: no named parameters. Returns: error, success

completeThoughtProcessComplete Thought ProcessB

Mark a thought process as complete and store the conclusion

Inputs: chainId (required), conclusion (required). Returns: error, success

deleteLongTermMemoryDelete Long-Term MemoryB

Delete a memory node and remove it from all associations

Inputs: id (required). Returns: error, success

evaluateThoughtEvaluate ThoughtC

Evaluate and update the confidence level of a thought

Inputs: thoughtId (required), confidence (required), reasoning (required). Returns: error, success

getActiveChainsGet Active Thought ChainsB

Get all currently active thought chains

Inputs: no named parameters. Returns: data, error, success

getAssociationsGet Memory AssociationsB

Get all direct association IDs of a memory node

Inputs: id (required). Returns: data, error, success

getCurrentThoughtChainGet Current Thought ChainB

Retrieve the current state of a thought chain with all thoughts

Inputs: chainId (required). Returns: data, error, success

getLongTermMemoryGet Long-Term MemoryB

Retrieve a memory node by ID with its associations up to specified depth

Inputs: id (required), depth. Returns: data, error, success

getMemoryStatsGet Memory StatisticsB

Get statistics about the memory system

Inputs: no named parameters. Returns: data, error, success

getOptimalModeForTaskGet Optimal Cognitive ModeB

Get the recommended cognitive mode for a specific task type

Inputs: taskType (required). Returns: data, error, success

getShortTermMemoryGet Short-Term MemoryB

Retrieve all short-term memories (newest first)

Inputs: no named parameters. Returns: data, error, success

getThinkingProgressGet Thinking ProgressB

Get progress statistics for a thought chain

Inputs: chainId (required). Returns: data, error, success

getThinkingStatsGet Thinking StatisticsB

Get overall thinking process statistics

Inputs: no named parameters. Returns: data, error, success

pauseThinkingPause ThinkingB

Pause an active thought process

Inputs: chainId (required), reason (required). Returns: error, success

resumeThinkingResume ThinkingB

Resume a paused thought process

Inputs: chainId (required). Returns: error, success

saveMemorySave Memory to DiskB

Manually trigger saving all long-term memories to disk

Inputs: no named parameters. Returns: error, success

searchLongTermMemorySearch Long-Term MemoryB

Search memory nodes by keyword (text matching)

Inputs: keyword (required), limit, caseSensitive. Returns: data, error, success

startThoughtProcessStart Thought ProcessB

Start a new thought process chain with a goal

Inputs: goal (required), context. Returns: data, error, success

switchCognitiveModeSwitch Cognitive ModeC

Switch the cognitive mode for thinking processes

Inputs: mode (required), chainId. Returns: error, success

updateLongTermMemoryUpdate Long-Term MemoryB

Update a memory node's text and/or associations

Inputs: id (required), newText, newAssociations. Returns: error, success

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists. For example, 'getThinkingProgress' and 'getThinkingStats' both provide statistics about thinking processes, which could cause confusion. However, the descriptions clarify that one focuses on a specific thought chain while the other gives overall statistics, helping to differentiate them.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, such as 'addLongTermMemory', 'getActiveChains', and 'updateLongTermMemory'. All tools use camelCase with clear, descriptive verbs and nouns, making them predictable and easy to understand.

    Tool Count3/5

    With 24 tools, the count is borderline high for a cognitive processing server. While the domain is complex, this many tools might feel heavy and could overwhelm agents, though each tool appears to serve a specific function in memory and thought management.

    Completeness5/5

    The tool set provides comprehensive coverage for cognitive processing, including CRUD operations for memories (add, get, update, delete), thought chain management (start, branch, complete, pause, resume), and system monitoring (stats, progress). There are no obvious gaps, supporting full lifecycle management of thoughts and memories.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables persistent memory for AI systems by providing tools for episodic, semantic, and procedural data storage through a vector-and-graph-enhanced database. It allows models to maintain long-term continuity using similarity search, thematic clustering, and identity tracking.
      24
      1
      -
    • A
      license
      A
      quality
      C
      maintenance
      Cognitive memory engine for AI agents with 5,100+ knowledge modules, circadian rhythm awareness, emotional state tracking (PAD model), and hybrid semantic search. Supports persistent per-user memory, project-scoped contexts, and multi-protocol access.
      26
      23
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Provides persistent memory capabilities for AI assistants, enabling storage, recall, and analysis of information across conversations with intelligent memory management.
      25
      14 npm
      MIT