Skip to main content
Glama

cloudclass-mcp

把云课堂(CloudClass)接进 Claude Desktop、Cursor、Cherry Studio 等支持 MCP(Model Context Protocol) 的 AI 客户端。AI 可以直接列出资源、把文件夹打成一个课件包并发布、修改标题/标签,或在明确确认后删除资源。

一个独立的 Node.js MCP Server,通过云课堂的 Bearer API 工作,不依赖网页 Cookie。

CI

能做什么

工具

作用

cloudclass_whoami

验证令牌,确认当前账号和角色

cloudclass_list_resources

按关键词、学科、类型、排序分页查询资源

cloudclass_get_resource

查看资源详情、文件清单和课件包入口

cloudclass_upload_resource

上传 .zip、.html,或一个包含 index.html 的文件夹(自动打包)

cloudclass_create_html_resource

直接把 AI 生成的 HTML 发布成资源,不必先写文件

cloudclass_update_resource

修改标题、简介、标签、封面、分类和可见性

cloudclass_delete_resource

删除资源和文件;必须显式传 confirm: true

上传成功后,工具会返回资源 ID 和资源页链接;支持 MCP 的客户端会把它渲染成一个可点击的资源链接。

Related MCP server: edumints SCORM MCP

前置条件

  • Node.js 20+

  • 一个已初始化的云课堂站点

  • 一个云课堂自动化 API 令牌:管理后台 → 系统设置 → 自动化 API → 生成令牌

  • 令牌所属账号必须是 教师或管理员(学生令牌不能上传)

令牌只显示一次。请不要把它提交到 Git、截图或发给模型。

安装

方式一:克隆后本地运行(推荐)

git clone https://github.com/KJLLin/cloudclass-mcp.git
cd cloudclass-mcp
npm install
npm run build

先验证配置:

CLOUDCLASS_URL="https://class.example.com" \
CLOUDCLASS_TOKEN="cc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
node dist/index.js --check

正常会输出当前用户 JSON。然后把这个绝对路径填进 MCP 客户端配置:

/path/to/cloudclass-mcp/dist/index.js

方式二:从 GitHub 全局安装

npm install -g github:KJLLin/cloudclass-mcp
cloudclass-mcp --version

如果全局安装后命令不可用,优先使用方式一,直接把 node + dist/index.js 配进客户端。

接入 MCP 客户端

Claude Desktop

编辑:

  • macOS:~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows:%APPDATA%\Claude\claude_desktop_config.json

加入:

