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

An MCP server that connects your AI assistant (Claude Code, Claude Desktop, T3 Code, OpenCode, ...) to the two
platforms Windesheim students use every day:

- **Ans** (`ans.app`): assignments and deadlines, results with the full rubric and teacher feedback,
  downloading what you handed in, and uploading / submitting (only after you confirm).
- **Brightspace** (`leren.windesheim.nl`): courses, content, files, assignments, calendar and grades.

You log in **once** for both, with your normal Windesheim account and the number-matching 2FA in
Microsoft Authenticator. The login runs headless in the background; you only type a two-digit number on your
phone.

> Unofficial student project. Not affiliated with or endorsed by Windesheim, Ans or D2L. It uses your own account
> and does nothing you couldn't do in the browser yourself. Use it at your own risk.

## What you can ask

- "What are my deadlines this week?"
- "What feedback did I get on DP14? Show me the rubric."
- "Download the assignment PDF for DP18 from Brightspace."
- "Upload this PDF to the IN DP18 assignment on Ans" (asks you first; final submission is a separate, confirmed step)

## Requirements

| | |
|---|---|
| OS | Linux (tested on Fedora / GNOME). macOS should work. Windows: only with `WINDESHEIM_PASSWORD` (see below). |
| Python | 3.12 or newer |
| [uv](https://docs.astral.sh/uv/) | installs the Python dependencies |
| Password storage | Linux: `secret-tool` (package `libsecret-tools` on Debian/Ubuntu, `libsecret` on Fedora). macOS: the built-in Keychain. |
| Phone | Microsoft Authenticator set up for your Windesheim account |
| Optional | `poppler-utils` (`pdftoppm`, `pdfinfo`) for PDF previews in the hand-in screen |

## Installation

```bash
# 1. Get the code
git clone https://github.com/SilkePilon/windesheim-mcp.git ~/.local/share/windesheim-mcp
cd ~/.local/share/windesheim-mcp

# 2. Install the dependencies and the headless browser (Firefox)
uv sync
uv run playwright install firefox

# 3. Enter your student number and password
uv run windesheim-setup
```

`windesheim-setup` asks for your student number (`s1234567`) and your Windesheim password.

- The student number goes into `~/.config/windesheim-mcp/config.env`.
- The password goes into your system keyring (GNOME Keyring / KWallet via `secret-tool`, or the macOS Keychain).
  It is never written to a file by the setup and never sent anywhere except the Windesheim login page.

### 4. Test the login

```bash
uv run windesheim-login
```

After a few seconds you will see a box like this:

```
  ┌──────────────────────────────┐
  │   2FA-NUMMER:   46           │
  └──────────────────────────────┘
  Open Microsoft Authenticator, tik 46 in en keur goed (binnen ~60 s).
```

Open **Microsoft Authenticator**, type that number and approve. The terminal then prints `Ingelogd.` and the session
is saved. You also get a desktop notification with the same number.

## Connect it to your AI client

Use the absolute path to the folder you cloned. The examples assume `~/.local/share/windesheim-mcp`;
replace `/home/YOU` with your home directory.

**Claude Code**

```bash
claude mcp add windesheim --scope user -- uv run -q --directory /home/YOU/.local/share/windesheim-mcp windesheim-mcp
```

**Claude Desktop, T3 Code, Cursor and other clients with an `mcpServers` JSON config**

```json
{
  "mcpServers": {
    "windesheim": {
      "command": "uv",
      "args": ["run", "-q", "--directory", "/home/YOU/.local/share/windesheim-mcp", "windesheim-mcp"]
    }
  }
}
```

**OpenCode** (`opencode.json`)

```json
{
  "mcp": {
    "windesheim": {
      "type": "local",
      "command": ["uv", "run", "-q", "--directory", "/home/YOU/.local/share/windesheim-mcp", "windesheim-mcp"]
    }
  }
}
```

Restart the client (or start a new chat) so it loads the tools.

## Logging in from the chat

Sessions expire after a while. When a tool answers that you need to log in, ask the assistant to log in, or
run `uv run windesheim-login` in a terminal (that always works and shows the number in the terminal).

In the chat it works in two steps:

1. `login_start` starts the login and returns the **2FA number**. The assistant must show you that number right
   away; you also get a desktop notification with it. In clients that support MCP Apps (T3 Code,
   Claude Desktop) a login card shows the number in large type with a countdown.
2. You type the number in Microsoft Authenticator and approve. `login_wait` (or the login card) then finishes the
   login.

Good to know:

- The number expires after about **60 seconds**. Too late? Just start again.
- After several failed or ignored attempts Microsoft blocks new requests for a while
  ("U hebt onze limiet voor verificatiemethoden bereikt"). Wait 10 to 15 minutes before trying again.
- **Ans allows one session per account.** Opening Ans in your own browser logs out the MCP server, and the other
  way around. Log in again when that happens.

## Tools

Tool descriptions are in Dutch, because the platforms are.

| Tool | What it does |
|---|---|
| `login_start`, `login_wait`, `status` | Log in (2FA number), wait for approval, check whether the sessions are still valid |
| `ans_assignments` | All Ans assignments and tests with course code, DP number, status and deadline |
| `ans_result` | One result: points, chosen rubric level per criterion, teacher feedback, handed-in files |
| `ans_results_overview` | Overview of all graded assignments |
| `ans_download_submission` | Download what you handed in |
| `ans_upload` | Upload a file to an open assignment (needs explicit confirmation, not yet final) |
| `ans_inleveren` | **Final** submission (irreversible; needs explicit confirmation) |
| `ans_dashboard` | Dashboard of all assignments with deadlines and rubric scores (interactive in MCP Apps clients) |
| `ans_inleveren_scherm` | Hand-in screen with a preview of your PDF and Upload / Submit buttons you click yourself |
| `bs_get_courses`, `bs_get_course_content`, `bs_get_course_overview` | Browse Brightspace courses and content |
| `bs_get_assignments`, `bs_get_assignment_attachments`, `bs_get_calendar`, `bs_get_grades` | Assignments, attachments, upcoming dates, grades |
| `bs_download_*` | Download files from content, assignments, announcements, the overview or linked pages |
| `bs_audit_course` | Check every student-visible source of a course (handy to see if you missed a file) |
| `bs_browser` | File browser for the course that saves files into your notes folder (MCP Apps clients) |
| `vault_sync` | Personal: syncs Ans data into an Obsidian vault with a `_meta/scripts/ans_sync.py` script. Without that script it does nothing. |

Upload and submit tools refuse to run without `confirm=true`, and their descriptions tell the assistant to ask you
first.

## Configuration

Settings are read from environment variables, or from `~/.config/windesheim-mcp/config.env`
(`KEY=value` per line). Environment variables win.

| Variable | Default | Meaning |
|---|---|---|
| `WINDESHEIM_ACCOUNT` | (required) | `s1234567@student.windesheim.nl`. Set by `windesheim-setup`. |
| `WINDESHEIM_PASSWORD` | | Only if there is no keyring (e.g. Windows). Stored in plain text, so avoid if you can. |
| `ANS_COURSE_ID` | `716245` | Your Ans course. Default: BC1 *Basisconcepten ICT 1*, 2026/27. |
| `ANS_UNIVERSITY_ID` | `178` | Windesheim on Ans |
| `BRIGHTSPACE_COURSE_ID` | `202642` | Course used by `bs_browser`. The other `bs_*` tools take a `course_id`. |
| `BRIGHTSPACE_URL` | `https://leren.windesheim.nl` | |
| `WINDESHEIM_VAULT` | `~/Documents/Windesheim` | Notes folder for `bs_browser` and `vault_sync` |
| `WINDESHEIM_STATE_DIR` | `~/.local/state/windesheim-mcp` | Session cookies and debug screenshots |
| `WINDESHEIM_DOWNLOAD_DIR` | `<state dir>/downloads` | Default folder for Brightspace downloads |

**Another course or cohort?** Open your course on Ans: the URL looks like
`https://ans.app/universities/178/courses/<ANS_COURSE_ID>/...`. For Brightspace, the course page URL is
`https://leren.windesheim.nl/d2l/home/<BRIGHTSPACE_COURSE_ID>`, or ask the assistant to run `bs_get_courses`.

`ans_assignments` recognises titles like `Zwolle - Infrastructuur - DP18 - IP-plan` and maps the course names of
the BC1 programme to short codes (IN, OP, SO, GI, SB, HI). Other titles still show up, just without a code.

## Privacy and security

- Everything runs on your own computer. There is no server in between and no telemetry.
- Your password stays in the system keyring and is only filled into `sts.windesheim.nl`.
- Session cookies are stored in `~/.local/state/windesheim-mcp/state.json` with permissions `0600`. Anyone who
  can read that file can act as you on Ans and Brightspace until the session expires.
- For troubleshooting, screenshots of the login pages are saved in `~/.local/state/windesheim-mcp/debug/`.
  Password fields are masked. Delete the folder whenever you like.

## Troubleshooting

| Problem | Fix |
|---|---|
| `Geen account ingesteld` | Run `uv run windesheim-setup` |
| `Geen wachtwoord gevonden in de keyring` | Run `uv run windesheim-setup` again; on Linux check that `secret-tool` is installed |
| `ADFS weigert: ... limiet voor verificatiemethoden` | Too many 2FA attempts. Wait 10 to 15 minutes. |
| `2FA niet goedgekeurd binnen de tijd` | You were too late; start the login again |
| `Sessie verlopen` / tools say you are not logged in | Log in again (opening Ans in your browser also ends the MCP session) |
| Firefox crashes on start (Wayland) | The server sets `MOZ_ENABLE_WAYLAND=0` itself; when you call Playwright yourself, set it too |
| Login stops at an unexpected page | Look at the newest files in `~/.local/state/windesheim-mcp/debug/` and open an issue |

## Development

```bash
uv sync --extra dev
```

- The Ans parsers (`src/windesheim_mcp/ans.py`) are pure functions on HTML. They were tested against saved Ans
  pages, but those pages contain personal data and grades, so the tests are not in this repository. To test
  changes, save your own Ans pages (e.g. in `tests/fixtures/`, which is git-ignored) and write tests against them.
- All Ans requests go through Playwright's request context (same fingerprint as the login). Ans treats plain
  `httpx` requests as "logged in elsewhere".
- `mcp<2` is pinned (FastMCP API). The UI screens are MCP Apps: `ui://windesheim/{dashboard,login,inleveren,brightspace}.html`,
  one HTML file per screen in `src/windesheim_mcp/ui/`, no external scripts.

## Credits

The Brightspace tools are adapted from [NorthProt-Inc/brightspace-mcp](https://github.com/NorthProt-Inc/brightspace-mcp)
(MIT). This project is MIT licensed, see [LICENSE](LICENSE).