article
README
🚀 谷歌课堂 MCP 服务器
一个提供访问 Google Classroom 数据的 MCP(模型上下文协议)服务器,支持通过 Claude 和其他支持 MCP 协议的 AI 助手,让你能更便捷地与 Google Classroom 进行交互。
🚀 快速开始
本服务器可提供对 Google Classroom 数据的访问,支持通过 Claude 和其他支持 MCP 协议的 AI 助手使用。下面为你介绍具体的设置和使用方法。
✨ 主要特性
- 提供访问 Google Classroom 数据的功能。
- 支持通过 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。
5. 配置 Claude 使用此服务器,通过更新 %APPDATA%\Claude\ 中的 claude_desktop_config.json 文件:
{
"mcpServers": {
"class": {
"command": "node",
"args": [
"PATH_TO_YOUR_DIRECTORY\\index.js"
]
}
}
}
💻 使用示例
基础用法
该服务器提供了与 Google Classroom 交互的多个工具:
1. courses - 列出所有你的 Google Classroom 课程
使用 'courses' 工具获取你所有 Google Classroom 课程的列表
2. course-details - 获取特定课程的详细信息
使用 'course-details' 工具并提供 courseId 参数以获取特定课程的详细信息和公告
参数:
courseId: 课程 ID(可从courses工具中获得)
3. assignments - 获取特定课程的作业
使用 'assignments' 工具并提供 courseId 参数以获取特定课程的作业和你的提交
参数:
courseId: 课程 ID(可从courses工具中获得)
示例提示 Claude
- 显示我所有的 Google Classroom 课程
- 获取 Math 课程(ID 123456789)的详细信息
- 显示 Physics 课程作业的截止日期
🔧 技术细节
权限
- 读取所有课程:允许访问所有已创建或加入的课程。
- 写入权限:允许在课程中发布和管理内容。
示例
{
"permissions": {
"read": ["courses"],
"write": ["courses"]
}
}
故障排除
- 确保你已正确配置环境变量。
- 检查网络连接以确保能够访问 Google Classroom API。
- 如果仍然遇到问题,请重新运行身份验证流程:
node index.js auth
这个 MCP 服务器为你提供了一个强大而灵活的工具,用于与 Google Classroom 进行交互。
扫码联系在线客服