Skip to main content
Glama

classroom-mcp

English | Українська

English

An MCP server and command-line tool for a student's Google Classroom account. Connect it to Claude, Cursor or any other MCP client, and the assistant can see your courses, assignments with due dates and grades, and teacher announcements. It can also download a whole course with its files and turn in your work.

Reading goes through the official Classroom and Drive APIs. Submitting goes through a headless browser, because the Classroom API only lets the Cloud project that created an assignment modify a student's submission, and assignments are created by teachers.

Tools

Tool

What it does

list_courses

Your courses with their IDs

list_assignments

Assignments of a course with due date, your submission state and grade. Filters: pending, turned_in, graded

get_assignment

Full assignment text, the teacher's attachments and your attached files

list_course_materials

Course materials: lectures, guides, links

list_announcements

Latest posts in the course stream

export_course

Downloads the whole course to a folder. Google Docs, Sheets, Slides and Drawings are saved as DOCX, XLSX, PPTX and PDF

check_browser_login

Checks, without opening a window, that the browser profile is signed in to the right account

open_browser_login

Opens a browser window for a one-time sign-in

submit_assignment

Attaches files and turns in an assignment in the background

submit_batch

Submits several assignments from one or more courses in a single run

submission_status

Result of a background submission

recent_submissions

Latest submission runs with their results

save_course_snapshot

Saves the whole course as one JSON file: assignments with your submissions, materials, announcements

A course or assignment can be referred to by ID, by full title, or by a unique part of the title, such as "java" or "Lab 3".

Before you install

The server acts as your account, so every user creates their own Google Cloud project. It is free and takes about ten minutes. This repository ships no keys.

Some universities block third-party apps for their accounts. Google then shows admin_policy_enforced, and nothing works without the administrator's approval.

Submitting clicks buttons in the Classroom web interface the way you would. Buttons are found by their Ukrainian, English or Russian labels. If Google changes the interface, this part will need an update. Google's terms discourage automating its interface, so use submission at your own discretion and only for your own work. Reading and exporting through the API are not affected.

Installation

You need Python 3.10 or newer. Chrome or Edge is needed for submitting and for reading announcements where the university has closed API access to them.

git clone https://github.com/shkbb/classroom-mcp.git
cd classroom-mcp
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

On macOS and Linux use python3 instead of py and .venv/bin/python instead of .\.venv\Scripts\python.exe.

Google Cloud project

  1. Open the Google Cloud Console and create a new project with any name.

  2. Enable the Google Classroom API and the Google Drive API in it.

  3. Go to Google Auth Platform and click Get started. Choose External as the audience. If your school account belongs to a university domain you can choose Internal, but only when the project was created in that same domain.

  4. Under Audience, keep the Testing status and add your school address to Test users.

  5. Under Data Access, click Add or remove scopes and add the scopes from the table below.

  6. Under Clients, click Create client, choose Desktop app and download the JSON. Save it in the repository folder as credentials.json, or point the CLASSROOM_CREDENTIALS variable at it.

Scope

Used for

https://www.googleapis.com/auth/classroom.courses.readonly

Course list

https://www.googleapis.com/auth/classroom.topics.readonly

Topic names

https://www.googleapis.com/auth/classroom.coursework.me.readonly

Assignments, your submissions and grades

https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly

Course materials

https://www.googleapis.com/auth/classroom.announcements.readonly

Announcements

https://www.googleapis.com/auth/drive.readonly

Downloading attachments and checking files you already attached

All scopes are read-only. The server cannot change anything in Classroom through the API.

In Testing mode Google issues a refresh token that lasts about 7 days. After that the server asks you to sign in again. To avoid this, switch the project to In production. A personal app does not have to go through Google verification: sign-in shows an "unverified app" warning, which you can skip because the app is yours.

First sign-in

Run this once in a terminal:

.\.venv\Scripts\python.exe classroom_export.py list

A browser opens with the Google sign-in. Pick your school account and grant the permissions. The command then prints your courses, and the token is stored outside the repository, in %LOCALAPPDATA%\ClassroomExporter on Windows or ~/.local/share/ClassroomExporter on macOS and Linux. The server itself never opens a sign-in window. When the token expires, it tells you which command to run.

To switch to another account:

.\.venv\Scripts\python.exe classroom_export.py --login-again list

Connecting a client

