feat: add MCP integration for MemoryService#376
Open
De13ruyne wants to merge 14 commits intoNevaMind-AI:mainfrom
Open
feat: add MCP integration for MemoryService#376De13ruyne wants to merge 14 commits intoNevaMind-AI:mainfrom
De13ruyne wants to merge 14 commits intoNevaMind-AI:mainfrom
Conversation
…d --embed-base-url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Pull Request Summary
Add MCP (Model Context Protocol) integration to expose memU's MemoryService as a set of MCP tools, enabling MCP-compatible clients (memUBot, Cursor, Claude Desktop, etc.) to interact with memU's memory capabilities directly.

✅ What does this PR do?
src/memu/integrations/mcp.py, 387 lines): Implements an MCP Server using FastMCP, exposing 8 memory operation tools —memorize,retrieve,list_memories,list_categories,create_memory,update_memory,delete_memory, andclear_memory.memu-mcp): Supports configuration via command-line arguments or environment variables for LLM settings (API key, base URL, model, separate embedding provider) and storage backends (inmemory / sqlite / postgres), with both stdio and SSE MCP transports.manifest.json): Provides a standard MCP server descriptor so that Cursor and other MCP clients can discover and install memU with one click.MCPUserModel): Addsagent_idandsession_idfields on top of the standarduser_id, enabling memory isolation across multiple agents and sessions.pyproject.toml: Adds themcpoptional dependency group (mcp>=1.0,python-dotenv>=1.0), registers thememu-mcpscript entry point, and adds mypy/deptry configuration for the new dependencies.src/memu/integrations/__init__.py): Replaced eagerfrom .langgraph import ...with__getattr__-based lazy import, preventingModuleNotFoundErrorwhen langgraph is not installed (e.g. in MCP-only environments).src/memu/app/crud.py): Added the missingresource_idargument tocreate_memory_itemcall, which was causing failures when creating memory items via the MCPcreate_memorytool.🤔 Why is this change needed?
memu-mcpas an MCP server.agent_id+session_idscoping design makes memory isolation in multi-agent scenarios work out of the box.🔍 Type of Change
✅ PR Quality Checklist
manifest.jsonserves as MCP client configuration documentation)📌 Optional
Follow-up suggestions:
README.mdanddocs/.examples/.manifest.jsoncurrently points to a fork's feature branch (De13ruyne/memU@feat/add_mcp). After merging, update it to reference the main repository or switch to a PyPI package install.