Moodle Mcp

io.github.av-leschinskiy由 GitHub 账号 av-leschinskiy 发布v0.2.1更新于 Oct 30, 2026

Moodle MCP server for teachers: review assignment submissions, grade and give feedback; SSO login

已验证STDIO仅桌面效率与工作流文件与存储

概览

AI 生成的概览

面向教师的 Moodle MCP 服务器:让助手查看课程、审阅学生提交、下载文件,并保存成绩与评语。

可以做什么
  • 查看站点与课程:当前身份、Moodle 版本、可用函数、我的课程
  • 查看作业与提交:课程作业、参与者与提交状态、待处理事项、完整提交内容
  • 将提交文件下载到本地磁盘
  • 评分与反馈:保存成绩与评语、添加提交评论、将提交退回草稿(均需确认)
适用场景
适合在启用 Moodle 站点任教的教师,让助手协助梳理待批作业、阅读学生作业,并记录成绩与反馈,无需在网页界面中逐项操作。
运行要求
通过 npx 运行的本地 stdio 进程,需要 Node.js 22 或更高版本。必须设置 MOODLE_URL。单独的登录命令需要 Google Chrome 或 Chromium,会打开浏览器窗口完成 SSO 与验证码。Moodle 站点需启用移动应用 Web 服务。令牌保存在文件中(MOODLE_TOKEN_FILE),也可通过 MOODLE_TOKEN 提供。
安装前请注意
以教师账号身份操作:可保存成绩、发布学生可见的评论、将提交退回草稿,这些写入操作宿主会请求确认。下载文件会写入本地磁盘。登录令牌保存在磁盘上,独立的 Chrome 配置目录会保留站点 Cookie,因此再次登录可能无需密码。MOODLE_TOKEN 属于机密,勿放入共享配置。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Moodle Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Moodle MCP Server

An MCP server for AI assistants (Claude Code, Cursor, Codex and other stdio clients) on top of the Moodle web services REST API. It is built for teachers: the assistant can see courses, assignments and student submissions, download submission files, and save a grade with feedback, acting as the teacher and only after the teacher confirms. Unlike student-oriented Moodle MCP servers, the focus here is reviewing assignments and grading.

The server works with any Moodle site that has the mobile web service (moodle_mobile_app) enabled: the token is issued the same way as for the Moodle mobile app, so login through an external OAuth provider with a captcha works too.

Prerequisites

  • Node.js ≥ 22.
  • Google Chrome or Chromium, for the moodle-mcp-login command.
  • Mobile app access enabled on the Moodle site (Site administration → Mobile app). To check: <site>/admin/tool/mobile/launch.php should open rather than return an error.

Quick start

The example below uses https://moodle.example.org; replace it with your Moodle address exactly as it appears in the browser (scheme, host, path; a trailing slash does not matter).

  1. Log in, once per machine and again whenever a tool returns a login error (Moodle login and server token, in Russian):

    bash
    MOODLE_URL=https://moodle.example.org npx -y -p @av-leschinskiy/moodle-mcp moodle-mcp-login

    A Chrome window opens: log in to the site as usual and solve the captcha yourself. The command prints Logged in as <name> on <site> and closes the window. Without -p, npx would start the server instead of the login command. Chrome is looked up in PATH; on macOS and Windows, set its path in MOODLE_CHROME.

  2. Add the server to your client. Claude Code:

    bash
    claude mcp add moodle -e MOODLE_URL=https://moodle.example.org -- npx -y @av-leschinskiy/moodle-mcp

    Add -s user to enable it for all projects; without it, only for the current one.

    Codex, with a command or a block in ~/.codex/config.toml:

    bash
    codex mcp add moodle --env MOODLE_URL=https://moodle.example.org -- npx -y @av-leschinskiy/moodle-mcp
    toml
    [mcp_servers.moodle]command = "npx"args = ["-y", "@av-leschinskiy/moodle-mcp"]env = { MOODLE_URL = "https://moodle.example.org" }

    Cursor and other clients: a stdio server with the command npx -y @av-leschinskiy/moodle-mcp and the MOODLE_URL variable:

    json
    {  "mcpServers": {    "moodle": {      "command": "npx",      "args": ["-y", "@av-leschinskiy/moodle-mcp"],      "env": { "MOODLE_URL": "https://moodle.example.org" }    }  }}
  3. Check: ask the assistant "show my Moodle courses".

From a repository clone, use node <clone>/dist/index.js and node <clone>/dist/cli/login.js instead of npx: dist/ is committed, no build is needed.

What's inside

10 tools in total; 3 of them require user confirmation.

CategoryToolsConfirmationCovers
Site2—who I am, Moodle version, available functions, my courses
Assignments and submissions4—course assignments, participants and submission statuses, what needs the teacher across a course, full submission
Files1—downloading submission files to disk
Grading33grade and feedback, submission comment, returning a submission for rework
Full list of names

Site

  • moodle_list_courses
  • moodle_site_info

Assignments and submissions

  • moodle_get_submission
  • moodle_list_assignments
  • moodle_list_pending_submissions
  • moodle_list_submissions

Files

  • moodle_download_file

Grading

  • moodle_add_submission_comment — confirmation
  • moodle_revert_submission_to_draft — confirmation
  • moodle_save_grade — confirmation

The server acts on your behalf: it sees and changes the same things you do in the Moodle interface. The host asks for confirmation only for writes that students will see: a grade with feedback, a submission comment, returning a submission to draft (destructiveHint: true). Downloading a file also writes, but only to your disk, and needs no confirmation.

Responses are trimmed for the model context: HTML in descriptions and submissions is converted to plain text, times to ISO, a grade that is not set to null, and participant emails are never returned.

Configuration

VariableRequiredDefaultDescription
MOODLE_URLyes—Moodle site address (wwwroot), e.g. https://moodle.example.org
MOODLE_TOKEN_FILE—~/.config/mcp-moodle/token.jsonWhere moodle-mcp-login saves the token (path is resolved via homedir())
MOODLE_TOKEN——Web service token override (CI / smoke tests)
MOODLE_TIMEOUT—30000Timeout of a single API request (ms)
MOODLE_CHROME——Chrome/Chromium binary for moodle-mcp-login (looked up in PATH by default)
MOODLE_DEBUG—false1/true/yes/on enables debug output to stderr and debug level in the host log channel

The token file has 0600 permissions and stores the site address it was issued for: if it does not match MOODLE_URL, the server asks you to run moodle-mcp-login. The server reads the file on every request, so there is no need to restart the host after logging in again. The token is scrubbed from error messages, logs and tool responses (including file URLs).

The Chrome profile used for login is kept separate from your main one (~/.config/mcp-moodle/chrome-profile): site cookies persist, so logging in again often works without a password.

Development

bash
npm install        # also enables the git hooks (.githooks)npm run dev        # tsx, no compilationnpm run build      # native TypeScript 7 → dist/npm run verify     # typecheck + lint + tests + docs checkMOODLE_URL=… npm run smoke   # read-only tool chain against a live Moodle

Build only with npm run build: devDependencies contain two compiler versions, details. dist/ is committed; the pre-commit hook builds and stages it, bumps the patch version and regenerates the tables above. Architecture and rules are in AGENTS.md (in Russian).

来源:README.md,提交 2a9df4e

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:服务器未能启动。

版本历史

4
  1. v0.2.1最新Oct 30, 2026
  2. v0.2.0Oct 29, 2026
  3. v0.1.4Oct 21, 2026
  4. v0.1.3Oct 21, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分