Skip to main content
Glama
README.md
# eclass-mcp

A **read-only** [MCP](https://modelcontextprotocol.io) server for York University's eClass (Moodle). Ask Claude (or any MCP client) things like *"what's due this week?"* or *"what's my grade in EECS 2311?"*

> Unofficial; not affiliated with York University. Your own account only. Check York's acceptable-use policy.

## Try it in 10 seconds (no login needed)

```bash
npx -y github:keerthan9453/eclass-mcp --demo
```
Runs against a built-in fake eClass. To see every tool called, clone the repo and run `npm install && npm run demo`.

## Use it with your account

Pick whichever setup York allows. They can be combined.

| Setup | What you get | Needs |
|---|---|---|
| **A. Calendar feed** (easiest) | `get_upcoming_deadlines` | Your private ICS URL |
| **B. Web service token** | courses, assignments, grades, course contents | A Moodle token (York must allow it) |

### A. Calendar feed
In eClass: **Calendar → Import or export calendars → Export** → pick "All courses" + a time range → *Get calendar URL*. Copy it.

### B. Web service token

Gets you courses, assignments, grades, course contents and deadlines. It works only if your school allows Moodle's mobile service (York does). Use **Chrome, Brave or Edge**: Safari doesn't show the request you need.

1. Sign in to eClass in Chrome. Open DevTools (Cmd+Option+I, or F12) → **Network**, and tick **Preserve log**.
2. In the same tab, open:
   `https://eclass.yorku.ca/admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=12345&urlscheme=moodlemobile`
   The page appears to fail ("Unsupported URL scheme" or "invalid address"). That means it worked: eClass redirected to a `moodlemobile://token=…` link, which only the Moodle mobile app can open.
3. In the Network list, find the request whose name starts with `moodlemobile://token=`. Right-click it → **Copy → Copy URL**. (If it isn't listed, click the `launch.php` row and read the `Location` header.)
4. Turn that link into your token. Run this in Terminal, paste the link when asked (nothing shows as you paste), and press Return:
   ```bash
   printf 'Paste link: '; read -rs L; echo; node -e "console.log(Buffer.from(process.argv[1].trim().split('token=').pop(),'base64').toString().split(':::')[1])" "$L"
   ```
   It prints a 32-character string. That is your `ECLASS_WS_TOKEN`.
5. Put it in your MCP client config (below). Don't paste it into chat, issues or commits.

**It didn't work?**
- *A Moodle error page ("Web service is not available")* means your school has the mobile service off. Use setup A.
- *Nothing in the Network list* means the page was opened before DevTools. Reload it with DevTools open and Preserve log on.
- Safari reports "address is invalid" and shows no request, so switch to Chrome.
- If `check_connection` later returns an HTML page with HTTP 202, a firewall is challenging the request. The server already uses your system `curl` to avoid this (see *Firewall note*).

### Claude Desktop / any MCP client config
```json
{
  "mcpServers": {
    "eclass": {
      "command": "npx",
      "args": ["-y", "github:keerthan9453/eclass-mcp"],
      "env": {
        "ECLASS_ICS_URL": "https://eclass.yorku.ca/calendar/export_execute.php?...",
        "ECLASS_WS_TOKEN": "optional-token"
      }
    }
  }
}
```
Claude Code: `claude mcp add eclass -e ECLASS_ICS_URL=... -- npx -y github:keerthan9453/eclass-mcp`

## Tools
| Tool | Needs | Description |
|---|---|---|
| `get_upcoming_deadlines(days)` | token or ICS | Deadlines in the next N days (1–365, default 14). Uses the token if set, else the calendar feed |
| `check_connection` | token | Confirms the token works; shows your name |
| `list_courses` | token | Enrolled courses with ids |
| `get_assignments(course_id)` | token | Assignments and due dates |
| `get_grades(course_id)` | token | Your grade items |
| `get_course_contents(course_id)` | token | Sections, resources, activities |

## Environment variables
`ECLASS_ICS_URL`, `ECLASS_WS_TOKEN`, `ECLASS_BASE_URL` (default `https://eclass.yorku.ca`), `ECLASS_TIMEOUT_MS` (default 15000), `ECLASS_TRANSPORT` (`curl` default, or `fetch`).

## Scenarios handled
- No config → only the calendar tool shows, with an error saying what to set
- Calendar URL expired/regenerated (404), or returns a login page → explicit error
- Token invalid, or web services disabled → explicit error; secrets are never echoed back
- Slow or unreachable server → times out (no hang)
- `http://` to a non-local host → refused so credentials aren't sent in clear text
- Course with no assignments/grades, assignments with no due date → handled
- Schulich courses live on Canvas, not eClass, so they won't appear

## Firewall note
York's front end may answer Node's built-in `fetch` with an HTML bot-challenge page (HTTP 202) while accepting `curl`. The server therefore sends requests through your system `curl` by default (needs `curl` on PATH, which macOS and most Linux have). Set `ECLASS_TRANSPORT=fetch` to force Node's fetch.

## Security
The ICS URL and token grant access to your account. Keep them in your MCP client's `env`, never commit them. The server never writes to eClass.

## Development
```bash
npm install
npm test     # builds and runs 22 end-to-end scenarios against a mock eClass
npm run demo # scripted walkthrough
```
`dist/` is committed so `npx github:...` works without a build step. Run `npm run build` before committing source changes.

TDQS

A3.7/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is no possibility of confusion with another tool in the set. Its stated purpose (listing upcoming deadlines from assignments and quizzes) is clearly bounded.

Naming Consistency5/5

The single name follows a clean verb_noun pattern (get_upcoming_deadlines) in snake_case. With one tool there is no convention mixing to evaluate against, and the name is readable and predictable.

Tool Count2/5

A single tool is far too thin for a server branded as an eClass integration, which implies courses, content, assignments, and announcements. One read-only deadline lookup does not justify a whole MCP server surface.

Completeness2/5

The surface covers only one read operation (deadlines) with no access to courses, course materials, announcements, grades, or submission status, and no way to drill into a specific assignment. Agents hitting any other common eClass need will dead-end.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues