moodle-mcp
moodle-mcp
Moodle LMS 的模型上下文协议服务器 — 连接 Hermes、Claude Code 和 OpenCode 到你的 Moodle。获取作业、成绩和截止日期,同步到 Obsidian,并接收 WhatsApp 提醒。
概述 • 功能 • 快速开始 • 配置 • 代理设置 • 工具 • Obsidian 同步
概述
moodle-mcp 将 Moodle Web 服务 API 与模型上下文协议桥接,使 AI 代理能够充当你的学术助手。它专为 Polibatam(多班级过滤)构建,但适用于任何启用了 Web 服务的 Moodle 实例。
loyaniu/moodle-mcp 的分支 — 从 22 个工具扩展到 40 个,增加了 Obsidian 同步、资料下载、提交工具、日历集成、并发获取和学期自动归档。
[!TIP] 适用于任何 Moodle LMS — 只需将
MOODLE_URL指向你的实例。Polibatam 班级过滤器(MOODLE_MY_CLASS)是可选的。
Related MCP server: mcp-moodle
功能
作业与截止日期 — 按班级时段过滤,按紧急程度排序,附带可操作任务列表
成绩与进度 — 课程健康检查、学习负荷和完成度追踪
课程内容与搜索 — 章节、模块、资料、公告、近期活动
Obsidian 同步 — 一键导出仪表盘、截止日期和课程笔记(支持学期自动归档)
资料下载 — 列出并下载课程文件和作业附件
提交 — 提交文本、检查状态和阅读反馈
日历 — 即将到来的事件,创建提醒(H-2),标记活动完成
代理就绪 — 单个
install-mcp.sh适用于 Hermes、Claude Code 和 OpenCode
快速开始
一键安装
curl -fsSL https://raw.githubusercontent.com/zuckdorsey/moodle-mcp/main/scripts/install-mcp.sh | bash自动检测已安装的代理并配置每个代理。如需试运行:
bash scripts/install-mcp.sh --dry-run验证
# Hermes (profile: akademik)
hermes --profile akademik mcp test moodle
# → ✓ Connected ✓ Tools discovered: 40
# Claude Code
claude mcp list
# Run tests
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v[!NOTE] 开发时优先使用本地源码而非 PyPI — 启动器会自动将
PYTHONPATH设置为src/。
配置
1. 获取你的 Moodle 令牌
打开
https://<你的-moodle>/user/managetoken.php在
服务列中找到 Moodle 移动端 Web 服务 所在行复制该令牌
2. 创建 .env
cp .env.example .envMOODLE_URL=https://your-moodle.example.com/webservice/rest/server.php
MOODLE_TOKEN=your_token_here
# Optional — Polibatam class-slot filter (e.g. Pagi C, Siang A)
MOODLE_MY_CLASS=Pagi C
# Optional — custom vault path
OBSIDIAN_VAULT_PATH=/home/you/Obsidian Vault变量 | 必需 | 描述 |
| 是 | Moodle REST 端点( |
| 是 | 移动端 Web 服务令牌 |
| 否 | 多班级作业标题的正则过滤器 |
| 否 | 知识库根目录(默认: |
3. 安装包
# with uv (recommended)
uv pip install -e .
# or pip
pip install -e .[!WARNING] 切勿提交
.env— 它包含具有完整 API 访问权限的令牌。该文件已在.gitignore中。
代理设置
选择你的代理 — 所有代理都使用相同的本地启动器 scripts/moodle_mcp_local_launch.py。
Hermes 代理(推荐)
bash scripts/install-mcp.sh --agent hermes --profile akademik手动配置(~/.hermes/profiles/akademik/config.yaml):
mcp_servers:
moodle:
command: /home/you/Programming/Python/moodle-mcp/.venv/bin/python
args: [/home/you/Programming/Python/moodle-mcp/scripts/moodle_mcp_local_launch.py]
env:
MOODLE_URL: ${MOODLE_URL}
MOODLE_TOKEN: ${MOODLE_TOKEN}
MOODLE_MY_CLASS: "Pagi C"
OBSIDIAN_VAULT_PATH: "/home/you/Obsidian Vault"Claude Code
bash scripts/install-mcp.sh --agent claude-code
# or manually
claude mcp add -s user moodle-mcp -- python3 /path/to/moodle-mcp/scripts/moodle_mcp_local_launch.py全局 JSON(~/.claude/settings.json):
{
"mcpServers": {
"moodle-mcp": {
"command": "python3",
"args": ["/path/to/moodle-mcp/scripts/moodle_mcp_local_launch.py"],
"env": {
"MOODLE_URL": "https://your-moodle/webservice/rest/server.php",
"MOODLE_TOKEN": "your_token_here"
}
}
}
}OpenCode
bash scripts/install-mcp.sh --agent opencode~/.config/opencode/config.json:
{
"mcp": {
"moodle-mcp": {
"command": "python3",
"args": ["/path/to/moodle-mcp/scripts/moodle_mcp_local_launch.py"],
"environment": {
"MOODLE_URL": "https://your-moodle/webservice/rest/server.php",
"MOODLE_TOKEN": "your_token_here"
}
}
}
}Claude Desktop / Cursor
添加到 claude_desktop_config.json:
{
"mcpServers": {
"moodle-mcp": {
"command": "uvx",
"args": ["moodle-mcp"],
"env": {
"MOODLE_URL": "https://your-moodle/webservice/rest/server.php",
"MOODLE_TOKEN": "your_token_here"
}
}
}
}重启桌面应用 — 工具将出现在选择器中。
工具
40 个工具,分为 7 组。通过名称从任何连接的代理调用它们(例如 "列出我的 Moodle 课程" → get_my_courses)。
工具 | 描述 |
| 已注册的课程 |
| 课程的章节与模块 |
| 搜索所有资料 |
| 新闻论坛公告 |
| 自时间戳以来的近期活动 |
| 新资料/公告 |
工具 | 描述 |
| 作业(按班级时段过滤) |
| 提交与评分状态 |
| 按截止日期排序的截止日期 |
| 逾期未提交的作业 |
| 按优先级排序的紧急任务列表 |
| 状态 + 要求 + 资料 |
| 交付物与标准 |
| 与作业相关的内容 |
| 包含关键路径的子任务 |
| 时间线、资源、里程碑 |
| 提交文本答案 |
| 反馈与评分标准结果 |
工具 | 描述 |
| 概览或按课程查看详情 |
| 完成进度 |
| 健康检查(进度 + 成绩 + 逾期) |
| 按周分配的作业分布 |
| 详细的提交与反馈信息 |
工具 | 描述 |
| 即将到来的 Moodle 事件 |
| 创建 H-2 提醒 |
| 完成状态 |
| 标记活动完成 |
工具 | 描述 |
| 课程 + 截止日期 + 成绩 |
| 逾期、今日、近期成绩 |
| 已提交、已评分、逾期、进度 |
| 自然语言路由 |
| 课程变更检测 |
工具 | 描述 |
| 完整知识库同步(学期轮换时自动归档) |
| 仅导出截止日期 |
| 导出课程大纲为笔记 |
| 列出可下载的文件 |
| 下载到 |
| 下载作业文件 |
[!TIP] 试试:"这周有什么作业?" →
get_upcoming_deadlines,"分析数据库作业" →analyze_assignment,"同步到 Obsidian" →sync_moodle_to_obsidian。
Obsidian 同步
同步会在你的知识库中 Academic/Moodle 目录下创建笔记:
Obsidian Vault/Academic/
Moodle/ ← current semester (always up-to-date)
.semester_courses.json ← hidden state (course IDs)
Dashboard.md
Deadlines.md
Grades.md
Courses/
Archive/
Semester-2026-07/ ← auto-created on rollover
Dashboard.md
Courses/
Archive-README.md学期自动归档 在超过 50% 的课程 ID 发生变化(或全部为新课程)时触发。单个课程交换将被忽略。
PYTHONPATH=src python - <<'PY'
from moodle_mcp import api
print(api.sync_moodle_to_obsidian())
PY安全说明
[!CAUTION] 你的 Moodle 令牌以你的用户身份授予完整的 API 访问权限。请像对待密码一样对待它。
令牌在服务器端加载,永远不会发送给模型。
在 CI 中将
MOODLE_URL/MOODLE_TOKEN作为环境机密注入。moodle.py使用类似浏览器的User-Agent+ POST 以实现 Cloudflare 兼容性。
致谢
loyaniu/moodle-mcp 的分支 — 感谢所有原始贡献者:
贡献者 | 角色 |
原作者,Moodle REST 集成,核心服务器 | |
仪表盘、学习负荷、健康检查 | |
课程内容与搜索修复 | |
安全评估徽章 |
本分支新增功能
Obsidian 同步 + 学期自动归档
资料下载与作业附件
提交与反馈工具、日历与完成度
Polibatam 班级时段过滤器(
MOODLE_MY_CLASS)并发获取(可操作任务速度提升约 10 倍)
通用
install-mcp.sh,适用于 Hermes / Claude Code / OpenCode
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceProvides Claude with full access to Moodle learning management systems, enabling interaction with courses, files, assignments, grades, and calendar events. It also supports building Obsidian study vaults from course materials through automated knowledge graph creation.1416MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to interact with Moodle via web services, allowing tasks like listing courses, assignments, events, and downloading files.104MIT
- Alicense-qualityDmaintenanceEnables AI agents to interact with Moodle LMS via the Moodle REST API, supporting management of courses, users, enrollments, grades, and content.GPL 3.0
- Flicense-qualityCmaintenanceEnables AI assistants to automatically pull Canvas LMS course materials into Obsidian, syncing files, assignments, grades, and announcements organized by course and module.
Related MCP Connectors
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zuckdorsey/moodle-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server