remote-mcp-mem0

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.

Category
Visit Server

README

Cloudflare Workers 远程 MCP 模板(Mem0)

利用本模板,几分钟内即可在 Cloudflare Workers 上部署一个接入 Mem0 的远程 MCP 服务器,提供记忆写入与检索工具,同时兼容 SSE 与标准 MCP 连接。

一键部署到 Cloudflare Workers

👉 点击上方按钮即可直接在 Cloudflare 控制台中创建项目,无需手动配置仓库。

English version: README.en.md

功能亮点

  • 开箱即用的 add-memorysearch-memories 工具,调用 Mem0 API 存储与检索记忆
  • 同时暴露 /sse/mcp 两种协议端点,适配 Cloudflare AI Playground 及本地 MCP 客户端
  • 可选令牌校验与本地 STDIO 模式,方便在桌面 MCP 客户端中调试

部署准备

  1. 确保你的 Cloudflare 账号已启用 Workers,并创建至少一个命名空间。
  2. 在 Mem0 后台申请 API Key,保存为环境变量 MEM0_API_KEY
  3. (可选)预设默认用户 ID:DEFAULT_USER_ID,默认为 mem0-mcp-user
  4. (可选)若需要访问控制,设置 MCP_ACCESS_TOKEN 作为 Bearer Token。

一键部署流程

  1. 登录 Cloudflare,并点击 README 顶部的 “Deploy to Workers” 按钮。
  2. 在弹出的创建页面选择你的账户和部署名称。
  3. Environment Variables 栏位填入上述变量,保存并部署。
  4. 部署完成后,Workers 会输出形如 remote-mcp-mem0.<your-account>.workers.dev 的域名:
    • SSE 端点:https://<domain>/sse
    • HTTP 端点:https://<domain>/mcp

使用 CLI 生成新项目

npm create cloudflare@latest -- <project-name> --template=eightHundreds/remote-mcp-mem0

执行后按照提示填写账号、环境变量与部署配置即可。

本地开发

  1. 安装依赖:
    npm install
    
  2. 启动本地开发环境(提供 /sse 与 /mcp 端点):
    npm run dev
    
  3. 将更改发布到 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured