k_ruoka_mcp/lib.rs
1//! Internals of the `k-ruoka-mcp` binary. If you landed here looking for a library to
2//! depend on: there isn't one. Nothing in this crate is a Rust API to program against --
3//! these modules are `pub` only so the integration tests can reach them, and they change
4//! shape without a major version bump.
5//!
6//! What you actually want is the binary, an MCP server that manages one K-Plussa
7//! account's [K-Ruoka](https://www.k-ruoka.fi) shopping cart: read the cart, add items,
8//! change quantities, remove items, clear it. It drives a real, installed Chrome over
9//! the DevTools Protocol, because K-Ruoka has no public API and the cart lives behind a
10//! private one authenticated purely by browser cookies.
11//!
12//! # Install and run it
13//!
14//! Published to PyPI as a prebuilt binary wheel, so `uvx` fetches and runs it with no
15//! Rust toolchain:
16//!
17//! ```sh
18//! uvx k-ruoka-mcp login # once, by hand, to sign in
19//! ```
20//!
21//! `cargo install k-ruoka-mcp`, `cargo binstall k-ruoka-mcp` and a Docker image at
22//! `ghcr.io/nikosavola/k-ruoka-mcp` all work too.
23//!
24//! # Register it with an MCP client
25//!
26//! ```json
27//! {
28//! "mcpServers": {
29//! "k-ruoka-cart": {
30//! "command": "uvx",
31//! "args": ["k-ruoka-mcp"]
32//! }
33//! }
34//! }
35//! ```
36//!
37//! `serve` is the default subcommand, and Chrome only starts on the first tool call, so
38//! registering it costs nothing until it's actually used.
39//!
40//! # Tools
41//!
42//! Every cart tool takes a `store_id` -- find one with `search_stores`, or call
43//! `set_default_store` once and omit it afterwards.
44//!
45//! - `search_stores`, `search_products` -- read-only lookups. Search in Finnish; the
46//! catalogue is.
47//! - `get_cart`, `add_to_cart`, `update_cart_item`, `remove_from_cart`, `clear_cart` --
48//! the cart itself. `add_to_cart` takes an EAN and *sets* the quantity, it does not
49//! add to it.
50//! - `get_personal_offers` -- the account's OmaPlussa-edut offers, read-only.
51//! - `auth_status`, `start_login`, `login_status`, `cancel_login` -- signing in through
52//! the assistant instead of a terminal.
53//!
54//! [README.md](https://github.com/nikosavola/k-ruoka-mcp#readme) has the full tool
55//! reference (argument-by-argument notes, error handling, rate limiting) and the terms
56//! of service this is built to stay inside: **one account, your own, and nothing but
57//! your own cart. No checkout -- nothing here can place an order or spend money.**
58//!
59//! # Contributing
60//!
61//! [CONTRIBUTING.md](https://github.com/nikosavola/k-ruoka-mcp/blob/main/CONTRIBUTING.md)
62//! covers the development setup; the module docs below are for that audience, not for
63//! programming against this crate as a dependency.
64
65pub mod browser;
66pub mod login;
67pub mod login_flow;
68pub mod mcp;
69pub mod types;