Mnemo
██╗ ██████╗ ██████╗ ██████╗ ███████╗
██║ ██╔═══██╗██╔════╝ ██╔═══██╗██╔════╝
██║ ██║ ██║██║ ███╗██║ ██║███████╗
██║ ██║ ██║██║ ██║██║ ██║╚════██║
███████╗╚██████╔╝╚██████╔╝╚██████╔╝███████║
╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
███████╗██╗ ██╗ ██╗██╗ ██╗
██╔════╝██║ ██║ ██║╚██╗██╔╝
█████╗ ██║ ██║ ██║ ╚███╔╝
██╔══╝ ██║ ██║ ██║ ██╔██╗
██║ ███████╗╚██████╔╝██╔╝ ██╗
╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝Mnemo
通过 Gemini 上下文缓存 为 AI 助手提供扩展内存。
Mnemo(希腊语:记忆)利用 Gemini 的 1M token 上下文窗口和上下文缓存功能,让 Claude 等 AI 助手能够访问大型代码库、文档网站、PDF 等内容。
为什么选择 Mnemo?
Mnemo 没有采用带有嵌入和检索的复杂 RAG 管道,而是采取了一种更简单的方法:
将整个代码库加载到 Gemini 的上下文缓存中
使用自然语言进行查询
让 Claude 进行编排,同时由 Gemini 保持上下文
这为您带来:
完美回溯 - 无需分块或检索,意味着不会丢失上下文
更低延迟 - 缓存的上下文可以快速提供服务
节省成本 - 缓存的 token 成本比常规输入 token 低 75-90%
简单易用 - 无需向量数据库、嵌入或复杂的检索逻辑
Related MCP server: Heimdall MCP Server
Mnemo 可以加载什么?
来源 | 本地服务器 | Worker |
GitHub 仓库(公开) | ✅ | ✅ |
GitHub 仓库(私有) | ✅ | ✅ |
任何 URL(文档、文章) | ✅ | ✅ |
PDF 文档 | ✅ | ✅ |
JSON API | ✅ | ✅ |
本地文件/目录 | ✅ | ❌ |
多页面抓取 | ✅ 无限制 | ✅ 最多 40 页 |
部署选项
根据您的需求,Mnemo 可以通过三种方式部署。
选项 1:本地服务器(开发与完整功能)
最适合开发以及需要加载本地文件时使用。
# Clone and install
git clone https://github.com/logos-flux/mnemo
cd mnemo
bun install
# Set your Gemini API key
export GEMINI_API_KEY=your_key_here
# Start the server
bun run devClaude Code MCP 配置:
{
"mcpServers": {
"mnemo": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
}选项 2:自托管 Cloudflare Worker(推荐用于 Claude.ai)
部署到您自己的 Cloudflare 账户。您可以控制自己的数据和成本。
先决条件:
Cloudflare 账户(免费层级即可)
# Clone and install
git clone https://github.com/logos-flux/mnemo
cd mnemo/packages/cf-worker
# Configure secrets
bunx wrangler secret put GEMINI_API_KEY
bunx wrangler secret put MNEMO_AUTH_TOKEN # Optional but recommended
# Create D1 database
bunx wrangler d1 create mnemo-cache
# Deploy
bunx wrangler deployClaude.ai MCP 配置:
{
"mcpServers": {
"mnemo": {
"type": "http",
"url": "https://mnemo.<your-subdomain>.workers.dev/mcp",
"headers": {
"Authorization": "Bearer YOUR_AUTH_TOKEN"
}
}
}
}为什么要使用此选项? Claude.ai 无法连接到 localhost。Worker 为您提供了一个 Claude.ai 可以访问的外部端点。
选项 3:托管服务(VIP)
不想管理基础设施?我们为特定客户提供完全托管的 Mnemo 服务。
包括:
专属 Worker 部署
优先支持
自定义域名
使用情况监控
联系方式: lf@logosflux.io 获取定价和可用性信息。
使用示例
# Load a GitHub repo
curl -X POST http://localhost:8080/tools/context_load \
-H "Content-Type: application/json" \
-d '{"source": "https://github.com/honojs/hono", "alias": "hono"}'
# Load a documentation site (crawls up to token target)
curl -X POST http://localhost:8080/tools/context_load \
-H "Content-Type: application/json" \
-d '{"source": "https://hono.dev/docs", "alias": "hono-docs"}'
# Load a PDF
curl -X POST http://localhost:8080/tools/context_load \
-H "Content-Type: application/json" \
-d '{"source": "https://arxiv.org/pdf/2303.08774.pdf", "alias": "gpt4-paper"}'
# Load a private repo (with GitHub token)
curl -X POST http://localhost:8080/tools/context_load \
-H "Content-Type: application/json" \
-d '{"source": "https://github.com/owner/private-repo", "alias": "private", "githubToken": "ghp_xxx"}'
# Load multiple sources into one cache
curl -X POST http://localhost:8080/tools/context_load \
-H "Content-Type: application/json" \
-d '{"sources": ["https://github.com/owner/repo", "https://docs.example.com"], "alias": "combined"}'
# Query the cache
curl -X POST http://localhost:8080/tools/context_query \
-H "Content-Type: application/json" \
-d '{"alias": "hono", "query": "How do I add middleware?"}'
# List active caches
curl -X POST http://localhost:8080/tools/context_list \
-H "Content-Type: application/json" -d '{}'
# Get usage stats with cost tracking
curl -X POST http://localhost:8080/tools/context_stats \
-H "Content-Type: application/json" -d '{}'
# Evict when done
curl -X POST http://localhost:8080/tools/context_evict \
-H "Content-Type: application/json" \
-d '{"alias": "hono"}'CLI
# Start server
mnemo serve
# Start MCP stdio transport (for Claude Desktop)
mnemo stdio
# Load a project
mnemo load ./my-project my-proj
# Query
mnemo query my-proj "What's the main entry point?"
# List caches
mnemo list
# Remove cache
mnemo evict my-projMCP 工具
工具 | 描述 |
| 将 GitHub 仓库、URL、PDF 或本地目录加载到 Gemini 缓存中 |
| 使用自然语言查询缓存的上下文 |
| 列出所有带有 token 计数和过期时间的活动缓存 |
| 移除缓存 |
| 获取带有成本跟踪的使用统计信息 |
| 使用最新内容重新加载缓存 |
context_load 参数
参数 | 描述 |
| 单一来源:GitHub URL、任何 URL 或本地路径 |
| 合并到一个缓存中的多个来源 |
| 此缓存的友好名称(1-64 个字符) |
| 生存时间(秒)(60-86400,默认 3600) |
| 用于私有仓库的 GitHub token |
| 查询的自定义系统提示词 |
配置
变量 | 描述 | 默认值 |
| 您的 Gemini API 密钥 | 必需 |
| 服务器端口(仅限本地) | 8080 |
| 数据目录(仅限本地) | ~/.mnemo |
| 受保护端点的身份验证 token | 无 |
身份验证
当配置了 MNEMO_AUTH_TOKEN 时,/mcp 和 /tools/* 端点需要身份验证:
# Set auth token (Workers)
bunx wrangler secret put MNEMO_AUTH_TOKEN
# Requests must include header:
Authorization: Bearer your-token-here公共端点(无需身份验证):
GET /health- 健康检查GET /- 服务信息GET /tools- 列出可用工具
成本
无论选择哪种部署方式,您都需要支付 Gemini API 使用费用。 Mnemo 使用 Gemini 的上下文缓存,这比标准输入便宜得多:
资源 | 成本 |
缓存存储 | 每 1M token 每小时约 $4.50 |
缓存输入 | 比常规输入优惠 75-90% |
常规输入 | 每 1M token 约 $0.075 (Flash) |
示例: 100K token 的代码库缓存 1 小时并进行 10 次查询 ≈ $0.47
Cloudflare 成本(自托管):
Workers:免费层级包含每天 100K 次请求
D1:免费层级包含每天 5M 次读取
中等使用量下可能为 $0
架构
┌─────────────────────────────────────────────────────────────┐
│ Mnemo │
├─────────────────────────────────────────────────────────────┤
│ MCP Tools │
│ • context_load - Load into Gemini cache │
│ • context_query - Query cached context │
│ • context_list - Show active caches │
│ • context_evict - Remove cache │
│ • context_stats - Token usage, costs │
│ • context_refresh - Reload cache │
├─────────────────────────────────────────────────────────────┤
│ Adapters (v0.2) │
│ • GitHub repos (via API) │
│ • URL loading (HTML, PDF, JSON, text) │
│ • Token-targeted crawling │
│ • robots.txt compliance │
├─────────────────────────────────────────────────────────────┤
│ Packages │
│ • @mnemo/core - Gemini client, loaders, adapters │
│ • @mnemo/mcp-server - MCP protocol handling │
│ • @mnemo/cf-worker - Cloudflare Workers deployment │
│ • @mnemo/local - Bun-based local server │
└─────────────────────────────────────────────────────────────┘许可证
MIT
致谢
由 Logos Flux | Voltage Labs 构建
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Project memory, documentation and controlled secret access for AI coding agents.
1Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Your portable context layer — load it into any AI.
Related MCP Servers
- AlicenseBqualityCmaintenanceProvides AI assistants with persistent memory of your project architecture, development history, and technical decisions, allowing them to give context-aware coding help without needing repeated explanations.1661 npm2MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.105Apache 2.0
- AlicenseCqualityAmaintenanceGives AI coding assistants persistent project memory and semantic code search, running fully locally with no API keys required.56MIT
- AlicenseNot gradedqualityBmaintenanceLoads entire codebase into LLM context for AI-assisted code understanding and editing.8 npm17MIT