Skip to main content
Glama

MemOS-MCP

by qinshu1109
Apache 2.0
3
  • Linux
  • Apple
README.md10.1 kB
# MemOS - MCP Integration MemOS记忆系统的MCP(Model Context Protocol)集成版本,专为个人AI助手场景优化。 基于原始[MemOS项目](https://github.com/MemTensor/MemOS),针对Claude Desktop和MCP协议进行了深度优化。 ## 🚀 特性 ### 核心功能 - **智能记忆管理**: 基于向量数据库的语义记忆存储和检索 - **MCP协议支持**: 完整的Model Context Protocol集成 - **多模型支持**: 支持Qwen3、SiliconFlow等多种嵌入和重排模型 - **时间感知检索**: 基于时间衰减的智能记忆排序 - **缓存优化**: LRU缓存系统,显著提升检索性能 ### 技术架构 - **分层设计**: 表示层、业务逻辑层、数据访问层的清晰分离 - **MVP管理器**: 统一的记忆管理接口,支持增强版和基础版自动切换 - **容量管理**: 智能的记忆容量管理和自动压缩 - **并发控制**: 多进程安全的并发访问控制 - **Website**: https://memos.openmem.net/ - **Documentation**: https://memos-docs.openmem.net/home/overview/ - **API Reference**: https://memos-docs.openmem.net/docs/api/info/ - **Source Code**: https://github.com/MemTensor/MemOS ## 📈 Performance Benchmark MemOS demonstrates significant improvements over baseline memory solutions in multiple reasoning tasks. | Model | Avg. Score | Multi-Hop | Open Domain | Single-Hop | Temporal Reasoning | |-------------|------------|-----------|-------------|------------|---------------------| | **OpenAI** | 0.5275 | 0.6028 | 0.3299 | 0.6183 | 0.2825 | | **MemOS** | **0.7331** | **0.6430** | **0.5521** | **0.7844** | **0.7321** | | **Improvement** | **+38.98%** | **+6.67%** | **+67.35%** | **+26.86%** | **+159.15%** | > 💡 **Temporal reasoning accuracy improved by 159% compared to the OpenAI baseline.** ### Details of End-to-End Evaluation on LOCOMO > [!NOTE] > Comparison of LLM Judge Scores across five major tasks in the LOCOMO benchmark. Each bar shows the mean evaluation score judged by LLMs for a given method-task pair, with standard deviation as error bars. MemOS-0630 consistently outperforms baseline methods (LangMem, Zep, OpenAI, Mem0) across all task types, especially in multi-hop and temporal reasoning scenarios. <img src="https://statics.memtensor.com.cn/memos/score_all_end2end.jpg" alt="END2END SCORE"> ## ✨ Key Features - **🧠 Memory-Augmented Generation (MAG)**: Provides a unified API for memory operations, integrating with LLMs to enhance chat and reasoning with contextual memory retrieval. - **📦 Modular Memory Architecture (MemCube)**: A flexible and modular architecture that allows for easy integration and management of different memory types. - **💾 Multiple Memory Types**: - **Textual Memory**: For storing and retrieving unstructured or structured text knowledge. - **Activation Memory**: Caches key-value pairs (`KVCacheMemory`) to accelerate LLM inference and context reuse. - **Parametric Memory**: Stores model adaptation parameters (e.g., LoRA weights). - **🔌 Extensible**: Easily extend and customize memory modules, data sources, and LLM integrations. ## 🚀 Getting Started Here's a quick example of how to create a **`MemCube`**, load it from a directory, access its memories, and save it. ```python from memos.mem_cube.general import GeneralMemCube # Initialize a MemCube from a local directory mem_cube = GeneralMemCube.init_from_dir("examples/data/mem_cube_2") # Access and print all memories print("--- Textual Memories ---") for item in mem_cube.text_mem.get_all(): print(item) print("\n--- Activation Memories ---") for item in mem_cube.act_mem.get_all(): print(item) # Save the MemCube to a new directory mem_cube.dump("tmp/mem_cube") ``` What about **`MOS`** (Memory Operating System)? It's a higher-level orchestration layer that manages multiple MemCubes and provides a unified API for memory operations. Here's a quick example of how to use MOS: ```python from memos.configs.mem_os import MOSConfig from memos.mem_os.main import MOS # init MOS mos_config = MOSConfig.from_json_file("examples/data/config/simple_memos_config.json") memory = MOS(mos_config) # create user user_id = "b41a34d5-5cae-4b46-8c49-d03794d206f5" memory.create_user(user_id=user_id) # register cube for user memory.register_mem_cube("examples/data/mem_cube_2", user_id=user_id) # add memory for user memory.add( messages=[ {"role": "user", "content": "I like playing football."}, {"role": "assistant", "content": "I like playing football too."}, ], user_id=user_id, ) # Later, when you want to retrieve memory for user retrieved_memories = memory.search(query="What do you like?", user_id=user_id) # output text_memories: I like playing football, act_memories, para_memories print(f"text_memories: {retrieved_memories['text_mem']}") ``` For more detailed examples, please check out the [`examples`](./examples) directory. ## 📦 Installation > [!WARNING] > MemOS is compatible with Linux, Windows, and macOS. > > However, if you're using macOS, please note that there may be dependency issues that are difficult to resolve. > > For example, compatibility with macOS 13 Ventura is currently challenging. ### Install via pip ```bash pip install MemoryOS ``` ### Development Install To contribute to MemOS, clone the repository and install it in editable mode: ```bash git clone https://github.com/MemTensor/MemOS.git cd MemOS make install ``` ### Optional Dependencies #### Ollama Support To use MemOS with [Ollama](https://ollama.com/), first install the Ollama CLI: ```bash curl -fsSL https://ollama.com/install.sh | sh ``` #### Transformers Support To use functionalities based on the `transformers` library, ensure you have [PyTorch](https://pytorch.org/get-started/locally/) installed (CUDA version recommended for GPU acceleration). ## 💬 Community & Support Join our community to ask questions, share your projects, and connect with other developers. - **GitHub Issues**: Report bugs or request features in our <a href="https://github.com/MemTensor/MemOS/issues" target="_blank">GitHub Issues</a>. - **GitHub Pull Requests**: Contribute code improvements via <a href="https://github.com/MemTensor/MemOS/pulls" target="_blank">Pull Requests</a>. - **GitHub Discussions**: Participate in our <a href="https://github.com/MemTensor/MemOS/discussions" target="_blank">GitHub Discussions</a> to ask questions or share ideas. - **Discord**: Join our <a href="https://discord.gg/Txbx3gebZR" target="_blank">Discord Server</a>. - **WeChat**: Scan the QR code to join our WeChat group. <img src="https://statics.memtensor.com.cn/memos/qr-code.png" alt="QR Code" width="600"> ## 📜 Citation > [!NOTE] > We publicly released the Short Version on **May 28, 2025**, making it the earliest work to propose the concept of a Memory Operating System for LLMs. If you use MemOS in your research, we would appreciate citations to our papers. ```bibtex @article{li2025memos_long, title={MemOS: A Memory OS for AI System}, author={Li, Zhiyu and Song, Shichao and Xi, Chenyang and Wang, Hanyu and Tang, Chen and Niu, Simin and Chen, Ding and Yang, Jiawei and Li, Chunyu and Yu, Qingchen and Zhao, Jihao and Wang, Yezhaohui and Liu, Peng and Lin, Zehao and Wang, Pengyuan and Huo, Jiahao and Chen, Tianyi and Chen, Kai and Li, Kehang and Tao, Zhen and Ren, Junpeng and Lai, Huayi and Wu, Hao and Tang, Bo and Wang, Zhenren and Fan, Zhaoxin and Zhang, Ningyu and Zhang, Linfeng and Yan, Junchi and Yang, Mingchuan and Xu, Tong and Xu, Wei and Chen, Huajun and Wang, Haofeng and Yang, Hongkang and Zhang, Wentao and Xu, Zhi-Qin John and Chen, Siheng and Xiong, Feiyu}, journal={arXiv preprint arXiv:2507.03724}, year={2025}, url={https://arxiv.org/abs/2507.03724} } @article{li2025memos_short, title={MemOS: An Operating System for Memory-Augmented Generation (MAG) in Large Language Models}, author={Li, Zhiyu and Song, Shichao and Wang, Hanyu and Niu, Simin and Chen, Ding and Yang, Jiawei and Xi, Chenyang and Lai, Huayi and Zhao, Jihao and Wang, Yezhaohui and others}, journal={arXiv preprint arXiv:2505.22101}, year={2025}, url={https://arxiv.org/abs/2505.22101} } @article{yang2024memory3, author = {Yang, Hongkang and Zehao, Lin and Wenjin, Wang and Wu, Hao and Zhiyu, Li and Tang, Bo and Wenqiang, Wei and Wang, Jinbo and Zeyun, Tang and Song, Shichao and Xi, Chenyang and Yu, Yu and Kai, Chen and Xiong, Feiyu and Tang, Linpeng and Weinan, E}, title = {Memory$^3$: Language Modeling with Explicit Memory}, journal = {Journal of Machine Learning}, year = {2024}, volume = {3}, number = {3}, pages = {300--346}, issn = {2790-2048}, doi = {https://doi.org/10.4208/jml.240708}, url = {https://global-sci.com/article/91443/memory3-language-modeling-with-explicit-memory} } ``` ## 🙌 Contributing We welcome contributions from the community! Please read our [contribution guidelines](https://memos-docs.openmem.net/contribution/overview) to get started. ## 📄 License MemOS is licensed under the [Apache 2.0 License](./LICENSE). ## 📰 News Stay up to date with the latest MemOS announcements, releases, and community highlights. - **2025-07-07** – 🎉 *MemOS 1.0 (Stellar) Preview Release*: A SOTA Memory OS for LLMs is now open-sourced. - **2025-07-04** – 🎉 *MemOS Paper Released*: [MemOS: A Memory OS for AI System](https://arxiv.org/abs/2507.03724) was published on arXiv. - **2025-05-28** – 🎉 *Short Paper Uploaded*: [MemOS: An Operating System for Memory-Augmented Generation (MAG) in Large Language Models](https://arxiv.org/abs/2505.22101) was published on arXiv. - **2024-07-04** – 🎉 *Memory3 Model Released at WAIC 2024*: The new memory-layered architecture model was unveiled at the 2024 World Artificial Intelligence Conference. - **2024-07-01** – 🎉 *Memory3 Paper Released*: [Memory3: Language Modeling with Explicit Memory](https://arxiv.org/abs/2407.01178) introduces the new approach to structured memory in LLMs.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/qinshu1109/memos-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server