Files
book-mcp/frontend/README.md
Quentin 9b0910ccb1 Initial commit: book-mcp 教辅处理 MCP server + Arco Vue 管理端
后端 (book_mcp_server.py, 335 行, 15 个 MCP 工具):
- create_book / add_document / mark_html_ready / mark_json_ready / mark_failed
- update_book_status / soft_delete_book / retry_failed
- get_book / list_books / get_document / list_documents / get_document_url
- upload_to_rustfs / health
- 走 JSON-RPC + stateless_http + json_response(前端可直接调)
- launchd 守护 / 6 秒拉起(macOS)
- systemd 守护脚本(Linux/codelab)

存储:
- MongoDB (mongo:8.0 容器) - book/book_document/document_file 三表
- RustFS 对象存储(fs.code-lab.cn/scan/)- book/<id>/docs/<doc_id>/{docx,html,json}
- 幂等设计: zip_sha256 唯一 + (book_id+original_path) 唯一

前端 (Vue 3 + TS + Arco Design):
- 列表页 /book/list - 搜索 + 状态过滤 + 进度
- 详情页 /book/:id - 文档折叠 + 文件下载
- MCP 客户端 src/api/mcp.ts (JSON-RPC over fetch)

部署:
- deploy/install.sh (codelab 一键装 backend + systemd)
- deploy/install-frontend.sh (vite dev / 生产构建)
- docs/deploy.md (运维手册)

测试:
- tests/test_basic.py (sanity 7 项)
- tests/test_e2e.py (完整 e2e: docx→HTML→入库→上传→校验)
2026-10-11 18:03:57 +08:00

57 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# book-mcp Frontend
DoLuEdu Arco Admin Vue 管理端骨架 + book-mcp 业务模块。
## 启动
```bash
# 1. 确保 book-mcp server 在跑 (8100)
# 2. 装依赖
npm install
# 3. dev server
npm run dev # http://localhost:5176
# 4. 构建生产
npm run build
```
## 配置
- `vite.config.dev.ts` — dev proxy `/mcp → http://localhost:8100/mcp`
- `.env.development` — `VITE_API_BASE_URL=/mcp`(用相对路径走 proxy)
## 业务模块
- `src/api/mcp.ts` — JSON-RPC 客户端(fastmcp 协议)
- `src/api/book.ts` — book CRUD
- `src/api/document.ts` — document / file CRUD + health
- `src/views/BookManage/index.vue` — 列表页(路由 `/book/list`)
- `src/views/BookManage/BookDetail/index.vue` — 详情页(路由 `/book/:id`)
- `src/views/BookManage/components/BookList.vue` — 列表组件
- `src/views/BookManage/components/DocumentItem.vue` — 文档折叠项
## MCP 后端
15 个工具,分类:
| 类别 | 工具 |
|---|---|
| 写入 | create_book / add_document / mark_html_ready / mark_json_ready / mark_failed / update_book_status |
| 查询 | get_book / list_books / get_document / list_documents / get_document_url |
| 辅助 | upload_to_rustfs / soft_delete_book / retry_failed |
| 诊断 | health |
启动:launchd `ai.book-mcp.server`(端口 8100,stateless_http + json_response)。
## 模板来源
`DoLuEdu-Template/frontend/arco-admin-vue/` 复制而来。模板规则:禁止在模板里写业务,只在骨架基础上加。
## 关键约定
- Vue 3 + TypeScript + `<script setup>`
- Arco Design Vue 2.x
- 目录 PascalCase(`BookManage/` 不是 `book-manage/`)
- API 用 axios 包 fastmcp JSON-RPC