Bakalari API & MCP Server
An unofficial Python client, command line tool and MCP server for the Bakaláři REST API v3. Read timetables, marks, homework, absence and Komens messages using the same account as your school's Bakaláři website. The client handles login and token renewal and returns typed Python objects.
Česky: Neoficiální knihovna, příkazová řádka a MCP server pro Bakaláře. Rozvrh, známky, úkoly a zprávy na jednom místě, bez dalších běhových závislostí. Český úvod a příklady.
Features
- Python 3.9 or newer, standard library only, with type hints and
py.typed. - Timetables, substitutions, marks, absence, subjects, homework, messages, events, GDPR consents, class fund payments and teacher endpoints.
- School search and published timetables without an account.
- CLI commands with JSON output, saved sessions and runnable example scripts.
- MCP server over stdio: 50 read tools, plus 11 write tools enabled explicitly with
--allow-writes. - Typed models, automatic token renewal, configurable retries and raw API access.
- Reading a message leaves it unread; passwords and tokens are excluded from logs and error messages.
Available modules and permissions depend on your school and account type.
See it in action
Ask your AI assistant in everyday language once you have connected the MCP server. These real conversations in Czech show how school data can become a daily overview, a study plan or an action you approve. Click any screenshot to view it at full size.
Reading and planning work with the default read tools. Signing marks, acknowledging messages and sending
replies require --allow-writes and the appropriate account permissions. The assistant provides the chat UI,
summaries and plans; the MCP server provides access to Bakaláři data and actions.
Explore all four examples, with Czech and English prompts →
Documentation
| Guide | Contents |
|---|---|
| Usage guide | Detailed walkthrough, sessions, practical workflows and troubleshooting |
| Python library | Client methods, models, errors and transports |
| Command line | Commands, options, exports and configuration |
| MCP server | AI host setup, tool catalog and examples |
| AI assistant examples | Real screenshots, Czech and English prompts, and the tools behind each workflow |
| API coverage | Supported endpoints and known limitations |
| Example scripts | Timetables, marks, attachments, calendars, sessions and school search |
Installation
Install from PyPI in a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U bakalari
On Windows, create the environment with py -m venv .venv and activate it in PowerShell with
.\.venv\Scripts\Activate.ps1.
To install from source (including before a release is available on PyPI):
git clone https://github.com/robco/bakalari.git
cd bakalari
python -m pip install .
Both install the library and the bakalari and bakalari-mcp commands. Check the installation with
python -m bakalari --version or python -m bakalari --help.
Configuration
Set your school's Bakaláři address and account credentials in your environment:
export BAKALARI_URL='https://skola.bakalari.cz'
export BAKALARI_USERNAME='your-username'
export BAKALARI_PASSWORD='your-password'
In PowerShell, use $env:BAKALARI_URL = 'https://skola.bakalari.cz' and the same syntax for the other variables.
Use your own school's address and credentials. bakalari schools Praha searches the school directory without
logging in.
| Variable | Purpose |
|---|---|
BAKALARI_URL |
School's Bakaláři address, including /bakaweb if applicable |
BAKALARI_USERNAME |
Bakaláři web username |
BAKALARI_PASSWORD |
Bakaláři web password |
BAKALARI_SESSION_FILE |
Optional CLI session file for subsequent commands without the password |
For a saved session, run bakalari --session-file ~/.bakalari-session.json login, then set
BAKALARI_SESSION_FILE to that path. Protect the session file like a password and keep it out of version control.
See the authentication guide
for refresh tokens and multiple accounts.
Usage examples
Command line
bakalari profile
bakalari timetable # this week's lessons and changes
bakalari marks --new # new marks
bakalari messages --unread # unread messages, left unread
bakalari homeworks --open # open homework
bakalari --json absence # JSON for scripts
Use bakalari <command> --help for options. Commands that change school data are identified in the
CLI reference.
Python library
from bakalari import BakalariClient
client = BakalariClient.from_env()
print(client.actual_timetable().format())
for subject in client.marks().subjects:
print(subject.format_summary())
print(client.unread_messages_count(), "unread message(s)")
Models expose to_dict() for JSON-ready data and raw for the original response. See the
library reference for the complete API.
MCP server
Configure an MCP host to launch bakalari mcp (or python -m bakalari mcp) with the environment above:
{
"mcpServers": {
"bakalari": {
"command": "/absolute/path/to/.venv/bin/bakalari",
"args": ["mcp"],
"env": {
"BAKALARI_SESSION_FILE": "/absolute/path/to/bakalari-session.json"
}
}
}
}
Create the session first using bakalari --session-file /absolute/path/to/bakalari-session.json login.
On Windows, use the virtual environment's Scripts/bakalari.exe path. The host must support stdio MCP servers;
its exact configuration format can vary. Read tools are enabled by default; add --allow-writes only when you
want tools that change school data. The MCP guide
covers setup and practical workflows.
Repository structure
bakalari/ Python package, CLI and MCP server
unittests/ Offline tests, shared helpers and synthetic fixtures
tests/ Optional MCP SDK and read-only live integration tests
docs/ User guides and API references
examples/ Runnable scripts
.github/workflows/ Python Package CI and Python Package Publish
.github/scripts/ CI report summaries and distribution checks
The package stays at the repository root. Each Bakaláři area has its own module; client.py combines the
endpoint mixins. Packaging and tool settings live in pyproject.toml, and _version.py is the version source.
Development
python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check .
python -m mypy bakalari
python -m build
python -m twine check --strict dist/*
Default tests run offline, even when account credentials are present. CI checks supported Python versions, coverage (at least 90%), lint, types, MCP interoperability and installable distributions, and uploads reports. See CONTRIBUTING.md for integration tests, code conventions and the release process. Publishing a GitHub release starts the Python Package Publish workflow, which builds the package and publishes to PyPI using trusted publishing. Tests and distribution checks run separately in Python Package CI. The publish workflow can also be run manually from a branch or tag.
Support the project
If this project is useful to you, you can support its development through Buy Me a Coffee or Revolut. You can also star the repository, report issues, improve documentation or contribute code.
Metadata
Release files for bakalari 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bakalari-1.1.0.tar.gz | 2.5 MB | With provenance | Details for bakalari-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bakalari-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for bakalari-1.1.0-py3-none-any.whl |
Total release size: 2.7 MB
Release files / bakalari-1.1.0.tar.gz
| Download URL | bakalari-1.1.0.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ceb3d58a6f616f05523e3153f5fb7af8ba1e7ee5a327a6e0b56b918f2b6f4ba1
|
|
BLAKE2b-256 checksum How to use checksums |
7496a1417b8365343e1867e514720125a911e6476fb17d342e66358a3679f498
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / bakalari-1.1.0-py3-none-any.whl
| Download URL | bakalari-1.1.0-py3-none-any.whl |
|---|---|
| Size | 144.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24621617ebe2940b4fe9e8c88444e1509581e389f63e9344b61a8763d520af8a
|
|
BLAKE2b-256 checksum How to use checksums |
be3e4f64bc958ef1f60d30bd5a650fd2308fdb8cd5d2cb3b7497a73cba1db5e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for bakalari 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for bakalari-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.