Claude Code (use your own absolute paths):

claude mcp add classroom --env CLASSROOM_ACCOUNT=student@university.edu -- C:\path\classroom-mcp\.venv\Scripts\python.exe C:\path\classroom-mcp\classroom_mcp.py

Claude Desktop, Cursor and other clients with a JSON config:

{
  "mcpServers": {
    "classroom": {
      "command": "C:\\path\\classroom-mcp\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\classroom-mcp\\classroom_mcp.py"],
      "env": { "CLASSROOM_ACCOUNT": "student@university.edu" }
    }
  }
}

Restart the client and ask something like "which Java assignments haven't I turned in yet?".

Submitting work

For submissions the server uses its own browser profile, separate from your everyday Chrome. Sign in to it once: ask the assistant to call open_browser_login, or run

.\.venv\Scripts\python.exe classroom_export.py browser-login

Sign in to your school account in the window that opens, then close it. You type the password yourself; the server never sees it. After that the browser runs without windows.

submit_assignment has three modes:

Mode

What happens

turn_in

Attach the files and turn in

add_files

Unsubmit an already turned-in work, attach only the missing files and turn it in again. Existing attachments are never removed

replace_files

Replace attached files that have the same name as the new ones but different content, then turn in again. Works for DOCX, PDF, ZIP and PPTX

mark_done

Mark as done without files

Without confirm=true the server only checks access to the assignment and the files and changes nothing. The server instructions tell the assistant to show you the check result first and to submit only after you agree. Files are passed as absolute paths, up to 20 per assignment. submit_batch takes a list of the same items, checks all of them before uploading anything, and skips work that is already turned in.

replace_files removes only the exact Drive file recorded when the plan was made (its ID, size and MD5). If that file changed in the meantime, the submission stops. A new file whose name matches nothing in a turned-in work is an error in this mode; use add_files for it.

The submission runs in a background thread of the server, and submission_status reports the result. The run lives as long as the client session. If the client closes mid-way, the run shows as INTERRUPTED, and starting the same submission again continues where it stopped. Before uploading, the tool computes a SHA-256 of every file and stops if a file changed after planning. Files that are already attached are matched through the Drive API by name, size and MD5, so an interrupted run can be repeated without duplicates. An attached file with the same name but different content stops the submission with an explanation. A screenshot of the page is saved after every successful submission.

Command line without MCP

Everything is also available from a terminal.

.\.venv\Scripts\python.exe classroom_export.py list
.\.venv\Scripts\python.exe classroom_export.py export "Course name or ID" --output D:\exports
.\.venv\Scripts\python.exe classroom_read.py announcements "Course name"

Export layout:

Course name/
├── Topic name/
│   └── Assignment title/
│       ├── readme.txt
│       └── Lecture 1.pptx
├── Без теми/
├── Оголошення/
└── export-warnings.txt

Без теми holds posts without a topic and Оголошення holds announcements; the tool's own folder and message names are in Ukrainian. Links, YouTube videos and Google Forms are saved as .txt files with the URL. If a file cannot be downloaded or Drive cannot convert it (Google Docs export is limited to 10 MB), the tool keeps the link and writes the reason to export-warnings.txt.

Submitting from the command line works through a plan. Describe the work in a manifest first; file paths are relative to the manifest's folder:

{
  "account": "student@university.edu",
  "courses": [
    {
      "course": "Course name or ID",
      "assignments": [
        { "title": "Lab 1", "files": ["lab1.docx", "lab1.zip"] },
        { "title": "Lab 2", "files": ["lab2.docx"], "replaceFiles": true },
        { "title": "Lab 3", "files": ["lab3-video.mp4"], "addAttachments": true },
        { "title": "Quiz", "files": [], "markAsDone": true }
      ]
    }
  ]
}
.\.venv\Scripts\python.exe classroom_export.py prepare-submit manifest.json --output plan.json
.\.venv\Scripts\python.exe classroom_export.py start-submit plan.json --check-only
.\.venv\Scripts\python.exe classroom_export.py start-submit plan.json
.\.venv\Scripts\python.exe classroom_export.py submit-status RUN_ID

replaceFiles, addAttachments and markAsDone work like the replace_files, add_files and mark_done modes above; one assignment takes at most one of them. From the command line, start-submit runs as a separate process with no window, so it keeps going after the terminal closes. classroom_read.py course "Course name" --output course.json saves the same snapshot as save_course_snapshot.

