Google 课堂 MCP 服务器
MCP(模型上下文协议)服务器,通过 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 服务器:
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"
]
}
}
}Related MCP server: Google API Discovery Service MCP Server
用法
可用工具
该服务器提供了几种与 Google Classroom 交互的工具:
1. courses - 列出你所有的 Google 课堂课程
Use the 'courses' tool to get a list of all your Google Classroom courses2.course 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工具中获取)
克劳德的示例提示
显示我所有的 Google 课堂课程
获取我的数学课程 ID 为 123456789 的详细信息
显示 ID 为 987654321 的历史课程的所有作业
权限
服务器请求以下 Google Classroom API 权限:
classroom.courses.readonly- 访问课程信息classroom.announcements.readonly- 访问课程公告classroom.coursework.me.readonly- 访问你的课程作业和作业classroom.rosters.readonly- 访问班级名册
故障排除
如果遇到权限错误,请尝试:
再次运行 auth 命令来刷新权限:
node index.js auth如果您的应用处于测试模式,请确保您的 Google 帐户已在 Google Cloud Console 中添加为测试用户
检查
authenticateAndSaveCredentials函数中的OAuth范围以确保它们符合您的需求
笔记
该服务器设计用于与 Claude AI 或其他 MCP 兼容助手一起使用
所有 API 请求均使用您已验证的 Google 帐户发出
令牌刷新由服务器自动处理
敏感凭证本地存储在
tokens.json文件中