remote-mcp-mem0
A remote MCP server deployed on Cloudflare Workers that integrates with Mem0 to provide memory writing and retrieval tools, compatible with SSE and standard MCP connections.
README
Cloudflare Workers 远程 MCP 模板(Mem0)
利用本模板,几分钟内即可在 Cloudflare Workers 上部署一个接入 Mem0 的远程 MCP 服务器,提供记忆写入与检索工具,同时兼容 SSE 与标准 MCP 连接。
👉 点击上方按钮即可直接在 Cloudflare 控制台中创建项目,无需手动配置仓库。
English version: README.en.md
功能亮点
- 开箱即用的
add-memory和search-memories工具,调用 Mem0 API 存储与检索记忆 - 同时暴露
/sse与/mcp两种协议端点,适配 Cloudflare AI Playground 及本地 MCP 客户端 - 可选令牌校验与本地 STDIO 模式,方便在桌面 MCP 客户端中调试
部署准备
- 确保你的 Cloudflare 账号已启用 Workers,并创建至少一个命名空间。
- 在 Mem0 后台申请 API Key,保存为环境变量
MEM0_API_KEY。 - (可选)预设默认用户 ID:
DEFAULT_USER_ID,默认为mem0-mcp-user。 - (可选)若需要访问控制,设置
MCP_ACCESS_TOKEN作为 Bearer Token。
一键部署流程
- 登录 Cloudflare,并点击 README 顶部的 “Deploy to Workers” 按钮。
- 在弹出的创建页面选择你的账户和部署名称。
- 在 Environment Variables 栏位填入上述变量,保存并部署。
- 部署完成后,Workers 会输出形如
remote-mcp-mem0.<your-account>.workers.dev的域名:- SSE 端点:
https://<domain>/sse - HTTP 端点:
https://<domain>/mcp
- SSE 端点:
使用 CLI 生成新项目
npm create cloudflare@latest -- <project-name> --template=eightHundreds/remote-mcp-mem0
执行后按照提示填写账号、环境变量与部署配置即可。
本地开发
- 安装依赖:
npm install - 启动本地开发环境(提供 /sse 与 /mcp 端点):
npm run dev - 将更改发布到 Cloudflare:
npm run deploy
若需在桌面客户端中通过 STDIO 连接,可参考 src/index.ts 中的 main() 实现,使用任意兼容的 Node.js 打包方式运行生成的 index.js。
自定义工具
- 核心逻辑位于
src/index.ts,在Mem0MCP类的init()方法内通过this.server.tool(...)定义工具。 - Mem0 API 的封装实现在
src/mem0-client.ts,如需扩展数据结构或接入其他服务,可在此调整。 - 需要新增环境变量时,请同步更新
worker-configuration.d.ts以获得类型提示。
MCP 客户端接入
- Cloudflare AI Playground:访问 playground.ai.cloudflare.com,将发布后的
/sse地址粘贴到 Remote MCP Server 配置中,即可在浏览器中测试工具。 - Claude Desktop / 其他本地客户端:使用 mcp-remote 作为代理,在配置文件中加入类似以下内容:
如设置了{ "mcpServers": { "mem0": { "command": "npx", "args": [ "mcp-remote", "https://<domain>/sse" ] } } }MCP_ACCESS_TOKEN,请在args中追加--bearer <token>或设置Authorization头。
常用脚本
npm run dev:在本地使用 Wrangler 启动开发服务器。npm run deploy:将当前版本部署到 Cloudflare Workers。npm run type-check:执行 TypeScript 类型检查。npm run lint:fix/npm run format:使用 Biome 格式化与修复代码。
欢迎提交 Issue 或 PR 来改进此模板,也欢迎基于模板构建更多 MCP 工具集成。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.