Configuration

Variable

Default

Sets

CLASSROOM_CREDENTIALS

credentials.json in the repository folder

OAuth client file

CLASSROOM_ACCOUNT

none

School address for submitting and for reading the stream through the browser

CLASSROOM_EXPORT_DIR

~/classroom-exports

Where courses are exported

CLASSROOM_DATA_DIR

%LOCALAPPDATA%\ClassroomExporter or ~/.local/share/ClassroomExporter

Token, browser profile, submission logs

CLASSROOM_BROWSER

detected Chrome or Edge

Browser path

credentials.json, the token and the browser profile give access to your account. Do not commit them or send them to anyone. .gitignore already excludes credentials.json, and everything else lives outside the repository.

If the university blocks the announcements scope and the API returns 403, list_announcements reads the course stream through the browser profile. That requires signing in with browser-login.

Tests

.\.venv\Scripts\python.exe -X utf8 -m unittest -v

The submission tests drive a real headless Chrome against a local page, so Chrome or Edge must be installed.

License

MIT, see LICENSE.

Related MCP server: Classroom MCP

Українська

MCP-сервер і консольна утиліта для студентського акаунта Google Classroom. Підключається до Claude, Cursor або іншого MCP-клієнта, після чого асистент бачить ваші курси, завдання з дедлайнами й оцінками, оголошення викладачів, може вивантажити курс разом із файлами на диск і здати роботу.

Читання працює через офіційні Classroom API і Drive API. Здача робіт іде через прихований браузер: Classroom API дозволяє змінювати роботу студента лише тому Cloud-проєкту, який створив завдання, а завдання створює викладач.

Що вміє сервер

Інструмент

Що робить

list_courses

Курси акаунта з ID

list_assignments

Завдання курсу: дедлайн, стан вашої роботи, оцінка. Фільтр pending, turned_in, graded

get_assignment

Повний текст завдання, вкладення викладача і ваші прикріплені файли

list_course_materials

Матеріали курсу: лекції, методички, посилання

list_announcements

Останні оголошення у стрічці курсу

export_course

Вивантажує весь курс у папку. Google Docs, Sheets, Slides і Drawings зберігаються як DOCX, XLSX, PPTX і PDF

check_browser_login

Перевіряє без вікон, чи браузерний профіль увійшов у потрібний акаунт

open_browser_login

Відкриває вікно браузера для одноразового входу

submit_assignment

Прикріплює файли й здає роботу у фоні

submit_batch

Здає кілька завдань з одного чи різних курсів за один запуск

submission_status

Результат фонової здачі

recent_submissions

Останні запуски здачі та їхні результати

save_course_snapshot

Зберігає весь курс в один JSON: завдання з вашими роботами, матеріали, оголошення

Курс і завдання можна називати за ID, за повною назвою або за унікальним шматком назви: «java», «ПР 3».

Перед тим як ставити

Сервер працює від імені вашого акаунта, тому кожен користувач створює власний проєкт у Google Cloud. Це безкоштовно і займає хвилин десять. Ключі з цього репозиторію ніхто не отримує, бо їх тут немає.

Деякі університети забороняють сторонні застосунки для своїх акаунтів. Тоді Google покаже admin_policy_enforced, і без дозволу адміністратора нічого не вийде.

Здача натискає кнопки в інтерфейсі Classroom, як це робили б ви. Кнопки шукаються за текстом українською, англійською та російською. Якщо Google змінить інтерфейс, цю частину доведеться оновлювати. Правила Google не схвалюють автоматизацію їхнього інтерфейсу, тому користуйтеся здачею на власний розсуд і лише для власних робіт. Читання й експорт через API цього не стосуються.

Встановлення

Потрібен Python 3.10 або новіший. Chrome чи Edge знадобиться для здачі робіт і для читання оголошень там, де університет закрив до них доступ через API.

git clone https://github.com/shkbb/classroom-mcp.git
cd classroom-mcp
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

На macOS і Linux замість py пишіть python3, а замість .\.venv\Scripts\python.exe пишіть .venv/bin/python.

