关于 Google Classroom MCP Server
Google Classroom MCP Server 将 Google Classroom 课程、公告和作业数据提供给兼容 MCP 的 AI 助手,适合需要通过对话查询课堂信息的用户。它使用 Google 账户 OAuth 认证,并自动刷新令牌。
主要功能
- 01列出所有课程
- 02查看课程详情与公告
- 03查询作业及提交情况
- 04通过 OAuth 授权访问
适用场景
- 01汇总 Google Classroom 中的课程
- 02查看某门课程的公告和详情
- 03检查课程作业与提交情况
MCP 相关
该 MCP 服务向兼容客户端提供 courses、course-details 和 assignments 工具,用于读取 Google Classroom 数据。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Google Classroom MCP 服务
一个 MCP(Model Context Protocol)服务,可让 Claude 和其他支持 MCP 协议的 AI 助手访问 Google Classroom 数据。
设置
前提条件
- Node.js(v16 或更高版本)
- 已启用 Google Classroom API 的 Google Cloud Platform 项目
- Google Classroom API 的 OAuth 2.0 客户端凭据
安装
通过 Smithery 安装
通过 Smithery 自动为 Claude Desktop 安装 Google Classroom MCP Server:
npx -y @smithery/cli install @faizan45640/google-classroom-mcp-server --client claude
手动安装
- 克隆此仓库
- 安装依赖项:
npm install
- 将 Google OAuth 客户端凭据放入项目根目录下名为
credentials.json的文件中:
{
"web": {
"client_id": "YOUR_CLIENT_ID",
"project_id": "YOUR_PROJECT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uris": ["http://localhost:3000/auth/google/callback"]
}
}
- 使用 Google 进行身份验证:
node index.js auth
这将打开一个浏览器窗口以完成 OAuth 流程,并将凭据保存到 tokens.json。
- 更新
claude_desktop_config.json(通常位于%APPDATA%\Claude\)以配置 Claude 使用此服务:
{
"mcpServers": {
"class": {
"command": "node",
"args": [
"PATH_TO_YOUR_DIRECTORY\\index.js"
]
}
}
}
使用方法
可用工具
此服务提供多个工具,可用于与 Google Classroom 交互:
1. courses - 列出你的所有 Google Classroom 课程
Use the 'courses' tool to get a list of all your Google Classroom courses
2. course-details - 获取特定课程的详细信息
Use the 'course-details' tool with the courseId parameter to get details and announcements for a specific course
参数:
courseId:课程 ID(可通过courses工具获取)
3. assignments - 获取特定课程的作业
Use the 'assignments' tool with the courseId parameter to get assignments and your submissions for a specific course
参数:
courseId:课程 ID(可通过courses工具获取)
Claude 提示词示例
- 显示我的所有 Google Classroom 课程
- 获取课程 ID 为 123456789 的数学课程详情
- 显示课程 ID 为 987654321 的历史课程的所有作业
权限
此服务请求以下 Google Classroom API 权限:
classroom.courses.readonly- 访问课程信息classroom.announcements.readonly- 访问课程公告classroom.coursework.me.readonly- 访问你的课程作业和任务classroom.rosters.readonly- 访问班级花名册
故障排除
如果遇到权限错误,请尝试:
-
再次运行身份验证命令以刷新权限:
node index.js auth -
如果你的应用处于测试模式,请确保已在 Google Cloud Console 中将你的 Google 账号添加为测试用户
-
检查
authenticateAndSaveCredentials函数中的 OAuth 作用域,确保其符合你的需求
备注
- 此服务旨在与 Claude AI 或其他兼容 MCP 的助手配合使用
- 所有 API 请求均使用经过身份验证的 Google 账号发送
- 服务会自动处理令牌刷新
- 敏感凭据存储在本地的
tokens.json文件中
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
