classroom-mcp
# classroom-mcp
**Google Classroom for Claude Code, Codex, Gemini CLI, Cursor and any other MCP client.**
Ask your AI assistant what's due, what your teachers posted, what an assignment actually asks for, and
let it turn in your work after you say yes.
- **No Google Cloud project, no API keys, no OAuth app.** You sign in to Classroom once in a normal
browser window, the same way you always do.
- **Nothing leaves your computer.** There is no server, no telemetry and no analytics. The only sites
it talks to are Google's own (classroom.google.com, docs/drive.google.com), as you. See [PRIVACY.md](PRIVACY.md).
- **Free and open source** (MIT). A personal plug-in, not a service.
> Not affiliated with or endorsed by Google. Use it in line with your school's rules. You are
> responsible for anything you turn in.
## What you can ask
> "What do I have due this week?"
> "Anything new in my Data Science class since Monday?"
> "Summarise the instructions and the attached PDF for the Endterm Project."
> "What are my grades in Computer Graphics?"
> "Turn in `~/labs/lab9.zip` for Lab 9." *(it shows you a summary first and waits for your yes)*
## Tools
| Tool | What it does |
|---|---|
| `status` | Which Google account it's signed in as |
| `list_courses` | Your classes: name, section, teacher, `course_id` |
| `list_todo` | To-do across all classes: `assigned`, `missing` or `done` |
| `list_posts` | A class's Stream: announcements (full text and attachments) and new assignment/material notices |
| `recent_activity` | Everything posted in all your classes in the last N days |
| `list_classwork` | A class's Classwork page, grouped by topic, with due dates |
| `my_grades` | Your status and grade for every item in a class |
| `get_assignment` | One assignment/material/question: instructions, points, due date, attachments, your submission |
| `read_attachment` | Read an attached Google Doc/Slides/Sheet, PDF, Word, PowerPoint or code file |
| `read_page` | Raw text of any Classroom page (fallback) |
| `prepare_submission` | Step 1 of turn-in / unsubmit: attaches files as a draft, submits nothing, returns a token |
| `confirm_submission` | Step 2: actually presses **Turn in** / **Unsubmit**, only with that token |
## Install
You need **Python 3.10+**, **[uv](https://docs.astral.sh/uv/getting-started/installation/)**, and **Google Chrome**
(Edge, Brave or Chromium also work).
```bash
git clone https://github.com/saksham2104/classroom-mcp.git
cd classroom-mcp
uv tool install . # puts the `classroom-mcp` command on your PATH
classroom-mcp login # a browser window opens: sign in, wait for your classes, close the window
classroom-mcp doctor # checks it works and lists your classes
```
`login` opens a separate browser window with its own profile, used only by this tool. Your everyday
Chrome profile is not touched. To update later: `git pull && uv tool install --reinstall .`
## Connect it to your AI tool
The command to run is just `classroom-mcp`.
**Claude Code**
```bash
claude mcp add --scope user classroom -- classroom-mcp
```
**Codex CLI**
```bash
codex mcp add classroom -- classroom-mcp
```
or add to `~/.codex/config.toml`:
```toml
[mcp_servers.classroom]
command = "classroom-mcp"
```
**Gemini CLI**
```bash
gemini mcp add classroom classroom-mcp
```
or add to `~/.gemini/settings.json`:
```json
{ "mcpServers": { "classroom": { "command": "classroom-mcp" } } }
```
**Claude Desktop, Cursor, Windsurf, VS Code and others** use the same JSON shape (see [`examples/`](examples)).
GUI apps often don't see your shell's PATH, so use the full path from `which classroom-mcp`
(macOS/Linux) or `where classroom-mcp` (Windows):
```json
{ "mcpServers": { "classroom": { "command": "/Users/you/.local/bin/classroom-mcp" } } }
```
**Without installing** (runs straight from the clone):
```json
{ "mcpServers": { "classroom": { "command": "uv", "args": ["run", "--directory", "/path/to/classroom-mcp", "classroom-mcp"] } } }
```
## Turning in work
Google's Classroom API doesn't let a student turn in work a teacher created, so classroom-mcp does it
the way you would, in the browser, in two steps:
1. **`prepare_submission`** opens the assignment, checks it can still be turned in, uploads your files
through Classroom's own *Add or create → File* button, and attaches them as a draft. **Nothing is
submitted.** It returns what will happen, a screenshot of *Your work*, and a token that expires in 15 minutes.
2. **`confirm_submission`** with that token presses **Turn in** (or **Mark as done** when there are no
files). The assistant is told to call it only after you've said yes.
Unsubmitting works the same way (`action: "unsubmit"`). If you don't want any of this, set
`CLASSROOM_MCP_READ_ONLY=1` and the two tools disappear.
If you say no after step 1, the uploaded files stay attached as a draft (not turned in). Remove them
on the assignment page if you like.
## Settings
All optional, set as environment variables (most MCP clients accept an `env` block in their config).
| Variable | Default | |
|---|---|---|
| `CLASSROOM_MCP_READ_ONLY` | off | `1` removes the turn-in / unsubmit tools |
| `CLASSROOM_MCP_ACCOUNT` | `0` | Which signed-in Google account to use (the `N` in `classroom.google.com/u/N/`) |
| `CLASSROOM_MCP_SHOW_BROWSER` | off | `1` shows the browser window while it works (handy for debugging) |
| `CLASSROOM_MCP_BROWSER` | auto | Path to a specific Chrome / Edge / Brave executable |
| `CLASSROOM_MCP_HOME` | `~/.config/classroom-mcp` (`%LOCALAPPDATA%\classroom-mcp` on Windows) | Where the profile and cache live |
| `CLASSROOM_MCP_IDLE_SECONDS` | `120` | Close the background browser after this much idle time |
| `CLASSROOM_MCP_MAX_DOWNLOAD_MB` | `100` | Largest attachment `read_attachment` will download |
PDF text extraction is optional: `uv tool install ".[pdf]"`. Without it, PDFs are saved locally and
your AI tool opens them with its own file reader.
## Troubleshooting
- **"Not signed in"**: run `classroom-mcp login` again. Google sessions expire now and then.
- **"Couldn't sign you in: this browser or app may not be secure"**: install Google Chrome (the
fallback Chromium is the usual cause) and run `classroom-mcp login` again.
- **"The profile is open in another window"**: close the login window, or wait two minutes for the
background browser to close itself.
- **Wrong account or no classes**: if you're signed in to several Google accounts in the login
window, set `CLASSROOM_MCP_ACCOUNT` to the right index.
- **Something comes back empty or garbled**: Classroom has no public page API, so this tool reads the
page itself, and Google sometimes changes the page. `read_page` still works. Please
[open an issue](https://github.com/saksham2104/classroom-mcp/issues) with the tool name and what you
expected. Set Classroom's language to English; other languages aren't parsed.
## How it works
`classroom-mcp login` starts your own Chrome with a private profile folder
(`~/.config/classroom-mcp/chrome-profile`) and lets you sign in normally. The MCP server later opens
that same profile **headless** with [Playwright](https://playwright.dev/python/), reads the Classroom
pages it needs, and closes the browser after two idle minutes. Attachments are fetched with the same
session and cached in `~/.config/classroom-mcp/cache/`. `classroom-mcp logout` deletes both.
The scraping leans on the most stable parts of Classroom's pages (link shapes, `data-stream-item-*`
attributes, ARIA roles), not generated CSS class names. Parsers live in
[`src/classroom_mcp/scrape.py`](src/classroom_mcp/scrape.py) and are tested in
[`tests/test_parse.py`](tests/test_parse.py).
## Development
```bash
uv venv && uv pip install -e ".[pdf]" pytest
.venv/bin/pytest
CLASSROOM_MCP_SHOW_BROWSER=1 .venv/bin/classroom-mcp doctor
```
Contributions welcome, especially parser fixes when Classroom changes. Never commit anything from your
profile or cache folders, and use made-up names in test fixtures.
## License
[MIT](LICENSE)
TDQS
Scored across 12 tools
Most tools target a clearly distinct resource (courses, todo, classwork, grades, attachments, assignment details, auth status), and the two-step prepare_submission/confirm_submission is explicitly delineated. The main overlap is list_posts vs recent_activity (per-class stream vs cross-class recent stream) and to some degree list_todo vs my_grades, though the descriptions clarify these.
Nearly all names follow a snake_case verb_noun pattern (list_courses, list_todo, read_attachment, get_assignment, prepare_submission). A few break the pattern with noun-only names (my_grades, status, recent_activity), but conventions remain consistent and readable.
Twelve tools is well within the sweet spot and each tool maps to a distinct user-facing task in a student's Classroom workflow. Nothing feels redundant or padded.
The surface covers discovery (courses, posts, classwork, todo, activity), inspection (assignment details, attachments, grades), and submission with a confirm step, plus a read_page fallback for dead ends. Minor gaps remain around write actions like commenting/posting or answering questions, but core lifecycles are covered.