my-epitech-mcp
<div align="center">
# my-epitech-mcp
**Your my.epitech.eu, as tools an AI agent can use.**<br>
Moulinette results down to each failing test, projects and deadlines, marks, credits, and more.
<p>
<img alt="node" src="https://img.shields.io/badge/node-26%2B-5FA04E?logo=nodedotjs&logoColor=white">
<img alt="typescript" src="https://img.shields.io/badge/TypeScript-no%20build-3178C6?logo=typescript&logoColor=white">
<img alt="mcp" src="https://img.shields.io/badge/MCP-server-6E56CF">
<img alt="tools" src="https://img.shields.io/badge/tools-15-0A7EA4">
<img alt="license" src="https://img.shields.io/badge/license-MIT-2EA44F">
<img alt="status" src="https://img.shields.io/badge/status-unofficial-orange">
</p>
<sub>Planning and registrations are <a href="https://github.com/daniilsys/epiplan">epiplan</a>'s job. This one covers everything else.</sub>
</div>
<br>
<table>
<tr>
<td width="50%" valign="top">
### What it does
- Tells you **why** a moulinette failed: the failing test, its message, the delivery error, the coding style rule
- Lists your projects with **days left** and their last run
- Reads project **subjects** (PDFs converted to text)
- Shows marks, **defense grids** and evaluator comments
- Explains your **credits**: acquired, projected, at risk, lost
- Stays logged in **on its own**, Microsoft SSO included
</td>
<td width="50%" valign="top">
### What it never does
- Show other students' names or logins
- Name your evaluators
- Launch a moulinette run without a dry run first
- Write anything unless `MY_EPITECH_WRITES=1`
- Go past its write budget
- Present projected credits as acquired ones
</td>
</tr>
</table>
<br>
```
AI agent ──MCP──▶ server.ts ─▶ tools.ts ─▶ api.ts ─▶ client.ts ─▶ my.epitech.eu/api
(you ask) stdio │ │ │
│ small objects, └─ tokens.ts: rotating refresh,
│ no classmates' lock file, then sso.ts:
│ names headless Microsoft re-login
└─ dry run + audit log
for the one write
```
> [!WARNING]
> Unofficial project. It talks to the same private API as the website, with your own account. Use it at your own risk.
## Install
<table>
<tr><td><b>Needs</b></td><td>Node 26+ (runs the TypeScript directly, no build step). <code>pdftotext</code> (poppler-utils) to read PDF subjects.</td></tr>
</table>
```bash
git clone https://github.com/daniilsys/my-epitech-mcp && cd my-epitech-mcp && npm install
node src/cli.ts login # paste the token value, then Ctrl-D
claude mcp add my-epitech -- node "$PWD/src/server.ts" # or any MCP client
```
<details>
<summary><b>Where the token value comes from</b></summary>
<br>
In the DevTools console of a logged-in my.epitech.eu tab:
```js
copy(localStorage['@account']); localStorage.removeItem('@account')
```
Removing it from the browser matters: the refresh token rotates on every use, so the browser and the server must not share one. The site logs you back in through Microsoft on the next load.
</details>
### Stay logged in
The refresh token dies after a few days unused. Anything that calls the API every few hours keeps it alive, or run `node src/cli.ts keepalive` from cron.
For a real safety net, save your Microsoft session once, as epiplan does. When the refresh token is dead, the session is replayed in a headless Chromium and fresh tokens come back without you.
```bash
npx playwright-core install chromium-headless-shell
node src/cli.ts login --browser # visible browser, MFA ok, tick "Stay signed in"
node src/cli.ts import-session session.json # or reuse an epiplan session.json
```
> [!CAUTION]
> The session file opens your whole Microsoft account, mail included. Keep it `0600`, treat it like a password, and don't use the same one on two machines.
## Tools
<table>
<tr><th align="left">Tool</th><th align="left">What it gives</th></tr>
<tr><td colspan="2"><b>Moulinette</b></td></tr>
<tr><td><code>epitech_moulinette_results</code></td><td>Latest run of each project: tests passed/total, failure flags, coding style, coverage. Filter by project, unit or <code>failing_only</code></td></tr>
<tr><td><code>epitech_moulinette_run</code></td><td>One run in detail: every test with its failure message, style errors by rule, delivery error, traces</td></tr>
<tr><td><code>epitech_moulinette_history</code></td><td>Every run of a project, oldest first</td></tr>
<tr><td><code>epitech_launch_moulinette</code></td><td>Launch a run on the last push. Uses the project quota. Write tool: dry run by default</td></tr>
<tr><td colspan="2"><b>Projects</b></td></tr>
<tr><td><code>epitech_projects</code></td><td>Current, upcoming or past projects with end date, days left, group size, last run</td></tr>
<tr><td><code>epitech_project</code></td><td>Description, my activities and attendance, subject files, runs left</td></tr>
<tr><td><code>epitech_project_file</code></td><td>Text of a project file, PDF subjects converted</td></tr>
<tr><td><code>epitech_invitations</code></td><td>Pending group invitations</td></tr>
<tr><td colspan="2"><b>Progress</b></td></tr>
<tr><td><code>epitech_progress</code></td><td>Credits acquired and projected, skill blocks and learning outcomes, blocking exams, alerts, XP and streak</td></tr>
<tr><td><code>epitech_marks</code></td><td>Published marks and evaluation grids with comments</td></tr>
<tr><td><code>epitech_peer_evaluations</code></td><td>Peer evaluations to do and received</td></tr>
<tr><td colspan="2"><b>Everything else</b></td></tr>
<tr><td><code>epitech_profile</code></td><td>Cursus, year, semester, promotion, campus. No login or name</td></tr>
<tr><td><code>epitech_notifications</code></td><td>Intranet feed: cancellations, room changes, published results</td></tr>
<tr><td><code>epitech_github_stats</code></td><td>Commits and lines on the Epitech GitHub organisations</td></tr>
<tr><td><code>epitech_school_calendar</code></td><td>School and company weeks</td></tr>
</table>
Dates are `Europe/Paris`. From the shell, `node src/cli.ts <tool> '<json>'` runs a read tool, or the dry run of a write tool:
```bash
node src/cli.ts moulinette_results '{"failing_only":true}'
```
## Safety
<table>
<tr><th align="left">Guardrail</th><th align="left">Detail</th></tr>
<tr><td>Privacy by construction</td><td>Outputs are built from explicit field lists. Groups become sizes, evaluators are dropped, unknown payloads are scrubbed</td></tr>
<tr><td>Writes off by default</td><td>The write tool is not even registered without <code>MY_EPITECH_WRITES=1</code></td></tr>
<tr><td>Dry run first</td><td><code>dry_run</code> is true unless set to false. Checks: quota left, a commit pushed, no run in progress, project still open</td></tr>
<tr><td>Write budget</td><td><code>MY_EPITECH_MAX_WRITES</code> real writes per server process (default 5)</td></tr>
<tr><td>Audit log</td><td>Every write attempt, with its mandatory <code>reason</code>, in <code>audit.jsonl</code></td></tr>
<tr><td>Secrets stay out</td><td>Token and session files are <code>0600</code> and refused otherwise. Their values never appear in errors or logs</td></tr>
</table>
Your agent's own permission prompt on each real write is the last line of defence. Don't set "always allow" on the write tool.
<details>
<summary><b>Configuration</b></summary>
<br>
| Variable | Default | Purpose |
|---|---|---|
| `MY_EPITECH_TOKENS` | `~/.config/my-epitech/tokens.json` | Internal access and refresh tokens |
| `MY_EPITECH_SESSION` | `~/.config/my-epitech/session.json` | Saved Microsoft session, for silent re-logins |
| `MY_EPITECH_WRITES` | unset | Must be `1` to register the write tool |
| `MY_EPITECH_MAX_WRITES` | `5` | Real writes per process |
| `MY_EPITECH_AUDIT` | `~/.config/my-epitech/audit.jsonl` | Write audit log |
</details>
<details>
<summary><b>CLI</b></summary>
<br>
| Command | What it does |
|---|---|
| `login` | Paste the token value (stdin) |
| `login --browser` | Log in with Microsoft in a visible browser, save the session |
| `import-session <file>` | Reuse a saved session, then log in silently |
| `sso` | Silent Microsoft re-login now |
| `status` | Token state (never the tokens) |
| `keepalive` | Refresh if the access token has less than 3 h left |
| `serve` | MCP server on stdio |
| `<tool> [json]` | Run a tool from the shell |
</details>
<details>
<summary><b>Use it as a library</b></summary>
<br>
```ts
import { Epitech, EpitechClient, TokenStore, TOOLS } from "my-epitech-mcp";
const tokens = new TokenStore({ file: "/path/tokens.json" });
const ep = new Epitech(new EpitechClient({ tokens }));
await ep.moulinetteResults({ failingOnly: true });
```
`TOOLS[i].input(z)` builds each schema with your own zod instance. Write tools expose `check` (dry run) and `apply` separately, for hosts with their own confirmation flow.
</details>
## API notes
What was reverse engineered, endpoint by endpoint, with the pitfalls: [docs/API.md](docs/API.md). It complements [epiplan's notes](https://github.com/daniilsys/epiplan/blob/main/docs/API.md) on auth and planning.
## License
[MIT](LICENSE)
TDQS
Scored across 14 tools
Most tools target clearly distinct resources (marks, notifications, invitations, calendar, GitHub stats), and the moulinette trio is well separated by scope: list summaries, one run in detail, one project's history. The only real friction is the singular/plural pair epitech_projects vs epitech_project and the related epitech_project_file, which rely on descriptions to disambiguate list-view versus detail-view.
Every tool follows the same epitech_<noun> snake_case convention with no mixing of styles or verb patterns. Singular/plural is used deliberately and consistently to signal list vs single-item access, which is a predictable scheme an agent can learn.
14 tools is squarely in the well-scoped range for a student intranet surface covering projects, moulinette results, marks, progress, notifications and calendar. Each tool maps to a distinct data area with no filler entries.
Read coverage is strong across the whole lifecycle: projects, deadlines, moulinette runs and history, subject files, marks, peer evaluations, progress, notifications, invitations and calendar. The notable gap is action coverage — epitech_project mentions moulinette runs 'I can still launch,' but no tool exists to launch a run, accept an invitation, or register/deregister from a project.