CoreMemory-MCP
Provides a local, persistent long-term memory service for MCP-compatible AI agents, enabling them to store, search, and recall information across sessions.
README
✨ CoreMemory-MCP
A local, MCP-compliant, long-term memory service for AI agents.
💡 What is CoreMemory-MCP?
CoreMemory-MCP is a background service that provides a simple and persistent long-term memory for any AI agent that supports the Model Context Protocol (MCP). It allows tools like Cursor, Gemini-CLI, and Claude Code-Cli to retain and recall information across sessions.
It runs as a standalone server on your local machine, acting as a language-agnostic, pluggable brain for your favorite AI tools.
⚙️ How It Works
The architecture is a standard client-server model based on the MCP standard:
[Your Agent / IDE] <--> [MCP (JSON-RPC over HTTP)] <--> [Core Memory Service]
- You run the Core Memory service.
- You configure your client application (e.g., Cursor, Gemini-CLI) to connect to the service.
- Your client application can then discover and execute the memory tools (
memory.add,memory.search, etc.) provided by the service.
🚀 Installation
⚠️ Note: The package is not yet published to PyPI. The following are the planned installation methods.
It is recommended to install the package via pip once it is published:
pip install core-memory-mcp
Alternatively, for development, you can clone the repository and install it in editable mode:
git clone https://github.com/michaelfeng/CoreMemory-MCP.git
cd CoreMemory-MCP
pip install -e .
▶️ Running the Service
If you installed the package via pip, you can start the service by running the following command in your terminal:
core-memory-server
If you are running from the source code, you can also run the script directly:
python memory_service.py
You will see output indicating the service is running and ready to accept connections:
--- Starting Core Memory MCP Service ---
Compatible with the Model Context Protocol.
Listening on http://127.0.0.1:5001
Access the API at the /mcp endpoint.
Use Ctrl+C to stop.
⚠️ Important: Keep this terminal window open. The service needs to be running in the background for your clients to connect to it.
🔌 Configuring Your Client
Here are specific instructions for popular tools that support MCP.
For Gemini-CLI
The Google Gemini CLI can be configured to automatically start and use MCP servers. After installing this package, you can configure Gemini-CLI to use it.
- Open the Gemini CLI settings file, typically located at
~/.gemini/settings.json. - Add an entry to the
mcp_serverslist that points to thecore-memory-servercommand.
Example settings.json:
{
"mcp_servers": [
{
"name": "CoreMemory",
"command": [
"core-memory-server"
]
}
]
}
(This assumes that the core-memory-server command is available in your system's PATH, which is standard after a pip install.)
- Save the file. The next time you run
gemini, it will automatically start the memory service and have access to thememory.*tools.
For Cursor
Cursor uses MCP for its deep AI integrations. To connect CoreMemory-MCP, you can configure it as a tool source.
- In Cursor, open the settings (e.g., via
Cmd/Ctrl + ,). - Search for settings related to "Tools", "AI Sources", or "MCP".
- Look for an option to "Add a new MCP Server" or "Tool Provider".
- In the configuration, provide the address of your running Core Memory service:
http://127.0.0.1:5001/mcp. - Save the settings. Cursor should now be able to discover and use the
memory.*tools.
(Note: Cursor's UI for this may evolve. Please refer to their official documentation for the most up-to-date instructions on adding external MCP tool providers.)
For Claude Code-Cli
Claude Code-Cli also supports MCP for external tooling. The configuration process is expected to be similar to Gemini-CLI, likely involving a central configuration file where you can declare MCP servers.
- Locate the main configuration file for Claude Code-Cli (e.g., it might be in
~/.claude/config.json). - Add an entry for the Core Memory MCP server, similar to the Gemini-CLI example.
Hypothetical config.json for Claude Code-Cli:
{
"mcp_servers": [
{
"name": "CoreMemory",
"address": "http://127.0.0.1:5001/mcp"
}
]
}
(Note: This is a hypothetical example. Please consult the specific documentation for Claude Code-Cli on how to register an already running MCP server.)
🤝 Integration with FastMCP
FastMCP is another framework that is compatible with the Model Context Protocol (MCP). Because CoreMemory-MCP also follows the MCP standard, they are compatible and can work together.
Here's what you need to know as a user:
-
Full Compatibility: You can use any
fastmcp-based client to connect to your localCoreMemory-MCPservice. The integration is seamless because both tools "speak" the same protocol. -
No Changes for Existing Users: If you are already using
CoreMemory-MCPwith clients like Cursor or Gemini-CLI, this integration does not change anything for you. Your existing setup will continue to work as before. -
Connecting a
fastmcpClient: To connect afastmcpclient to this service, you will need to provide the client with the address of your localCoreMemory-MCPserver, which is typicallyhttp://127.0.0.1:5001/mcp. -
Local vs. Cloud:
CoreMemory-MCPis designed to be a local-first memory service, meaning your data stays on your machine. Whilefastmcpoffers a cloud service, please be aware that if you use it, your data might be sent to their servers. You have the choice to keep your memory local by runningCoreMemory-MCP.
💬 How to Use (Interaction)
⌨️ Command-Based Interaction (Recommended)
For more precise control, you can use slash commands directly in your chat with the agent. This is the recommended way to interact with the memory service as it avoids ambiguity.
- /cortex add: Saves a new memory.
- /cortex search: Searches for memories.
- /cortex list: Lists all memories.
Examples:
> /cortex add "The project deadline is next Friday"
> /cortex search "deadline"
> /cortex list
(Note: This functionality depends on the agent's implementation to parse these commands and call the corresponding memory.* tools. This feature is planned for clients like Gemini-CLI.)
🗣️ Natural Language Interaction
You can also interact with the memory service through natural language. The agent will do its best to understand your intent and call the appropriate tool.
- To save a memory:
> remember that the project deadline is next Friday - To search for a memory:
> what did I say about the project deadline?
Your agent, now aware of the memory.add and memory.search tools, will call your local Core Memory service to fulfill these requests.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。