{
  "mcpServers": {
    "cloudclass": {
      "command": "node",
      "args": ["/absolute/path/to/cloudclass-mcp/dist/index.js"],
      "env": {
        "CLOUDCLASS_URL": "https://class.example.com",
        "CLOUDCLASS_TOKEN": "cc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Cursor

在项目或全局 MCP 配置中加入同样的 mcpServers 结构;完整示例见 examples/cursor.json。

其他客户端

任何支持 stdio MCP Server 的客户端都可以用:

command: node
args:    ["/absolute/path/to/cloudclass-mcp/dist/index.js"]
env:     CLOUDCLASS_URL, CLOUDCLASS_TOKEN

使用示例

配置好以后,直接对 AI 说:

先确认云课堂令牌,然后把 /Users/lin/课件/中国农业 这个文件夹发布成公开课件包,标题叫“中国农业的分布与发展”,学科是地理,标签是农业、地理。

AI 会依次调用 cloudclass_whoami 和 cloudclass_upload_resource。文件夹会被自动打成 zip;根目录必须有 index.html。

也可以让 AI 直接生成一个页面并发布:

用 HTML 做一个函数图像实验室,发布到云课堂,分类数学,公开。

AI 会调用 cloudclass_create_html_resource,不需要本地文件。

配置项

环境变量

必填

说明

CLOUDCLASS_URL

是

站点根地址,例如 https://class.example.com

CLOUDCLASS_TOKEN

是

cc_ 开头的自动化 API 令牌

CLOUDCLASS_TIMEOUT_MS

否

请求超时,默认 120000,范围 5 秒–10 分钟

CLOUDCLASS_MCP_ROOTS

否

逗号分隔的本地目录白名单;设置后只允许上传这些目录下的文件

CLOUDCLASS_MCP_ROOTS 是给 MCP 的额外保险:即使模型被诱导,也读不到白名单外的文件。

export CLOUDCLASS_MCP_ROOTS="/Users/lin/课件,/Users/lin/Desktop/课堂素材"

不设置则不限制本地路径。公开仓库默认不限制,是因为不同用户的课件目录不同;生产使用时建议设置。

上传限制

与云课堂网页上传一致:

限制

值

zip 文件

≤ 24MB

解压后总大小

≤ 20MB

单文件解压后

≤ 4MB

单文件 gzip 后

≤ 1.9MB

文件数量

≤ 120

HTML 单页

≤ 4MB

文件夹自动打包时会跳过 node_modules、.git、.DS_Store、macOS ._*、__MACOSX 和符号链接。单个文件超过 4MB 会直接报错,并给出文件名。

安全

  • 令牌等价于账号密码,只放在 MCP 客户端的 env 里,不要写进提示词、资源内容或前端代码。

  • 每个用途单独生成一枚令牌;泄漏时只撤销那一枚。

  • cloudclass_delete_resource 是破坏性工具,必须由用户明确同意后传 confirm: true。

  • 服务端不会把令牌写进日志;--check 只输出用户信息,不输出令牌。

  • MCP Server 运行在本地 stdio,不额外开放网络端口。

开发

npm install
npm run build
npm test
npm run dev

npm test 使用 Node 内置测试运行器,覆盖:

  • Bearer 认证与错误映射

  • 列表/详情/上传/修改/删除请求

  • 文件夹自动打包与路径白名单

  • MCP 工具注册和调用委托

项目结构:

src/
  index.ts      CLI:--check / --help / stdio 启动
  server.ts     MCP 工具定义
  client.ts     云课堂 API 客户端
  folder.ts     文件夹打包与本地路径校验
  config.ts     环境变量
test/           单元与 MCP 工具测试
examples/       MCP 客户端配置示例

常见问题

缺少 CLOUDCLASS_TOKEN
没有把令牌放进 MCP 客户端的 env,或者变量名拼错。令牌不是网页登录 Cookie。

401 / unauthorized
令牌被撤销、账号被停用,或复制时带了空格。到后台重新生成一枚。

413 或“文件压缩后仍然过大”
先转码视频/压缩大图,或拆分课件包。单文件 gzip 上限是 1.9MB。

路径不在 CLOUDCLASS_MCP_ROOTS 允许范围内
把课件所在目录加入 CLOUDCLASS_MCP_ROOTS,用英文逗号分隔。

客户端显示 server disconnected
先手动执行:

CLOUDCLASS_URL="..." CLOUDCLASS_TOKEN="..." node dist/index.js --check

stdout 必须只输出 MCP 协议消息;本项目所有日志都写到 stderr。

License

MIT © 2026 KJLLin

Available Tools

7 tools
cloudclass_create_html_resource用 HTML 创建资源B

Publish a single HTML document without writing a file first. Useful for AI-generated interactive pages. The HTML limit is 4 MB.

Inputs: html (required), title (required), tags, cover, +4 more.

cloudclass_delete_resource删除资源A
Destructive

Permanently delete a resource and its files. Only call after the user explicitly confirms; confirm must be true.

Inputs: confirm (required), resource_id (required).

cloudclass_get_resource查看资源详情A
Read-only

Get one CloudClass resource, including its file list and package entry point. Read-only.

Inputs: resource_id (required).

cloudclass_list_resources列出云课堂资源B
Read-only

List published CloudClass resources. Supports keyword, kind, category, sort and pagination. Read-only.

Inputs: q, kind, mine, page, +3 more.

cloudclass_update_resource修改资源信息A

Update title, summary, tags, category, cover or visibility of a resource. Does not replace the uploaded files.

Inputs: resource_id (required), tags, cover, title, +4 more.

cloudclass_upload_resource上传课件到云课堂A

Upload a local .zip, .html/.htm file, or a folder containing index.html. Folders are zipped automatically. The token account must be a teacher or admin.

Inputs: title (required), source_path (required), tags, cover, +4 more.

cloudclass_whoami验证云课堂令牌A
Read-only

Return the CloudClass user bound to CLOUDCLASS_TOKEN. Use this before publishing to confirm the token works and whether the account can upload.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 7 tools

    Disambiguation4/5

    Each tool maps to a distinct lifecycle action (get, list, upload, create, update, delete) on the same resource, and the cloudclass_ prefix plus descriptions keep boundaries clear. The only mild overlap is between upload_resource and create_html_resource, since both publish a new resource; descriptions differentiate file-based vs inline-HTML flows, but an agent could still hesitate on which to pick for an HTML file on disk.

    Naming Consistency5/5

    All seven tools use the same cloudclass_ namespace prefix followed by a snake_case verb_noun pattern (get_resource, list_resources, upload_resource, create_html_resource, update_resource, delete_resource). The only deviation is whoami, but it is a conventional, well-understood terminal-style name that reads naturally alongside the others.

    Tool Count5/5

    Seven tools is a tight, well-scoped surface for a resource-publishing service: one tool per CRUD verb, two creation paths for distinct input types, and one auth-check utility. No tool looks redundant or vestigial, and nothing obvious is crammed in.

    Completeness4/5

    The surface covers the full lifecycle: identity check, list/search, get, two creation paths, metadata update, and delete with an explicit confirmation guard. The main gap is that update_resource explicitly does not replace files and there is no re-upload, file-level download, or file deletion tool, so agents hit a dead end when artifacts need refreshing.

    Maintenance

    ActivityNo data
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that lets AI assistants author courses on Stepik: browse the catalogue, read course structure, create or edit courses, modules, lessons and steps through the Stepik REST API, while preventing publishing.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that compiles interactive, standards-conformant e-learning courses into SCORM packages. It lets you (or an AI client) describe a course as a structured spec and receive a self-contained SCORM zip ready for any LMS.
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Node.js MCP server that exposes utility and sample HRMS tools over Streamable HTTP with shared bearer-token authentication, enabling local LLM gateways to call them in read-only mode.
      ISC