Проєкт у Google Cloud

  1. Відкрийте Google Cloud Console і створіть новий проєкт. Назва будь-яка.

  2. Увімкніть у ньому Google Classroom API і Google Drive API.

  3. Перейдіть у Google Auth Platform і натисніть Get started. Тип аудиторії оберіть External. Якщо ваш навчальний акаунт належить домену університету, можна обрати Internal, але це вдається лише тоді, коли проєкт створено в тому ж домені.

  4. У розділі Audience залиште режим Testing і додайте свою навчальну адресу в Test users.

  5. У розділі Data Access натисніть Add or remove scopes і додайте дозволи з таблиці нижче.

  6. У розділі Clients натисніть Create client, оберіть тип Desktop app і завантажте JSON. Покладіть файл у папку репозиторію під назвою credentials.json або вкажіть шлях до нього у змінній CLASSROOM_CREDENTIALS.

Дозвіл

Навіщо

https://www.googleapis.com/auth/classroom.courses.readonly

Список курсів

https://www.googleapis.com/auth/classroom.topics.readonly

Назви тем

https://www.googleapis.com/auth/classroom.coursework.me.readonly

Завдання, ваші роботи й оцінки

https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly

Матеріали курсу

https://www.googleapis.com/auth/classroom.announcements.readonly

Оголошення

https://www.googleapis.com/auth/drive.readonly

Завантаження вкладень і перевірка вже прикріплених файлів

Усі дозволи лише на читання. Змінити щось у Classroom через API сервер не може.

У режимі Testing Google видає токен приблизно на 7 днів. Коли він закінчиться, сервер попросить увійти знову. Щоб цього не було, проєкт треба перевести в режим In production. Для особистого користування підтверджувати застосунок у Google не обов'язково: при вході з'явиться попередження про неперевірений застосунок, і його можна пропустити, бо застосунок ваш.

Перший вхід

Один раз виконайте в терміналі:

.\.venv\Scripts\python.exe classroom_export.py list

Відкриється браузер із входом Google. Оберіть навчальний акаунт і дайте дозволи. Після цього команда покаже список курсів, а токен збережеться поза репозиторієм, у %LOCALAPPDATA%\ClassroomExporter на Windows або ~/.local/share/ClassroomExporter на macOS і Linux. Сам сервер вікна входу не відкриває. Якщо токен прострочився, він повідомить, яку команду запустити.

Щоб увійти в інший акаунт:

.\.venv\Scripts\python.exe classroom_export.py --login-again list

Підключення до клієнта

Claude Code (шляхи підставте свої, абсолютні):

claude mcp add classroom --env CLASSROOM_ACCOUNT=student@university.edu -- C:\path\classroom-mcp\.venv\Scripts\python.exe C:\path\classroom-mcp\classroom_mcp.py

Claude Desktop, Cursor та інші клієнти з JSON-конфігурацією:

{
  "mcpServers": {
    "classroom": {
      "command": "C:\\path\\classroom-mcp\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\classroom-mcp\\classroom_mcp.py"],
      "env": { "CLASSROOM_ACCOUNT": "student@university.edu" }
    }
  }
}

Після перезапуску клієнта спитайте щось на кшталт «які завдання з Java я ще не здав?».

Здача робіт

Для здачі сервер використовує окремий профіль браузера, не ваш звичайний Chrome. У нього треба один раз увійти. Попросіть асистента викликати open_browser_login або запустіть самі:

.\.venv\Scripts\python.exe classroom_export.py browser-login

Увійдіть у навчальний акаунт у вікні, що відкрилося, і закрийте його. Пароль вводите ви, сервер його не бачить. Далі браузер працює без вікон.

submit_assignment має три режими:

Режим

Що відбувається

turn_in

Прикріпити файли й здати

add_files

Повернути вже здану роботу, дочепити лише відсутні файли й здати знову. Наявні вкладення не видаляються

replace_files

Замінити прикріплені файли з такою самою назвою, але іншим вмістом, і здати знову. Працює для DOCX, PDF, ZIP і PPTX

mark_done

Позначити виконаним без файлів

Без confirm=true сервер лише перевіряє доступ до завдання і файли, нічого не змінюючи. Асистенту в інструкціях сервера сказано спершу показати вам результат перевірки і здавати тільки після вашої згоди. Файли передаються абсолютними шляхами, до 20 на завдання. submit_batch приймає список таких самих завдань, перевіряє їх усі до першого завантаження і пропускає вже здані.

