Metadata-Version: 2.4
Name: local-rag-mcp
Version: 2.2.1
Summary: Binary-only Free edition of local-rag-mcp (MCP RAG server)
License-Expression: LicenseRef-Proprietary
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: EULA.txt
Requires-Dist: aiofile==3.11.1
Requires-Dist: aiofiles==25.1.0
Requires-Dist: annotated-doc==0.0.5
Requires-Dist: annotated-types==0.8.0
Requires-Dist: anyio==4.14.2
Requires-Dist: attrs==26.1.0
Requires-Dist: Authlib==1.7.2
Requires-Dist: beartype==0.22.9
Requires-Dist: cachetools==7.1.7
Requires-Dist: caio==0.9.25
Requires-Dist: certifi==2026.7.22
Requires-Dist: cffi==2.1.0
Requires-Dist: charset-normalizer==3.4.9
Requires-Dist: click==8.4.2
Requires-Dist: colorama==0.4.6
Requires-Dist: cryptography==50.0.0
Requires-Dist: cyclopts==4.22.3
Requires-Dist: deprecation==2.1.0
Requires-Dist: dnspython==2.8.0
Requires-Dist: docstring_parser==0.18.0
Requires-Dist: fastapi==0.141.1
Requires-Dist: fastmcp-slim==3.4.5
Requires-Dist: fastmcp==3.4.5
Requires-Dist: filelock==3.32.2
Requires-Dist: griffelib==2.1.0
Requires-Dist: h11==0.16.0
Requires-Dist: httpcore2==2.9.1
Requires-Dist: httpcore==1.0.9
Requires-Dist: httptools==0.8.0
Requires-Dist: httpx-sse==0.4.3
Requires-Dist: httpx2==2.9.1
Requires-Dist: httpx==0.28.1
Requires-Dist: idna==3.18
Requires-Dist: jaraco.classes==3.4.0
Requires-Dist: jaraco.context==6.1.2
Requires-Dist: jaraco.functools==4.6.0
Requires-Dist: joserfc==1.7.4
Requires-Dist: jsonref==1.1.0
Requires-Dist: jsonschema-path==0.5.0
Requires-Dist: jsonschema-specifications==2025.9.1
Requires-Dist: jsonschema==4.26.0
Requires-Dist: keyring==25.7.0
Requires-Dist: lance-namespace-urllib3-client==0.9.0
Requires-Dist: lance-namespace==0.9.0
Requires-Dist: lancedb==0.36.0
Requires-Dist: loguru==0.7.3
Requires-Dist: lxml==6.1.1
Requires-Dist: email-validator==2.3.0
Requires-Dist: markdown-it-py==4.2.0
Requires-Dist: mcp-types==2.0.0
Requires-Dist: mcp==1.29.0
Requires-Dist: mdurl==0.1.2
Requires-Dist: modelscope-hub==0.2.0
Requires-Dist: modelscope==1.39.0
Requires-Dist: more-itertools==11.1.0
Requires-Dist: networkx==3.7
Requires-Dist: numpy==2.5.1
Requires-Dist: openapi-pydantic==0.5.1
Requires-Dist: openpyxl==3.1.5
Requires-Dist: opentelemetry-api==1.44.0
Requires-Dist: packaging==26.2
Requires-Dist: pandas==3.0.5
Requires-Dist: pathable==0.6.0
Requires-Dist: pathspec==1.1.1
Requires-Dist: platformdirs==4.11.0
Requires-Dist: py-key-value-aio==0.4.5
Requires-Dist: pyarrow==25.0.0
Requires-Dist: pycparser==3.0
Requires-Dist: pydantic-settings==2.14.2
Requires-Dist: pydantic==2.13.4
Requires-Dist: pydantic_core==2.46.4
Requires-Dist: Pygments==2.20.0
Requires-Dist: PyJWT==2.13.0
Requires-Dist: pypdf==6.14.2
Requires-Dist: pyperclip==1.11.0
Requires-Dist: python-dateutil==2.9.0.post0
Requires-Dist: python-docx==1.2.0
Requires-Dist: python-dotenv==1.2.2
Requires-Dist: python-multipart==0.0.32
Requires-Dist: pywin32-ctypes==0.2.3
Requires-Dist: pywin32==312
Requires-Dist: PyYAML==6.0.3
Requires-Dist: rapidfuzz==3.14.6
Requires-Dist: referencing==0.37.0
Requires-Dist: requests==2.34.2
Requires-Dist: rich-rst==2.1.0
Requires-Dist: rich==15.0.0
Requires-Dist: rpds-py==2026.6.3
Requires-Dist: setuptools==83.0.0
Requires-Dist: shellingham==1.5.4
Requires-Dist: six==1.17.0
Requires-Dist: sse-starlette==3.4.6
Requires-Dist: starlette==1.3.1
Requires-Dist: et_xmlfile==2.0.0
Requires-Dist: tqdm==4.70.0
Requires-Dist: truststore==0.10.4
Requires-Dist: typer==0.27.0
Requires-Dist: typing-inspection==0.4.2
Requires-Dist: typing_extensions==4.16.0
Requires-Dist: tzdata==2026.3
Requires-Dist: uncalled-for==0.3.2
Requires-Dist: urllib3==2.7.0
Requires-Dist: uvicorn==0.52.1
Requires-Dist: watchdog==6.0.0
Requires-Dist: watchfiles==1.2.0
Requires-Dist: websockets==17.0.1
Requires-Dist: win32_setctime==1.2.0
Requires-Dist: exceptiongroup==1.3.1
Dynamic: license-file

