Skip to main content
Glama

google-classroom-mcp

An MCP server that gives an AI assistant a student's view of Google Classroom: classes, the stream, classwork, your to-do list, due dates, attachments (download and read), comments, and your own submissions. It can also act for you: comment, attach work, turn in, unsubmit, answer questions, join and leave classes.

It needs no OAuth app and no admin consent. It signs in with your own Google browser session cookies and calls the same internal endpoints the Classroom web app uses.

⚠️ This uses undocumented internal Google endpoints. They can change without notice, and using them may go against Google's terms. Your session cookies give full access to your Google account: keep them private, and don't commit them (cookies.txt and cookies.json are git-ignored).

Install

git clone <this repo> && cd google-classroom-mcp
npm install
npm run build

Related MCP server: Classroom MCP

Give it your session

Choose one of these:

Variable

What to put in it

GCLASSROOM_BROWSER

chrome, brave, edge, arc, chromium or vivaldi. The server reads and decrypts the cookies straight from that browser's profile (macOS and Linux; on macOS it asks for Keychain access once). Choose another profile with GCLASSROOM_BROWSER_PROFILE (for example Profile 1).

GCLASSROOM_COOKIES_FILE

Path to a cookies export: Netscape cookies.txt, a JSON array from a cookie-export extension, or a plain Cookie: header.

GCLASSROOM_COOKIES

A raw Cookie header value copied from DevTools (Network tab → any classroom.google.com request → Request Headers → cookie).

Optional settings:

  • GCLASSROOM_AUTHUSER: the account index if you're signed in to several Google accounts (the N in /u/N/). Default 0.

  • GCLASSROOM_DOWNLOAD_DIR: where download_file saves files. Default ~/Downloads/classroom-mcp.

  • GCLASSROOM_USER_ID: override your Classroom user id. It's normally detected from the page.

The cookies must include SID, HSID, SSID, APISID, SAPISID and the __Secure-* cookies for .google.com. Exporting every cookie for google.com covers them.

Use it with Claude

Claude Code:

claude mcp add google-classroom -e GCLASSROOM_BROWSER=chrome -- node /absolute/path/to/google-classroom-mcp/dist/index.js

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "google-classroom": {
      "command": "node",
      "args": ["/absolute/path/to/google-classroom-mcp/dist/index.js"],
      "env": { "GCLASSROOM_COOKIES_FILE": "/absolute/path/to/cookies.txt" }
    }
  }
}

Course arguments accept a numeric id, a classroom.google.com/c/... link, or part of the class name. Item arguments accept an id or a link to the post; a full link also supplies the course.

Tools

Reading (verified against a live student account)

Tool

What it does

whoami

Shows your Classroom user id, name and email

list_courses

Lists your classes (archived ones are optional)

get_course

Shows class details, teachers, your role and your class Drive folder

list_course_people

Lists teachers and classmates

list_topics

Lists classwork topics

get_stream

Shows stream posts and announcements with full text (paged)

list_classwork

Shows the Classwork page grouped by topic, with optional topic and kind filters (paged)

list_todo

Shows assigned, missing or done work across classes

list_due_work

Lists work due between two dates (calendar view)

search_classwork

Searches post titles and text across classes

get_item

Shows everything about one post: text, due date, points, attachments, your submission, class comments and private comments

get_my_submission

Shows your submission state, status, attachments and answer

get_my_work_in_course

Lists your assigned work in a class with the status of each

list_class_comments / list_private_comments

Read comment threads

get_file_info

Shows Drive metadata for an attachment

download_file

Saves an attachment to disk; Docs, Sheets and Slides are exported to PDF, DOCX, CSV and other formats

read_file_content

Returns an attachment's content: Docs and Slides as text, Sheets as CSV, .docx/.pptx/.xlsx as extracted text, images inline, PDFs embedded

list_class_drive_folder

Lists your Drive folder for a class

Writing (acts on your real account)

Tool

What it does

post_class_comment

Posts a public class comment

post_private_comment

Sends a private comment to your teacher

edit_comment / delete_comment

Edits or deletes one of your comments

turn_in

Turns in an assignment or marks it as done

unsubmit

Takes back work you turned in

answer_question

Answers a short-answer or multiple-choice question (this also turns it in)

add_link_attachment

Attaches a URL to your work

add_drive_file_attachment

Attaches an existing Drive file to your work

upload_to_drive

Uploads a local file to Drive (optionally into your class folder)

