English | 繁體中文 | 简体中文 | 日本語 | Español | Deutsch | Português | Français
[](https://github.com/G36maid/moodle-mcp/actions/workflows/ci.yml) [](https://codecov.io/gh/G36maid/moodle-mcp) [](https://github.com/G36maid/moodle-mcp/releases/latest) [](https://crates.io/crates/moodle-mcp) [](../LICENSE) [](https://www.rust-lang.org) [](https://modelcontextprotocol.io) [](https://github.com/G36maid/moodle-mcp/actions/workflows/release.yml) 一个 [Model Context Protocol](https://modelcontextprotocol.io) 服务器,让 LLM 智能体能**操作真实的 Moodle LMS** — 阅读课程、获取作业 PDF、编写代码、上传并提交作业 — 全部通过单个静态二进制文件完成。 使用 Rust 基于官方 MCP SDK ([`rmcp`](https://crates.io/crates/rmcp)) 构建。已在 Moodle 3.7、4.5 与 5.2 上完成实测验证;面向 **3.7 → 5.x** 设计。 ## ✅ 为什么需要 moodle-mcp 普通聊天机器人无法访问你的 Moodle,每个学习任务都只能手动完成 — 开五个浏览器标签页只为回答“这周有什么要截止?”、手动重新上传 PDF、讨论区和成绩一页一页复制粘贴。 moodle-mcp 让智能体以你的身份登录。20 个类型化工具覆盖完整的学生旅程,智能体会自行串联这些工具 — 全程无需打开浏览器: - **开箱即用(Batteries included)** — 文档转换、HTML → Markdown、auth 命令行工具和可选用的兜底调用,全部集成在一个二进制文件中:无需插件、无需辅助脚本、无需二次运行时 - **智能体原生设计(Agent-native)** — 工具接收并返回本地文件路径而非 base64;每个结果都内嵌下一次调用所需的 ID;报错信息通俗易懂并给出修复建议 - **默认安全** — 写入类工具会先征得你的同意,提交内容在你确认前始终保持草稿;刻意不提供代考测验功能 - **版本自适应** — 经 Moodle 3.7 实测验证,面向 4.x/5.x 设计;版本间的响应差异会被自动抹平 - **单一静态二进制文件** — 零运行时依赖 ## 🚀 快速开始 需要一个 Moodle 3.7 → 5.x 站点上允许移动应用 Web Service 的账号(多数站点均已允许 — 详见[前置条件](https://moodle.ntnu.cc/docs/getting-started.html#prerequisites))。 ```bash # 1. Install cargo install moodle-mcp # or grab a prebuilt binary — no Rust needed # 2. Log in once — prints MOODLE_URL and MOODLE_TOKEN moodle-mcp auth # 3. Connect your client (Claude Code shown; Codex/OpenCode/pi below) claude mcp add moodle \ --env MOODLE_URL=https://moodle.example.com \ --env MOODLE_TOKEN=your-token \ -- /path/to/moodle-mcp # 4. Open a chat and ask: # "What's due in the next two weeks? Plan my studying around it." ``` 或把这段贴进你的 agent,让它代办每一步(它会在自己的终端开启 `moodle-mcp auth`——学校账号密码在终端里输入,而不是贴进对话): ```text Set up moodle-mcp (github.com/G36maid/moodle-mcp): read docs/src/installation.md and docs/src/configuration.md from the repo's main branch first. Then install the binary for my platform, run `moodle-mcp auth` in the terminal so I can type my school credentials when it prompts, and register the server in your own MCP config using the snippet for your harness. Never store or repeat my credentials; ask before anything global. ``` 预编译二进制文件、SSO 登录、各客户端的配置片段,以及完整的环境变量参考:[安装](https://moodle.ntnu.cc/docs/installation.html) · [快速入门](https://moodle.ntnu.cc/docs/getting-started.html) · [配置](https://moodle.ntnu.cc/docs/configuration.html) ## 💬 智能体能做什么 以下指令无需任何额外设置即可使用 — 智能体会从工具描述中自行发现工具并串联调用: | 用户指令 | 智能体自动调用的工具链 | |---|---| | *“帮我完成信息安全 HW1:阅读作业要求和附件 PDF,解出题目,并提交草稿。”* | `get_assignment` (brief + attachments) → `fetch_file` (PDF → markdown, math included) → solves it → writes the answer file → `upload_file` → `submit_assignment` → `get_assignment` (verify submitted ✓) | | *“根据接下来的截止日期和课程资料,为我制定未来两周的完整复习计划。”* | `get_schedule` (all deadlines) → `get_course_overview` per course → day-by-day plan balanced against due dates | | *“我错过了这周数据通信课程的进度 — 帮我补上进度,包括公告讨论区。”* | `get_notifications` + `get_forum_discussions` → `get_discussion_posts` → synthesized weekly digest | | *“帮我备考软件工程测验:老师在上面发布了哪些相关内容?”* | `get_course_overview` (quiz entry) → `get_assignment` (requirements) → related forum threads | ## 🔄 智能体如何工作 工具的组织方式还原了你在 Moodle 中的浏览路径 — 每一层的输出都内嵌下一层所需的 ID: ```mermaid flowchart TD Q["💬 prompt (intent only)"] --> LC["list_courses(search?)