replace_files видаляє лише той файл Drive, який зафіксовано під час планування (ID, розмір і MD5). Якщо він за цей час змінився, здача зупиняється. Новий файл, назва якого не збігається з жодним вкладенням у зданій роботі, у цьому режимі вважається помилкою, для нього є add_files.

Здача виконується у фоновому потоці сервера, а submission_status показує результат. Запуск живе, поки відкрита сесія клієнта. Якщо клієнт закрився посередині, запуск отримає стан INTERRUPTED, і повторна здача продовжить з того ж місця. Перед завантаженням утиліта рахує SHA-256 кожного файла і зупиняється, якщо файл змінився після планування. Вже прикріплені файли вона звіряє через Drive API за назвою, розміром і MD5, тож перерваний запуск можна повторити без дублікатів. Зданий файл із такою самою назвою, але іншим вмістом, зупиняє здачу з поясненням. Після успішної здачі зберігається знімок сторінки.

Консоль без MCP

Усе те саме доступне з терміналу.

.\.venv\Scripts\python.exe classroom_export.py list
.\.venv\Scripts\python.exe classroom_export.py export "Назва або ID курсу" --output D:\exports
.\.venv\Scripts\python.exe classroom_read.py announcements "Назва курсу"

Структура експорту:

Назва курсу/
├── Назва теми/
│   └── Назва завдання/
│       ├── readme.txt
│       └── Лекція 1.pptx
├── Без теми/
├── Оголошення/
└── export-warnings.txt

Посилання, відео YouTube і Google Форми записуються як .txt з URL. Якщо файл заборонено завантажувати або Drive не може його конвертувати (ліміт експорту Google Docs 10 МБ), утиліта зберігає посилання і пише причину в export-warnings.txt.

Здача з консолі йде через план. Спершу опишіть роботи в маніфесті, шляхи файлів рахуються від папки маніфесту:

{
  "account": "student@university.edu",
  "courses": [
    {
      "course": "Назва або ID курсу",
      "assignments": [
        { "title": "Практична робота 1", "files": ["ПР1.docx", "ПР1.zip"] },
        { "title": "Практична робота 2", "files": ["ПР2.docx"], "replaceFiles": true },
        { "title": "Практична робота 3", "files": ["ПР3-відео.mp4"], "addAttachments": true },
        { "title": "Тест", "files": [], "markAsDone": true }
      ]
    }
  ]
}
.\.venv\Scripts\python.exe classroom_export.py prepare-submit manifest.json --output plan.json
.\.venv\Scripts\python.exe classroom_export.py start-submit plan.json --check-only
.\.venv\Scripts\python.exe classroom_export.py start-submit plan.json
.\.venv\Scripts\python.exe classroom_export.py submit-status ID_ЗАПУСКУ

replaceFiles, addAttachments і markAsDone працюють так само, як режими replace_files, add_files і mark_done вище, і для одного завдання можна вказати лише один із них. З консолі start-submit запускає окремий процес без вікна, тож здача триває й після закриття термінала. classroom_read.py course "Назва курсу" --output course.json зберігає такий самий знімок, як save_course_snapshot.

Налаштування

Змінна

Значення за замовчуванням

Що задає

CLASSROOM_CREDENTIALS

credentials.json у папці репозиторію

Файл OAuth-клієнта

CLASSROOM_ACCOUNT

немає

Навчальна адреса для здачі й читання стрічки через браузер

CLASSROOM_EXPORT_DIR

~/classroom-exports

Куди вивантажувати курси

CLASSROOM_DATA_DIR

%LOCALAPPDATA%\ClassroomExporter або ~/.local/share/ClassroomExporter

Токен, браузерний профіль, журнали здачі

CLASSROOM_BROWSER

знайдений Chrome або Edge

Шлях до браузера

credentials.json, токен і браузерний профіль дають доступ до вашого акаунта. Не комітьте їх і нікому не пересилайте. .gitignore вже виключає credentials.json, а все інше лежить поза репозиторієм.

Якщо університет блокує дозвіл на оголошення і API повертає 403, list_announcements читає стрічку курсу через браузерний профіль. Для цього потрібен вхід через browser-login.

Тести

.\.venv\Scripts\python.exe -X utf8 -m unittest -v

Тести здачі запускають справжній Chrome без вікна на локальній сторінці, тому Chrome або Edge має бути встановлений.

Ліцензія

MIT, див. LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers