spbstu-mcp
Your Peter the Great St. Petersburg Polytechnic University (SPbPU) studies, available to Claude.
An MCP server for SPbPU student services: the dl.spbstu.ru Moodle, the university mailbox, openedu.ru and the timetable. You sign in with your university account; your password stays in your operating system's credential store.
English · Русский
https://github.com/user-attachments/assets/79137c69-5d3f-4270-9164-e509f88c3535
"What's due this week?" · "Summarise the database course assignment and download its files." · "Did the teacher grade my coursework?" · "Draft a reply to the curator's email."
Contents
- What it does
- Quick start
- Several accounts
- Tools
- How it works
- Security and privacy
- Configuration
- Troubleshooting
- Development
- Contributing
What it does
Quick start
1. Store your university login in the operating system's credential store. LOGIN is your single university
account, the one in [email protected].
security add-generic-password -s spbstu -a [email protected] -T /usr/bin/security -w
[!IMPORTANT] Keep
-wlast, so thatsecurityprompts for the password with hidden input; anything after-wwould be stored as the password itself. To check (prints only the length):security find-generic-password -s spbstu -w | wc -c
Needs secret-tool (apt install libsecret-tools, dnf install libsecret, pacman -S libsecret):
secret-tool store --label=spbstu service spbstu account [email protected]
cmdkey /generic:spbstu /user:[email protected] /pass
The password is asked with hidden input in every case.
2. Install the server. With Homebrew (macOS, Linux):
brew install kad-xyz/tap/spbstu-mcp
Or download the archive for your system from Releases
and put spbstu-mcp somewhere on disk, e.g. ~/.local/bin. On macOS, clear the download quarantine (the binary is not
notarized):
xattr -d com.apple.quarantine ~/.local/bin/spbstu-mcp
go install github.com/kad-xyz/spbstu-mcp/cmd/spbstu-mcp@latest
3. Connect it to Claude.
claude mcp add spbstu -s user -- "$(command -v spbstu-mcp)"
claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):
{
"mcpServers": {
"spbstu": { "command": "/Users/YOU/.local/bin/spbstu-mcp" }
}
}
Then just ask: "What's going on with my studies?"
[!TIP] No account at hand? Start the server with
-demo(claude mcp add spbstu-demo -- spbstu-mcp -demo): it serves a made-up student's courses, deadlines and mail, touches no university service and needs no credentials.
Several accounts
The server can keep more than one university account, say yours and a classmate's you are helping, and acts as one of them at a time, the active one. Ask "add the account ivanov.ii": on macOS a system dialog asks for its password (paste it from the Passwords app), which goes straight to the keychain, never through the chat, and one sign-in checks it. Then "switch to ivanov.ii", and back when you are done.
- Every reply starts with
Аккаунт: [email protected], the account it was made as. - Every account has its own sessions, so one person's sign-in never serves another.
- Tools marked ✍️ take an
accountargument and refuse to run unless it is the active account: a mail cannot go out from a classmate's mailbox because the switch back was forgotten. - The active account is remembered after a restart.
On Linux and Windows account_add returns the secret-tool or cmdkey command that stores the password; run it, then
call account_add again. The accounts live under the same credential store service, one item per account (on Windows,
an extra account is the generic credential spbstu:[email protected]).
Tools
✍️ changes something on a university service; see Security and privacy.
With a link to an openedu.ru test, the model looks every question up, saves the answers without submitting them and reports each question as ✅ from the base, 🟡 from the base but doubtful (the base answer is kept anyway) or ⚠️ not in the base, to be checked.
How it works
flowchart LR
C[Claude] -- MCP / stdio --> S[spbstu-mcp]
K[(OS credential store<br/>item "spbstu")] -. login + password .-> S
S -- SSO --> CAS[cas.spbstu.ru]
CAS --> DL[dl.spbstu.ru<br/>Moodle mobile API]
S -- SSO --> KC[sso.openedu.ru<br/>«Политех» provider] --> CAS
KC --> OE[courses.openedu.ru<br/>Open edX API]
S -- EWS, Basic auth over TLS --> M[mail.spbstu.ru<br/>Exchange]
S <-. sessions .-> ST[(~/.config/spbstu-mcp/accounts<br/>one state.json per account, 0600)]
- dl.spbstu.ru: signs in through the university SSO and obtains a Moodle mobile web service token, the same way the official Moodle app does.
- openedu.ru: signs in through the «Политех» identity provider of the openedu.ru SSO, then reads the Open edX course APIs.
- Mail: Exchange Web Services with the same account.
- my.spbstu.ru: its own sign-in form, then the JSON endpoints its pages use.
- Answer bases: public pages, cached for a week in
~/.config/spbstu-mcp/answers; when polyvsp.ru is down its web.archive.org copy is read. - Sessions (the Moodle token and cookies) are kept between runs, so the server signs in again only when a session has expired. University sites lock accounts after frequent sign-ins.
Security and privacy
- 🔑 The password never leaves your Mac except to SPbPU and openedu.ru sign-in pages. It is read from the credential store at sign-in time and never appears in tool results.
- 🗂 Sessions are stored in
~/.config/spbstu-mcp/accounts/[email protected]/state.json, one file per account, readable only by you. Delete a file to sign that account out everywhere. - 👥 Accounts don't mix. Every write tool refuses to run unless its
accountargument is the active account; see Several accounts. - ✋ Writes need your confirmation. The descriptions of
dl_submit_assignment,dl_forum_*andmail_sendtell the model to act only after you have confirmed exactly what goes where.mail_sendonly saves a draft unless asked to send. - 🚫 No exams. Timed and proctored exams open only in the browser. Test answers are only saved; submitting them is up to you.
[!WARNING] This is an unofficial project, not affiliated with SPbPU or openedu.ru. Use it with your own account only.
Configuration
Troubleshooting
Development
go test ./... # offline unit tests
SPBSTU_LIVE=1 go test ./... # plus checks against the live services (needs the credential item)
go build -o bin/spbstu-mcp ./cmd/spbstu-mcp
cmd/spbstu-mcp MCP tools (dl, mail, openedu, overview, accounts)
internal/accounts added accounts, the active one, per-account session stores
internal/cas university SSO sign-in
internal/moodle dl.spbstu.ru client
internal/ews Exchange Web Services client
internal/openedu openedu.ru and Open edX client
internal/mypoly my.spbstu.ru client
internal/ruz public timetable client
internal/answers polyvsp.ru and polyphis.ru answer bases
internal/keychain credential stores: macOS keychain, Secret Service, Windows Credential Manager
internal/state persisted sessions and cookie jar
Releases are built by GitHub Actions on every v* tag.
Contributing
Contributions are welcome, in English or Russian: read CONTRIBUTING.md first. Security issues go through private advisories, not public issues.