Skip to main content
Glama
bomomoQWQ

LANraragi MCP Server

by bomomoQWQ
README.md
# LANraragi MCP Server

> 封装 LANraragi 全部 API 的 MCP 服务 — 51 个工具,让 AI agent 浏览、搜索、上传、打标、管理漫画存档。

基于 [LANraragi](https://github.com/Difegue/LANraragi) 的 Model Context Protocol 服务端。

## 快速开始

```json
{
  "mcpServers": {
    "lanraragi": {
      "transport": "streamable_http",
      "url": "http://你的服务器:3001/mcp",
      "headers": {
        "LRR-API-Key": "你的API密钥"
      }
    }
  }
}
```

## 环境变量

| 变量 | 默认值 | 说明 |
|------|--------|------|
| `LRR_URL` | `http://localhost:3000` | LANraragi 服务器地址 |
| `LRR_API_KEY` | 空 | API 密钥,🔑 端点必需 |
| `MCP_PORT` | `3001` | HTTP 服务端口 |
| `MCP_HOST` | `0.0.0.0` | HTTP 绑定地址 |

## 运行方式

### HTTP 模式(远程客户端)
```bash
env LRR_URL=http://localhost:3000 MCP_PORT=3001 node dist/http.js
```

### Stdio 模式(本地客户端)
```bash
env LRR_URL=http://localhost:3000 node dist/stdio.js
```

### systemd 服务
```bash
cp lanraragi-mcp.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now lanraragi-mcp
```

## 构建

```bash
npm install
npm run build
```

## 工具列表(51 个)

详见 [SKILL.md](./SKILL.md)。

| 模块 | 数量 | 核心工具 |
|------|------|----------|
| 搜索 | 4 | `search_archives`, `search_random` |
| 存档 | 18 | `list_archives`, `upload_archive`, `download_url`, `extract_archive` |
| 数据库 | 1 | `get_tag_stats` |
| 分类 | 7 | `list_categories`, `add_archive_to_category` |
| 单行本 | 10 | `list_tankoubons`, `create_tankoubon` |
| 文件监控 | 4 | `get_shinobu_status`, `rescan_shinobu` |
| 任务队列 | 3 | `get_job_status`, `queue_job` |
| 杂项 | 4 | `get_server_info`, `download_url`, `regen_thumbnails` |

## 配套服务

- **文件服务器**:为 `download_url` 提供带 `Content-Disposition` 头的文件下载,可与 MCP 同机部署
- **LANraragi**:漫画图书馆本体,通过 `LRR_URL` 配置连接

## 许可

MIT