upload_and_attach_file

Uploads a local file and attaches it to your work

remove_attachment

Removes one of your attachments

join_class

Joins a class with a class code

accept_invitation

Accepts a class invitation

leave_class

Unenrolls you from a class

raw_rpc

Escape hatch: calls any Classroom RPC by id

Verification status of the write tools: their request formats were taken from the Classroom web client's JavaScript and checked offline, but none has been run against a live account yet. Each tool's description says so. Try them on something low-stakes first, and check the result with get_item / get_my_submission. Known gaps:

  • Grades aren't decoded yet. Use raw: true on get_item / get_my_submission to see the raw submission.

  • Multiple-choice options may not appear in get_item. The answer_question answer format is a best guess.

  • The delete_comment request shape is inferred.

  • upload_to_drive uses Drive's multipart upload through clients6.google.com. Reading through that host is verified; uploading isn't.

How it works

  • Classroom data: POST https://classroom.google.com/u/N/_/ClassroomUi/data/batchexecute. These are Google's internal "batchexecute" RPCs with array-encoded protobuf payloads and field masks captured from the web client (src/masks.ts). The XSRF token (SNlM0e), session id (FdrFJe), build label (cfb2h) and your user id are read from the /u/N/h page.

  • Drive files: https://clients6.google.com/drive/v3/..., authenticated with SAPISIDHASH and cookies (the same way the web app does it). www.googleapis.com rejects cookie auth from another origin.

  • Cookies that Google rotates through Set-Cookie are updated in memory, so a long-running server keeps working until your session ends. When that happens, export fresh cookies.

Development

npm run dev        # tsc --watch
npm run typecheck

Source layout: cookies.ts (cookie sources and Chromium decryption), http.ts (transport and SAPISIDHASH), client.ts (session and batchexecute), classroom.ts (Classroom operations), parse.ts (JSPB → JSON), drive.ts, office.ts (docx/pptx/xlsx text), tools.ts (MCP tools), index.ts (stdio entry point).

Available Tools

35 tools
accept_invitationAccept class invitationA

Accept an invitation to join a class (the course id is shown on the invitation / in list_courses). NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: course (required).

add_drive_file_attachmentAttach Drive fileA

Attach an existing Google Drive file to your work on an assignment. Does not turn it in. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: file (required), item (required), course.

answer_questionAnswer questionA

Submit your answer to a question post (short answer or multiple choice). This also turns it in. Use get_item first to see the question type and choices. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), answer (required), type, course.

delete_commentDelete commentB
Destructive

Delete one of your own comments. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), comment_id (required), visibility (required), course.

download_fileDownload fileA

Download a Classroom attachment (Drive file) to disk. Google Docs/Sheets/Slides are exported (default PDF for download; choose with export_format).

Inputs: file (required), save_to, export_format.

edit_commentEdit commentA
Idempotent

Edit one of your own comments. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), text (required), comment_id (required), visibility (required), +1 more.

get_courseGet class detailsB
Read-only

Details for one class, including your class Drive folder and the teacher names.

Inputs: course (required).

get_file_infoGet file infoB
Read-only

Metadata for a Drive file attached in Classroom (name, type, size, owner, link).

Inputs: file (required).

get_itemGet post / assignmentA
Read-only

Full details of a post, assignment, question or material: text, due date, points, attached files/links, your submission (status, your attachments, answer), and comments.

Inputs: item (required), raw, course, include_comments.

get_my_submissionGet my submissionB
Read-only

Your submission for an assignment or question: state (turned in, returned…), status (assigned/missing/done), attachments and answer.

Inputs: item (required), raw, course.

get_my_work_in_courseMy work in a classB
Read-only

All of your assigned work in one class with your submission status for each.

Inputs: course (required), limit.

get_streamRead class streamB
Read-only

Read the class stream: announcements and posts, newest first, with full text.

Inputs: course (required), limit, page_token.

join_classJoin class with codeA

Join a class using its class code. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: code (required).

leave_classLeave (unenroll from) classA
Destructive

Unenroll yourself from a class. You will lose access to it until re-invited or you re-join with a code. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

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

list_class_commentsRead class commentsB
Read-only

Read the public class comments on a post or assignment.

Inputs: item (required), course.

list_class_drive_folderList class Drive folderB
Read-only

List the files in your Drive folder for a class (where Classroom stores your submitted work), or any Drive folder.

