内容
# rmcp-memex
[](https://crates.io/crates/rmcp-memex) [](LICENSE) [](https://crates.io/crates/rmcp-memex) [](https://github.com/VetCoders/rmcp-memex/actions)
`rmcp-memex` 是一个自定义的 Rust MCP 内核,为 AI 代理提供 RAG 和长期记忆能力,通过 LanceDB 实现。
它暴露了两种明确的传输模式,从单一的规范表面:
1. **`stdio` (标准 MCP)**:本地代理的原生 MCP 集成(例如 Claude Desktop)。
2. **`HTTP/SSE` (多代理守护进程)**:一种中央守护进程模式,允许多个 AI 代理通过网络访问同一个内存池,解决了 LanceDB 的独占锁约束。
> **二进制名称:** `rmcp-memex` 是唯一受支持的二进制名称。GitHub 安装程序还会创建 `rmcp_memex` 作为旧脚本的兼容性符号链接。
>
> **MCP 合同:** 当前的 MCP 表面故意仅限于工具。`initialize` 广告宣传 `tools`,而 `resources/*` 尚未实现。
## 发布表面
- 快速安装:`curl -LsSf https://raw.githubusercontent.com/VetCoders/rmcp-memex/main/install.sh | sh`
- 预编译二进制包:[GitHub Releases](https://github.com/VetCoders/rmcp-memex/releases) 从本地构建和签名的工件上传
- 发布运行手册:[docs/RELEASE.md](docs/RELEASE.md)
- 配置指南:[docs/02_configuration.md](docs/02_configuration.md)
- HTTP/SSE 参考:[docs/HTTP_API.md](docs/HTTP_API.md)
- 静态启动页面源:`docs/index.html` 由 `.github/workflows/pages.yml` 发布
## 快速开始
```bash
# 从最新的 GitHub Release 安装
curl -LsSf https://raw.githubusercontent.com/VetCoders/rmcp-memex/main/install.sh | sh
# 启动 MCP 服务器
rmcp-memex serve
# 在浏览器中打开本地仪表板
rmcp-memex dashboard
# 或运行多代理 HTTP/SSE 守护进程
rmcp-memex sse
```
## 概述
作为 MCP(模型上下文协议)服务器,`rmcp-memex` 提供:
- **RAG(检索增强生成)** - 文档索引和语义搜索
- **混合搜索** - BM25 关键词 + 语义向量搜索(基于 Tantivy)
- **向量内存** - 文本块的语义存储和检索
- **命名空间隔离** - 命名空间中的数据隔离
- **安全** - 受保护命名空间的基于令牌的访问控制
- **洋葱切片架构** - 分层嵌入(OUTER→MIDDLE→INNER→CORE)
- **预处理** - 会话导出自动噪声过滤(约 36-40% 减少)
- **精确匹配去重** - 基于 SHA256 的重叠导出去重
## 架构
```
┌─────────────────────────────────────────────────────────────┐
│ rmcp-memex │
├─────────────────────────────────────────────────────────────┤
│ MCP 服务器(JSON-RPC via stdio) │
│ ├── handlers/mod.rs - 请求路由和验证 │
│ ├── security/mod.rs - 命名空间访问控制 │
│ └── rag/mod.rs - RAG 管道 │
├─────────────────────────────────────────────────────────────┤
│ 存储层 │
│ ├── LanceDB - 向量嵌入 │
│ ├── Tantivy - BM25 关键词索引 │
│ └── moka - 内存缓存 │
├─────────────────────────────────────────────────────────────┤
│ 嵌入(外部提供者) │
│ ├── Ollama - 本地模型(推荐) │
│ ├── MLX Bridge - Apple Silicon 加速 │
│ └── OpenAI-compatible - 任何兼容端点 │
└─────────────────────────────────────────────────────────────┘
```
## 功能
### RAG 工具
| 工具 | 描述 |
|------|-------------|
| `rag_index` | 从文件索引文档 |
| `rag_index_text` | 索引原始文本 |
| `rag_search` | 语义搜索文档(支持 `auto_route`) |
### 内存工具
| 工具 | 描述 |
|------|-------------|
| `memory_upsert` | 在命名空间中添加/更新块 |
| `memory_get` | 通过 ID 获取块 |
| `memory_search` | 在命名空间中语义搜索(支持 `auto_route`) |
| `memory_delete` | 删除块 |
| `memory_purge_namespace` | 删除命名空间中的所有块 |
| `dive` | 使用所有洋葱层(外部/中间/内部/核心)进行深度探索 |
### 安全工具
| 工具 | 描述 |
|------|-------------|
| `namespace_create_token` | 为命名空间创建访问令牌 |
| `namespace_revoke_token` | 撤销令牌(命名空间变为公共) |
| `namespace_list_protected` | 列出受保护的命名空间 |
| `namespace_security_status` | 安全系统状态 |
## 库使用
`rmcp-memex` 可以在 Rust 应用程序中作为库使用。它为向量存储操作提供了一个高级别的 `MemexEngine` API。
### 添加到 Cargo.toml
```toml
# 带有 CLI 的完整库
rmcp-memex = "0.5"
# 库(无 CLI 依赖)
rmcp-memex = { version = "0.5", default-features = false }
```
### 基本用法
```rust
use rmcp_memex::{MemexEngine, MemexConfig, MetaFilter, StoreItem};
use serde_json::json;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// 快速设置任何应用程序
let engine = MemexEngine::for_app("my-app", "documents").await?;
// 存储文档
engine.store(
"doc-1",
"Patient presented with lethargy and decreased appetite",
json!({"patient_id": "P-123", "visit_type": "checkup"})
).await?;
// 语义搜索
let results = engine.search("lethargy symptoms", 10).await?;
for r in &results {
println!("{}: {} (score: {:.2})", r.id, r.text, r.score);
}
// 通过 ID 获取
if let Some(doc) = engine.get("doc-1").await? {
println!("Found: {}", doc.text);
}
// 删除
engine.delete("doc-1").await?;
Ok(())
}
```
### Vista 集成
对于 Vista PIMS,使用优化的构造函数:
```rust
use rmcp_memex::MemexEngine;
// Vista 优化:1024 维度,qwen3-embedding:0.6b 模型
let engine = MemexEngine::for_vista().await?;
// 存储访问笔记
engine.store(
"visit-456",
"SOAP note: Feline diabetes mellitus diagnosis...",
json!({"patient_id": "P-789", "doc_type": "soap_note"})
).await?;
```
### 批量操作
```rust
use rmcp_memex::{MemexEngine, StoreItem};
use serde_json::json;
let engine = MemexEngine::for_app("my-app", "notes").await?;
let items = vec![
StoreItem::new("doc-1", "第一个文档").with_metadata(json!({"type": "note"})),
StoreItem::new("doc-2", "第二个文档").with_metadata(json!({"type": "note"})),
StoreItem::new("doc-3", "第三个文档").with_metadata(json!({"type": "note"})),
];
let result = engine.store_batch(items).await?;
println!("Stored {} documents", result.success_count);
```
### GDPR 合规删除
```rust
use rmcp_memex::{MemexEngine, MetaFilter};
let engine = MemexEngine::for_app("my-app", "patients").await?;
// 删除特定患者的所有文档
let filter = MetaFilter::for_patient("P-123");
let deleted = engine.delete_by_filter(filter).await?;
println!("Deleted {} documents", deleted);
```
### 混合搜索(BM25 + 向量)
```rust
use rmcp_memex::{MemexEngine, SearchMode};
let engine = MemexEngine::for_app("my-app", "documents").await?;
// 混合搜索与 BM25 + 向量融合(推荐)
let results = engine.search_hybrid("dragon mac studio", 10).await?;
for r in &results {
println!("{}: {} (combined: {:.2}, vector: {:.2}, bm25: {:.2})",
r.id, r.document, r.combined_score, r.vector_score, r.bm25_score);
}
// 显式模式选择
let results = engine.search_with_mode("exact keyword", 10, SearchMode::Keyword).await?;
let results = engine.search_with_mode("semantic concept", 10, SearchMode::Vector).await?;
let results = engine.search_with_mode("best of both", 10, SearchMode::Hybrid).await?;
```
### MCP 合同和进程内帮助程序
在需要 `rmcp-memex` 暴露的精确 MCP 工具元数据时使用 `tool_definitions()`。下面的帮助程序函数适用于进程内 Rust 调用者;它们是本地便捷层,不是第二个公共 MCP 合同。它们的名字故意与 MCP 工具名称不同,以免两个表面意外漂移。
```rust
use rmcp_memex::{MemexEngine, search_documents, store_document, tool_definitions};
use serde_json::json;
let engine = MemexEngine::for_app("agent", "memory").await?;
// 规范的 MCP 工具表面由 rmcp-memex 传输暴露
let tools = tool_definitions();
assert!(tools.iter().any(|tool| tool.name == "memory_upsert"));
// 进程内 Rust 调用者的本地帮助程序
let result = store_document(
&engine,
"mem-1".to_string(),
"Important information to remember".to_string(),
json!({"source": "conversation"}),
).await?;
assert!(result.success);
let results = search_documents(&engine, "important".to_string(), 5, None).await?;
```
### 功能标志
| 功能 | 描述 | 默认 |
|---------|-------------|---------|
| `cli` | CLI 二进制文件,TUI 向导,进度条 | 是 |
| `provider-cascade` | Ollama/OpenAI 兼容嵌入 | 是 |
```bash
# 仅构建库(无 CLI)
cargo build --no-default-features
# 构建 CLI
cargo build --features cli
```
---
## 配置指南
在任何 Rust 项目中集成 `rmcp-memex` 作为库的完整指南。
### 先决条件
**Ollama** (推荐)或任何 OpenAI 兼容的嵌入 API:
```bash
# 安装 Ollama
curl -fsSL https://ollama.com/install.sh | sh
# 拉取嵌入模型(根据您的需求选择)
ollama pull qwen3-embedding:0.6b # 1024 维度,~600MB(快速,良好质量)
ollama pull qwen3-embedding:8b # 4096 维度,~4GB(最佳质量)
ollama pull nomic-embed-text # 768 维度,~274MB(轻量级)
# 验证它正在运行
curl http://localhost:11434/api/tags
```
### 环境变量
通过 `.env` 或环境配置:
```bash
# =============================================================================
# 嵌入提供者配置
# =============================================================================
# Ollama(默认,推荐)
OLLAMA_BASE_URL=http://localhost:11434
EMBEDDING_MODEL=qwen3-embedding:0.6b
EMBEDDING_DIMENSION=1024
# 数据库存储(自动创建)
MEMEX_DB_PATH=~/.rmcp-servers/myapp/lancedb
# 可选:BM25 关键词搜索索引
MEMEX_BM25_PATH=~/.rmcp-servers/myapp/bm25
# =============================================================================
# 高级:多个提供者(回退级联)
# =============================================================================
# 远程嵌入服务器回退
# DRAGON_BASE_URL=http://your-server.local
# DRAGON_EMBEDDER_PORT=12345
# 用于 Apple Silicon 的 MLX 嵌入器
# EMBEDDER_PORT=12300
# MLX_MAX_BATCH_CHARS=32000
# MLX_MAX_BATCH_ITEMS=16
# DISABLE_MLX=1 # 设置以禁用 MLX 回退
```
### 快速开始(自动配置)
```rust
use rmcp_memex::MemexEngine;
use serde_json::json;
// 从默认值 + 环境自动配置
let engine = MemexEngine::for_app("my-app", "default").await?;
engine.store("doc-1", "Document content...", json!({"type": "note"})).await?;
let results = engine.search("content", 10).await?;
```
### 自定义配置
```rust
use rmcp_memex::{MemexConfig, MemexEngine};
use rmcp_memex::embeddings::{EmbeddingConfig, ProviderConfig};
// 从应用程序环境读取
let ollama_url = std::env::var("OLLAMA_BASE_URL")
.unwrap_or_else(|_| "http://localhost:11434".to_string());
let model = std::env::var("EMBEDDING_MODEL")
.unwrap_or_else(|_| "qwen3-embedding:0.6b".to_string());
let dimension: usize = std::env::var("EMBEDDING_DIMENSION")
.unwrap_or_else(|_| "1024".to_string())
.parse()
.unwrap_or(1024);
let db_path = std::env::var("MEMEX_DB_PATH")
.unwrap_or_else(|_| "~/.rmcp-servers/myapp/lancedb".to_string());
let config = MemexConfig {
app_name: "my-app".to_string(),
namespace: "default".to_string(),
db_path: Some(db_path),
dimension,
embedding_config: EmbeddingConfig {
required_dimension: dimension,
providers: vec![ProviderConfig {
name: "ollama".to_string(),
base_url: ollama_url,
model,
priority: 1,
endpoint: "/v1/embeddings".to_string(),
}],
..EmbeddingConfig::default()
},
enable_bm25: false,
bm25_config: None,
};
let engine = MemexEngine::new(config).await?;
```
### 提供者级联(多个回退)
配置多个提供者 - 库按优先级顺序尝试它们:
```rust
use rmcp_memex::embeddings::{EmbeddingConfig, ProviderConfig};
let config = EmbeddingConfig {
required_dimension: 1024,
providers: vec![
// 优先级 1:本地 Ollama(最快)
ProviderConfig {
name: "ollama-local".to_string(),
base_url: "http://localhost:11434".to_string(),
model: "qwen3-embedding:0.6b".to_string(),
priority: 1,
endpoint: "/v1/embeddings".to_string(),
},
// 优先级 2:远程服务器回退
ProviderConfig {
name: "remote-server".to_string(),
base_url: "http://your-server:8080".to_string(),
model: "text-embedding-3-small".to_string(),
priority: 2,
endpoint: "/v1/embeddings".to_string(),
},
// 优先级 3:OpenAI API 回退
ProviderConfig {
name: "openai".to_string(),
base_url: "https://api.openai.com".to_string(),
model: "text-embedding-3-small".to_string(),
priority: 3,
endpoint: "/v1/embeddings".to_string(),
},
],
..EmbeddingConfig::default()
};
```
### 命名空间策略
**推荐:每个应用程序一个命名空间,使用元数据进行过滤:**
```rust
// ✅ 正确:单个命名空间,按 user_id/entity_id 在元数据中过滤
let engine = MemexEngine::for_app("my-app", "default").await?;
// 存储具有实体 ID 的元数据
engine.store("doc-1", "Document content...", json!({
"user_id": "U-123", // 用于多租户过滤
"project_id": "P-456", // 用于项目级过滤
"doc_type": "note",
"created_at": "2024-12-28"
})).await?;
// 在用户上下文中搜索
let filter = MetaFilter::default().with_custom("user_id", "U-123");
let results = engine.search_filtered("query", filter, 10).await?;
// GDPR 删除:删除所有用户数据
let deleted = engine.delete_by_filter(
MetaFilter::default().with_custom("user_id", "U-123")
).await?;
```
### 嵌入模型参考
| 模型 | 维度 | 大小 | 用例 |
|-------|------------|------|----------|
| `qwen3-embedding:0.6b` | 1024 | ~600MB | 快速,良好质量(推荐) |
| `qwen3-embedding:8b` | 4096 | ~4GB | 最佳质量,速度较慢 |
| `nomic-embed-text` | 768 | ~274MB | 轻量级,快速 |
| `mxbai-embed-large` | 1024 | ~670MB | 良好的多语言支持 |
| `all-minilm` | 384 | ~46MB | 非常快,较低质量 |
### 故障排除
**错误:没有可用的嵌入提供者**
```bash
# 检查 Ollama 是否正在运行
curl http://localhost:11434/api/tags
# 启动 Ollama
ollama serve
# 如果缺少,拉取模型
ollama pull qwen3-embedding:0.6b
```
**错误:维度不匹配**
- LanceDB 维度在创建后固定每个表
- 为不同维度使用不同的 `db_path`
- 删除旧数据库以更改维度
**错误:连接被拒绝**
```bash
# Linux
systemctl status ollama
systemctl start ollama
# macOS
brew services info ollama
brew services start ollama
# 或手动运行
ollama serve
```
**性能调优:**
```bash
# 更大的批次(需要更多 VRAM)
MLX_MAX_BATCH_CHARS=64000
MLX_MAX_BATCH_ITEMS=32
```
---
## 快速开始
### 安装
**快速安装(推荐):**
```bash
curl -LsSf https://raw.githubusercontent.com/VetCoders/rmcp-memex/main/install.sh | sh
```
从 GitHub Release 包构建是规范的安装路径,避免在目标机器上编译完整的 LanceDB 重型 Rust 依赖图。
**从源码(仅限开发):**
```bash
cargo install --path .
```
### 运行
```bash
# 规范的 MCP 表面
rmcp-memex serve
# 启用安全
rmcp-memex serve --security-enabled
# 带有 HTTP/SSE 服务器的多代理访问
rmcp-memex serve --http-port 8997
# 纯 HTTP 守护进程模式(无 MCP stdio)
rmcp-memex serve --http-port 8997 --http-only
```
`rmcp-memex` 始终暴露一个规范的 MCP 工具表面。要限制运行时访问,请使用 `--allowed-paths`、HTTP 认证或命名空间安全,而不是单独的“内存/完整”模式切换。
## HTTP/SSE 服务器(多代理访问)
LanceDB 使用排他文件锁 - 只有一个进程可以同时访问数据库。
HTTP/SSE 服务器通过提供多个代理的中央访问点解决了这个问题。
架构
```
┌─────────────────────────────────────────────────────────────┐
│ rmcp-memex 守护进程 │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ MCP 服务器 │ │ HTTP/SSE │ │
│ │ (标准输入输出) │ │ (端口 8997) │ │
│ └────────┬────────┘ └────────┬────────┘ │
│ │ │ │
│ └──────────┬───────────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ RAG流水线 │ ← 单个锁持有者 │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ LanceDB │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
▲ ▲
│ │
Claude 桌面版 HTTP 代理
(MCP 标准输入输出) (curl, fetch)
```
### HTTP 端点
| 端点 | 方法 | 描述 |
|----------|--------|-------------|
| `/health` | GET | 健康检查(状态,数据库路径,嵌入式提供程序) |
| `/search` | POST | 搜索,支持可选的 `project`、`layer` 和 `deep` 过滤器(支持 `k` 别名) |
| `/sse/search` | GET | SSE 流式搜索,支持可选的 `project`、`layer` 和 `deep` 过滤器 |
| `/upsert` | POST | 添加/更新文档 |
| `/index` | POST | 完整的流水线索引,包含洋葱切片 |
| `/expand/{ns}/{id}` | GET | 展开洋葱切片(获取子节点) |
| `/parent/{ns}/{id}` | GET | 向上钻取至父切片 |
| `/get/{ns}/{id}` | GET | 按 ID 获取文档 |
| `/delete/{ns}/{id}` | POST | 删除文档 |
| `/ns/{namespace}` | DELETE | 清除整个命名空间 |
### MCP-over-SSE 端点(Claude Code 兼容性)
| 端点 | 方法 | 描述 |
|----------|--------|-------------|
| `/sse/` | GET | SSE 流 - 发送 `endpoint` 事件与消息 URL |
| `/messages/` | POST | JSON-RPC 消息,附带 `?session_id=xxx` |
在 `~/.claude.json` 中配置:
```json
{
"mcpServers": {
"rmcp-memex": {
"type": "sse",
"url": "http://localhost:8997/sse/"
}
}
}
```
### 使用示例
```bash
# 打开本地仪表盘
rmcp-memex dashboard --db-path ~/.ai-memories/lancedb
# 启动守护进程
rmcp-memex sse --db-path ~/.ai-memories/lancedb &
# 健康检查
curl http://localhost:8997/health
# 存储文档
curl -X POST http://localhost:8997/upsert \
-H "Content-Type: application/json" \
-d '{"namespace": "agent1", "id": "mem1", "content": "重要上下文..."}'
# 搜索
curl -X POST http://localhost:8997/search \
-H "Content-Type: application/json" \
-d '{"query": "上下文", "namespace": "agent1", "k": 10, "project": "Vista", "deep": true}'
# SSE 流式搜索
curl -N "http://localhost:8997/sse/search?query=上下文&namespace=agent1&limit=5&project=Vista&layer=1"
```
### 多主机数据库路径
对于多机器设置(例如 dragon、mgbook16),使用每台主机的数据库路径:
```bash
# 每台主机路径(每台机器拥有自己的数据库)
rmcp-memex serve --db-path ~/.ai-memories/lancedb.$(hostname -s)
# 或使用向导进行与机器无关的配置
rmcp-memex wizard
```
TUI 向导自动检测主机名并提供:
- **共享模式**:`~/.ai-memories/lancedb`(所有路径相同)
- **每台主机模式**:`~/.ai-memancedb.dragon`、`~/.ai-memories/lancedb.mgbook16` 等
### 配置(TOML)
```toml
# ~/.rmcp-servers/rmcp-memex/config.toml
db_path = "~/.rmcp-servers/rmcp-memex/lancedb"
cache_mb = 4096
log_level = "info"
# 允许路径的白名单
allowed_paths = [
"~",
"/Volumes/ExternalDrive/data"
]
# 安全
security_enabled = true
token_store_path = "~/.rmcp-servers/rmcp-memex/tokens.json"
```
## 文档
- [01_security.md](./01_security.md) - 安全系统(命名空间令牌)
- [02_configuration.md](./02_configuration.md) - 配置和 CLI 选项
## 洋葱切片架构
而不是传统的扁平分块,rmcp-memex 提供分层的“洋葱切片”:
```
┌─────────────────────────────────────────┐
│ 外层(~100 字符) │ ← 最少上下文,最大导航
│ 关键词 + 超压缩 │
├─────────────────────────────────────────┤
│ 中层(~300 字符) │ ← 关键句子 + 上下文
├─────────────────────────────────────────┤
│ 内层(~600 字符) │ 展开内容
├─────────────────────────────────────────┤
│ 核心(完整文本) │ ← 完整文档
└─────────────────────────────────────────┘
```
**理念:** “最少信息 → 最大导航路径”
### 查询路由器和自动路由
用于自动搜索模式选择的智能查询意图检测:
```bash
# 自动检测查询意图并选择最优模式
rmemex search -n memories -q "我们什么时候买了 dragon" --auto-route
# 输出:查询意图:时间(置信0.70)
# 选择:带有日期提升的混合模式
# 结构化查询建议 lormcp-memex search -n code -q导入 main.rs" --auto-route
# 输出:查询意图:结构化(置信度:0.80)
# 考虑:loctree 查询 --kind who-imports --target main.rs
# 使用所有洋葱层进行深度探索
rmcp-memex dive -n memories -q "dragon" --verbose
```
**意图类型:**
| 意图 | 触发关键词 | 推荐模式 |
|--------|-----------------|------------------|
| 时间 | when, date, yesterday, ago, 2024 | 混合(日期提升) |
| 结构 | import, depends, module, who uses | BM25 + loctree 建议 |
| 语义 | similar, related, explain | 向量 |
| 精确 | "quoted strings" | BM25 |
| 混合 | (默认) | 向量 + BM25 融合 |
### CLI 命令
```bash
# 使用洋葱切片索引(默认)
rmcp-memex index -n memories /path/to/data/ --slice-mode onion
# 使用进度条和预计时间索引
rmcp-memex index -n memories /path/to/data/ --progress
# 使用扁平分块索引(向后兼容)
rmcp-memex index -n memories /path/to/data/ --slice-mode flat
# 在命名空间中搜索
rmcp-memex search -n memories -q "best moments" --10
# 仅在特定层搜索
rmcp-memex search -n memories -q "query" --layer outer
# 向下钻取层次结构(展开子节点)
rmcp-memex expand -n memories -i "slice_id_here"
# 按 ID 获取分块
rmcp-memex get -n memories -i "chunk_abc123"
# RAG 搜索(跨命名空间)
rmcp-memex rag-search -q "search term" --limit 5
# 列出命名空间及其统计信息
rmcp-memex namespaces --stats
# 导出命名空间到 JSON
rmcp-memex export -n memories -o backup.json --include-embeddings
```
### 预处理(噪声过滤)
从对话导出中自动移除 ~36-40% 的噪声:
- MCP 工具工件(`<function_calls>`、`<invoke>` 等)
- CLI 输出(git status、cargo build、npm install)
- 元数据(UUID、时间戳 → 占位符)
- 空/模板内容
```bash
# 使用预处理索引
rmcp-memex index -n memories /path/to/export.json --
```
### 精确匹配去重
基于 SHA256 的重复数据删除,用于重叠导出(例如,季度导出包含 6 个月的數據):
```bash
# 重(默认)
rmcp-memex index -n memories /path/to/data/
# 禁用去重
rmcp-memex index -n memories /path/to/data/ --no-dedup
```
**输出及统计信息:**
```
索引完成:
新分块: 234
已索引文件: 67
跳过(重复): 33
数据重复删除: 已启用
```
## 代码结构
```
rmcp-memex/
├── src/
│ ├── lib.rs # 公共 API 和 ServerConfig
│ ├── bin/
│ │ └── rmemex.rs # CLI 二进制文件(serve, index, search, get, expand, 等)
│ ├── handlers/
│ │ └── mod.rs # MCP 请求处理器
│ ├── security/
│ │ └── mod.rs # 命名空间访问控制
│ ├── rag/
│ │ └── mod.rs # RAG 流水线 + OnionSlice 架构
│ ├── preprocessing/
│ │ └── mod.rs # 对话导出中的噪声过滤
│ ├── storage/
│ └── mod.rs # LanceDB + Tantivy(模式 v3 及内容哈希)
│ ├── embeddings/
│ │ └── mod.rs # MLX/FastEmbed 桥接
│ └── tui/
│ └── mod.rs # 配置向导
└── Cargo.toml
```
## Claude/MCP 集成
添加到 `~/.claude.json`:
```json
{
"mcpServers": {
"rmcp-memex": {
"command": "rmcp-memex",
args": ["servesecurity-enabled"]
}
}
}
```
---
Vibecrafted with AI Agents by VetCoders (c)2025 The LibraxisAI Team
Co-Authored-By: [Maciej](void@div0.space) & [Klaudiusz](the1st@whoai.am)
MCP 配置
以下是此 MCP Server 的配置信息,可直接复制到 Cursor 或其他 MCP 客户端中使用。
mcp.json
连接信息
猜你喜欢
暂无推荐服务器