Skip to main content
Glama

Moodle MCP 服务器

一个 Model Context Protocol (MCP) 服务器 + REST API,可将 Claude、ChatGPT、Google Gemini 和任何 AI 模型连接到任何 Moodle LMS 实例。使用 Go 语言构建。

学生可以通过他们最喜欢的 AI 与他们的 Moodle 账户进行交互——查看课程、检查成绩、跟踪截止日期、提交作业以及阅读通知。

支持:

  • Claude (桌面版、Code) - 通过 MCP(最简单!)

  • ChatGPT (Plus) - 通过 REST API + Actions

  • Google Gemini - 通过 REST API + Apps Script

  • 任何 AI - 通过 REST API (HTTP 端点)

功能

工具

描述

login

交互式登录您的 Moodle 站点

get_site_info

查看 Moodle 站点和用户信息

get_user_profile

查看您的个人资料详情

list_courses

列出所有已选课程

get_course_contents

查看章节、资源和活动

get_course_details

查看课程元数据

get_grades

查看特定课程的成绩

get_grades_overview

查看所有课程的成绩汇总

get_assignments

查看课程作业

get_upcoming_assignments

查看所有课程即将到期的作业

submit_assignment

提交作业的文本内容

get_calendar_events

查看即将到来的日历事件

get_upcoming_deadlines

查看按紧急程度排序的汇总截止日期

get_notifications

查看消息和通知

要求

  • Claude Desktop (macOS, Windows 或 Linux)

  • 任何机构的 Moodle 账户

快速入门

选择您的 AI 平台:

您的 AI

指南

时间

🤖 Claude (推荐)

Windows / macOS

2 分钟

💬 ChatGPT

ChatGPT 设置

15 分钟

🔍 Google Gemini

Gemini 设置 / Gemini Windows

20 分钟

🌐 多个 AI

所有模型指南

1 小时

从这里开始: 如果您使用 Claude,请按照上面的 Windows/macOS 指南操作(只需 2 分钟!)

不是程序员? 所有指南都有分步说明,无需任何技术知识。


安装(最简单)

Windows (PowerShell)

打开 PowerShell 并运行:

irm https://raw.githubusercontent.com/Jawadh-Salih/moodle-mcp-server/main/install.ps1 | iex

这将自动下载并将二进制文件安装到 C:\Users\YourName\moodle-mcp\moodle-mcp.exe

macOS / Linux (Bash)

打开终端并运行:

curl -fsSL https://raw.githubusercontent.com/Jawadh-Salih/moodle-mcp-server/main/install.sh | bash

这将自动下载并将二进制文件安装到 ~/.moodle-mcp/moodle-mcp

手动安装(针对开发者)

如果您想从源码构建:

# Clone the repository
git clone https://github.com/Jawadh-Salih/moodle-mcp-server.git
cd moodle-mcp-server

# Build the binary
go mod tidy
go build -o moodle-mcp ./cmd/moodle-mcp/

使用方法

选项 1:交互式登录(推荐)

只需在没有任何配置的情况下启动服务器。当您与 Claude 聊天时,使用 login 工具进行身份验证:

"Log in to my Moodle at https://online.uom.lk with username student@uom.lk"

Claude 将询问您的密码并为您进行身份验证。

选项 2:环境变量

将凭据设置为环境变量以实现自动登录:

export MOODLE_URL=https://online.uom.lk
export MOODLE_USERNAME=your-username
export MOODLE_PASSWORD=your-password

或者如果您有 Moodle API 令牌:

export MOODLE_URL=https://online.uom.lk
export MOODLE_TOKEN=your-api-token

Claude Desktop 配置

如果您使用了自动安装程序:

安装程序会显示确切的路径。只需复制它即可!

手动配置

找到您的 Claude Desktop 配置文件:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

选项 A:交互式登录(推荐 - 配置中无凭据)

{
  "mcpServers": {
    "moodle": {
      "command": "/path/to/moodle-mcp"
    }
  }
}

然后在 Claude 中,使用 login 工具进行交互式身份验证。

选项 B:存储凭据

{
  "mcpServers": {
    "moodle": {
      "command": "/path/to/moodle-mcp",
      "env": {
        "MOODLE_URL": "https://online.uom.lk",
        "MOODLE_USERNAME": "your-username",
        "MOODLE_PASSWORD": "your-password"
      }
    }
  }
}

Windows 示例路径:

  • 自动安装程序:C:\Users\YourName\moodle-mcp\moodle-mcp.exe

  • 手动构建:C:\Users\YourName\Go\bin\moodle-mcp.exe

macOS 示例路径:

  • 自动安装程序:/Users/yourname/.moodle-mcp/moodle-mcp

  • 手动构建:/Users/yourname/moodle-mcp-server/moodle-mcp

支持多个 AI 平台

通过 MCP (仅限 Claude)

  • ✅ Claude Desktop (macOS, Windows, Linux)

  • ✅ Claude Code (VSCode, 终端)

通过 REST API (ChatGPT, Gemini, 任何 AI)

  • ✅ ChatGPT (带有自定义 GPT Actions)

  • ✅ Google Gemini (带有 Apps Script)

  • ✅ 任何具有 HTTP 客户端访问权限的 AI

  • ✅ 自定义脚本和集成

请参阅 所有模型设置 以获取每个平台的详细说明。

运行 REST API 服务器

对于 ChatGPT、Gemini 或其他 AI 模型,请运行 REST API 模式:

# Start REST API server
go run ./cmd/moodle-mcp/ -mode rest -port 8080

# Or if you built the binary:
./moodle-mcp -mode rest -port 8080

# View API docs
curl http://localhost:8080/api/docs

服务器监听 http://localhost:8080 并公开 REST 端点:

  • POST /api/login - 身份验证

  • GET /api/courses - 列出课程

  • GET /api/grades?course_id=123 - 获取成绩

  • GET /api/assignments/upcoming - 即将到期的作业

  • 还有更多!

对于生产环境 (ChatGPT/Gemini),部署到云端:


对话示例

连接后,您可以问 Claude 诸如:

  • "Show me my enrolled courses"

  • "What are my grades in CS101?"

  • "What assignments are due this week?"

  • "Show me the contents of my Data Structures course"

  • "Do I have any unread notifications?"

  • "What deadlines are coming up in the next 7 days?"

工作原理

此服务器使用 Moodle 的 Web Services REST API 以及 moodle_mobile_app 服务令牌。此服务在大多数 Moodle 安装中默认启用,因此无需管理员设置。

故障排除

"Invalid login" 错误: 请仔细检查您的用户名和密码。有些机构使用电子邮件作为用户名,有些则使用单独的 ID。

"Web service not available" 错误: 您的 Moodle 管理员可能禁用了移动 Web 服务。请要求他们在 网站管理 > 插件 > Web 服务 > 移动 下启用它。

成绩未显示: 成绩报告 API 需要 gradereport/user:view 权限,这对学生来说是标准的,但在某些站点上可能会受到限制。

许可证

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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/Jawadh-Salih/moodle-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server