Repository navigation
MCP
strava-cz mcp lets an AI agent use your canteen account: look at the menu, see what is
ordered, check the balance, and order or cancel meals. It speaks the
Model Context Protocol over standard input and output,
so any MCP client can start it: Claude Desktop, Claude Code, an agent you wrote yourself.
It is the same thing as the strava-cz command, offered to an agent as tools. It
signs in through the same profiles, and a password is never an argument of a
tool, so it never passes through the model.
- Install
- Set up a login
- Connect a client
- Ordering, and read-only mode
- The tools
- Results and errors
- How it works
- Troubleshooting
pip install "strava-cz[cli,mcp]"mcp adds the official MCP SDK (version 2.3 or newer). cli is optional, but it is what
lets a profile keep its password in the operating system's keyring or encrypted in the
profile file; without it the server reads the password from $STRAVA_CZ_PASSWORD.
The SDK supports Python 3.10 and newer, the same as the library, so nothing else changes. Check it worked:
strava-cz mcp --helpIf the extra is missing, strava-cz mcp says so and tells you the command above. The rest
of the package never needs the SDK.
Store a profile once, in a terminal. See Profiles for the details.
strava-cz profile add skola --username your.username --canteen 3753 --verifyThe server then signs in as that profile. The password comes from, in this order:
-
$STRAVA_CZ_PASSWORD_<PROFILE>, then$STRAVA_CZ_PASSWORD, if set - wherever the profile keeps it: the OS keyring, or the encrypted profile file
The server cannot ask you anything: its standard input is the protocol, and an agent has no terminal to type a password into. So:
- a
keyringprofile just works, if the keyring is unlocked in the session the client runs in - an
encryptedprofile needs its passphrase in$STRAVA_CZ_PASSPHRASE_<PROFILE>or$STRAVA_CZ_PASSPHRASE, and answers with an error otherwise - an
envprofile needs$STRAVA_CZ_PASSWORD - a
promptprofile cannot be used with the server, because it asks every time
Put the variables in the client's configuration (the env block below) rather than in your
shell profile, so they exist where the server starts. A server started by a client does not
inherit your terminal's environment.
Most clients take a block like this in their configuration (Claude Desktop calls the file
claude_desktop_config.json):
{
"mcpServers": {
"strava-cz": {
"command": "strava-cz",
"args": ["--profile", "skola", "mcp"]
}
}
}Add "--read-only" to args for a server that can only read, and an "env" object for
any variable the login needs:
{
"mcpServers": {
"strava-cz": {
"command": "strava-cz",
"args": ["--profile", "skola", "mcp", "--read-only"],
"env": { "STRAVA_CZ_PASSPHRASE": "..." }
}
}
}If the client cannot find strava-cz, use the full path of the command in the virtual
environment, or "command": "/path/to/python", "args": ["-m", "strava_cz", ...].
With Claude Code:
claude mcp add strava-cz -- strava-cz --profile skola mcp--profile may stand before or after mcp. Without it the default profile is used.
--profile-store, --language and --timeout work as they do for the command. A login
can also be given as --username and --canteen, but only with $STRAVA_CZ_PASSWORD set.
When it starts, the server writes one line to standard error saying which login and mode it is using. Standard output is reserved for the protocol.
Ordering and cancelling are on by default, because the point of most setups is an agent that orders for you. They change a real account and spend real money, so:
-
strava-cz mcp --read-onlydoes not registerorder_mealsandcancel_mealsat all. The client never sees them, so there is nothing for an agent to be talked into calling. - The write tools carry
destructiveHint: true, and the read toolsreadOnlyHint: true. A client that honours them can ask you before each order. Hints are hints; whether a client asks is up to the client. - Both write tools have a
dry_runoption that says what would change and sends nothing. - The server states in its instructions that the agent should say what it ordered.
Meals can still only be ordered when the canteen allows it: a closed ordering window or a too low balance is an error, as it is for you.
Names and parameters follow the command line: the same filters, the same options.
| tool | does | parameters |
|---|---|---|
get_menu |
the menu, day by day, with what can be ordered |
period, date_from, date_to, meal_types, orderable, ordered, auto_ordered, include_no_school
|
get_ordered |
what is ordered right now, with the total price |
period, date_from, date_to
|
get_balance |
the account balance | none |
get_account |
who is logged in, where, and the balance | none |
order_meals |
orders meals |
meal_ids, dry_run, continue_on_error, strict_duplicates
|
cancel_meals |
cancels orders |
meal_ids, dry_run, continue_on_error
|
The last two are the write tools, left out by --read-only.
Choosing days. period is today, tomorrow, week (this week, Monday to Sunday) or
next_week. date_from and date_to are YYYY-MM-DD, today or tomorrow, and date_to
is inclusive. Give either period or the dates, not both.
Choosing meals. meal_types is a list of soup, main and unknown. orderable,
ordered and auto_ordered are true or false, and leaving one out does not filter
on it. include_no_school adds days the canteen does not cook on. What each means is in
Menu System and Meals and Restrictions.
Naming meals. meal_ids are ids such as 2026-11-09:O2, the day and the slot, exactly
as get_menu and get_ordered print them. A bare number is refused: the canteen numbers its
menu afresh at every login, and every tool call is one. See Command Line.
order_meals and cancel_meals run as one transaction, as strava-cz order and cancel
do, and check the result against the canteen's records. See Ordering Meals.
Results are structured JSON, in the shape strava-cz --format json prints for the same
command, with "ok": true and the name of the "command". For example get_balance:
{ "ok": true, "command": "balance", "balance": 512.5, "currency": "Kč" }and order_meals:
{
"command": "order",
"ok": true,
"changed": ["2026-11-09:O2"],
"unchanged": [],
"skipped": [],
"failed": [],
"account": { "username": "your.username", "balance": 462.5, "currency": "Kč" }
}(account carries more fields; the session id and the password are never among them.)
With dry_run the result is the plan: would_change, blocked, already, refused,
duplicate, balance_change and balance_after, and "dry_run": true.
A failure comes back as a tool error whose text names the library's exception and what it knows, so an agent can act on it and you can read it:
Error executing tool order_meals: MealNotOrderableError: Cannot order meal 2026-09-02:O1: the ordering deadline for this day has passed (meal_id=2026-09-02:O1, reason=closed)
Error executing tool order_meals: InsufficientBalanceError: Nedostatečná výše konta pro objednání tohoto jídla (API code 35) (code=35, status_code=555)
The exceptions are those in Error Handling. Two cases are worth knowing:
- With
continue_on_error, a meal that cannot be ordered is not an error: the call returns normally with"ok": falseand the meal infailed, next to what did change. -
OrderNotConfirmedErrormeans the canteen may have saved the change but it could not be confirmed. The text listschangedandunconfirmed. Look atget_orderedbefore trying again.
- One login per call. Each tool call signs in, does its work and signs out, exactly like one run of the command. The server holds no session, so one that has expired cannot get in the way, and nothing is renumbered under a call.
- One call at a time. Calls queue up behind each other, so two logins never race on the same account.
- The password is not kept. It is read for each login and dropped after the login request, as in the command.
- Standard output is the protocol. Nothing else is ever written there.
| symptom | cause |
|---|---|
the MCP server needs the 'mcp' package |
install the extra: pip install "strava-cz[mcp]"
|
| the client says the server exited at once | run the same command in a terminal; its error goes to standard error |
asks for its password interactively, but there is no terminal |
a prompt profile, or no $STRAVA_CZ_PASSWORD, as the server cannot ask |
a passphrase error with an encrypted profile |
set $STRAVA_CZ_PASSPHRASE_<PROFILE> in the client's env
|
No password for ... in the OS keyring |
the keyring is locked or not reachable from where the client runs; use the env block |
| a write tool is missing | the server was started with --read-only
|
See also Profiles, Command Line and Installation Guide.