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 分