# local-rag-mcp（Free 版）

> 仅二进制发布，不包含源码。Windows x64 / Python 3.10+。

local-rag-mcp 是一个本地 RAG 知识库 MCP 服务器：使用 Ollama 做向量嵌入、
LanceDB 做本地索引，通过 MCP 工具/资源/提示词接入 Claude Desktop、Cursor、
Cherry Studio 等客户端。

## Free 版功能

- 单空间（`default`）本地知识库
- PDF / Markdown / TXT / HTML 解析
- 稠密向量检索（`bge-m3`）与引用溯源
- 相邻块读取、文件清单、删除、状态诊断
- 内置永久免费许可，无需激活

不包含（Pro 功能）：多空间、BM25/RRF 混合检索、GraphRAG、Word/Excel/PPTX、
文件自动同步、空间 ACL。

## 安装

```powershell
pip install local-rag-mcp
```

前置条件：

- Windows x64
- Python 3.10+
- Ollama（默认 `http://localhost:11434`），并已拉取 `bge-m3`

```powershell
ollama pull bge-m3
```

## 启动

```powershell
local-rag-mcp
```

默认使用 SSE 传输，监听 `http://127.0.0.1:8042/sse`。
首次启动会创建数据目录 `%LOCALAPPDATA%\LocalRAGMCP`（`spaces/`、`logs/`、
`license/`）。免费许可已随包附带，不需要 `device.json` 或手动放置
`license.lic`。

也可以使用模块入口：

```powershell
python -m local_rag_mcp_free
```

## 配置

`.env` 按以下顺序查找，只加载第一个存在的文件：

1. `%RAG_HOME%\.env`（显式设置 `RAG_HOME` 时）
2. 程序安装目录（通常不建议修改）
3. 当前工作目录 `.env`
4. `%LOCALAPPDATA%\LocalRAGMCP\.env`

建议把 `.env` 放在启动目录，或 `%LOCALAPPDATA%\LocalRAGMCP\.env`。

常用变量：

| 变量 | 默认值 | 说明 |
|---|---|---|
| `EMBED_BASE_URL` | `http://localhost:11434` | Ollama 地址 |
| `EMBED_MODEL_NAME` | `bge-m3` | 嵌入模型（1024 维） |
| `MCP_PORT` | `8042` | SSE 端口 |
| `MCP_TRANSPORT` | `sse` | `sse` 或 `stdio` |
| `RAG_HOME` | `%LOCALAPPDATA%\LocalRAGMCP` | 数据根目录 |
| `RAG_PROJECT_PATH` | 无 | 启动时加载的文档目录 |
| `RAG_CHUNK_SIZE` | `600` | 分块大小 |
| `RAG_CHUNK_OVERLAP` | `60` | 分块重叠 |

## 接入 MCP 客户端

### SSE（先启动服务）

```json
{
  "mcpServers": {
    "local-rag": {
      "type": "sse",
      "url": "http://127.0.0.1:8042/sse"
    }
  }
}
```

### stdio（客户端自动拉起）

```json
{
  "mcpServers": {
    "local-rag": {
      "command": "local-rag-mcp",
      "env": {
        "MCP_TRANSPORT": "stdio",
        "RAG_PROJECT_PATH": "D:\\docs"
      }
    }
  }
}
```

Windows 上如果客户端找不到命令，可把 `command` 写成完整路径，例如
`C:\\Users\\you\\.venv\\Scripts\\local-rag-mcp.exe`。

## 诊断

```powershell
local-rag-mcp --version
local-rag-mcp --license-info
```

`--license-info` 正常输出应包含：

```json
{
  "runtime": "spp",
  "enforced": true,
  "spp_license_found": true,
  "edition": "free",
  "features": ["core"]
}
```

## 升级

```powershell
pip install -U local-rag-mcp
```

Free 版使用固定构建 seed。如果升级后启动报 `SPP: tamper`（退出码 3），
删除以下防回拨状态文件后重启：

```text
%LOCALAPPDATA%\SPP\local-rag-mcp\state.0
%LOCALAPPDATA%\SPP\local-rag-mcp\state.1
```

## 数据与许可

- `%LOCALAPPDATA%\LocalRAGMCP\spaces`：知识库索引
- `%LOCALAPPDATA%\LocalRAGMCP\logs`：运行日志
- `%LOCALAPPDATA%\LocalRAGMCP\license`：许可状态
- 许可与 EULA 随包附带；程序不包含源码，请勿反编译或再分发

## 平台

当前发布的是 Windows x64 wheel（`py3-none-win_amd64`）。Linux 需要在 Linux
机器上单独构建。

## 常见问题

| 现象 | 处理 |
|---|---|
| `No matching distribution found` | 确认是 Windows x64 + Python 3.10+；本包没有其他平台 wheel |
| 启动后检索无结果 | 确认 Ollama 已运行且 `ollama pull bge-m3` 完成 |
| 端口被占用 | 设置 `MCP_PORT=其他端口` 后重启 |
| `pip install` 很慢 | 使用国内镜像安装依赖；PyPI 包本身只有约 2.7 MB |
| 启动报 `SPP: no-license` | Free 包自带许可，若被删除，请重新安装 |

> 本页为 Free 版说明。Pro 版通过私有渠道交付，不发布到 PyPI。