Inputs: course, folder.

list_classworkList classworkA
Read-only

List the Classwork page of a class: assignments, questions and materials grouped by topic. Pass topic to page through one topic (use topic "none" for items with no topic).

Inputs: course (required), kind, limit, topic, +1 more.

list_course_peopleList class peopleA
Read-only

List the teachers and classmates in a class (names; emails when Classroom exposes them).

Inputs: course (required).

list_coursesList classesB
Read-only

List the classes you are enrolled in (id, name, section, room, teacher/owner id, link).

Inputs: include_archived.

list_due_workList work due in a date rangeB
Read-only

Calendar view: work due between two dates, across all classes or one class.

Inputs: to (required), from (required), limit, course.

list_private_commentsRead private commentsA
Read-only

Read the private comments between you and your teacher on an assignment or question.

Inputs: item (required), course.

list_todoList to-doB
Read-only

Your to-do list across classes (or one class): assigned, missing, or done work.

Inputs: limit, course, status, page_token.

list_topicsList topicsB
Read-only

List the classwork topics of a class.

Inputs: course (required).

post_class_commentPost class commentA

Post a public class comment on a post or assignment (visible to the whole class).

Inputs: item (required), text (required), course.

post_private_commentPost private commentA

Send a private comment to your teacher on an assignment or question.

Inputs: item (required), text (required), course.

raw_rpcRaw Classroom RPCA
Destructive

Advanced: call any Classroom web-client batchexecute RPC by id with a JSON payload and return the decoded response. Can perform writes; use only if you know the RPC.

Inputs: rpc_id (required), payload (required).

read_file_contentRead file contentA
Read-only

Read the contents of a Classroom attachment: Google Docs/Slides as text, Sheets as CSV, .docx/.pptx/.xlsx as extracted text, plain-text files as text, images as images, PDFs as an embedded PDF.

Inputs: file (required), max_chars, export_format.

remove_attachmentRemove attachmentA
Destructive

Remove one of your own attachments from your work on an assignment (match by material id, Drive file id, URL or title). Only possible while not turned in. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), attachment (required), course.

search_classworkSearch classworkA
Read-only

Search post titles and text across your classes (or one class) for a keyword.

Inputs: query (required), course, per_class_limit.

turn_inTurn in / mark as doneA
Idempotent

Turn in your work for an assignment (or mark it as done if it has no attachments). NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), course.

unsubmitUnsubmitA
Idempotent

Unsubmit (take back) work you turned in so you can change it. If it is past the due date it may be marked late when re-submitted. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), course.

upload_and_attach_fileUpload and attach fileA

Upload a local file into your class Drive folder and attach it to your work on an assignment. Does not turn it in. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: item (required), path (required), name, course.

upload_to_driveUpload file to DriveA

Upload a local file to your Google Drive (optionally into a folder, e.g. your class folder). Returns the Drive file id. NOTE: the request format for this write was derived from the Classroom web client's code and has not been verified against a live account; check the result.

Inputs: path (required), name, course, folder.

whoamiWho am IA
Read-only

Show the signed-in Classroom account (user id, name, email).

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.7/5.0

    Scored across 35 tools

    Disambiguation4/5

    Most tools carve out distinct resource+action pairs (course, stream, classwork, comments, submissions, attachments, Drive). A few pairs blur: get_item vs get_my_submission (item details already include your submission), and upload_to_drive vs upload_and_attach_file, which differ only by whether an attachment is added. These overlaps are resolvable from descriptions but could cause occasional misselection.

    Naming Consistency4/5

    Overwhelmingly consistent snake_case verb_noun (list_courses, get_course, turn_in, add_link_attachment, post_private_comment). Minor deviations are the standalone commands whoami and raw_rpc, plus upload_and_attach_file using 'and' for a compound action. The pattern remains highly predictable overall.

    Tool Count4/5

    35 tools is heavy, but the surface genuinely spans courses, people, stream, topics, classwork, comments, submissions, attachments, and Drive, so most tools earn their place. A few could be consolidated (e.g. upload_to_drive plus upload_and_attach_file, get_my_submission folded into get_item).

    Completeness5/5

    Excellent student-lifecycle coverage: discover/join/leave classes, browse stream and classwork, attach and upload work, answer questions, turn in/unsubmit, and manage comments. Drive read/download/upload and a raw_rpc escape hatch close remaining gaps; no obvious dead ends for a student-facing client.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers