feat: read-only MCP server (wodify mcp) and list mine
wodify mcp serves every CLI command over MCP stdio, stdlib-only. Tools run cli.main in-process, so the allowlist, write guard and SQLite cache are the CLI's by construction. list mine / the my_classes tool returns the account's reserved classes with roster and workout in one call, and says so plainly when none is reserved. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
This commit is contained in:
1 parent
a15efa0874
commit
4ff4f22ac1
6 files changed
+886
-36
No files matched your search
@@ -78,7 +78,8 @@ src/wodify/
|
||||
store.py SQLite cache (sqlite3, stdlib)
|
||||
service.py cache-through data access -- all fetches go through here
|
||||
render.py compact text output (token-efficient, not a DOM dump)
|
||||
listcmd.py the `list date` / `list workout` commands
|
||||
listcmd.py the `list date` / `list workout` / `list mine` commands
|
||||
mcpserver.py `wodify mcp` -- the same commands as a stdio MCP server (stdlib)
|
||||
cli.py python -m wodify <cmd>
|
||||
```
|
||||
|
||||
@@ -87,8 +88,14 @@ src/wodify/
|
||||
```
|
||||
wodify list date 2026-07-25 # classes: time, coach, booked/max, title, duration, ID
|
||||
wodify list workout 190917816 # attendee names + the workout for that class
|
||||
wodify list mine [2026-07-25] # the account's own classes that day, each with
|
||||
# roster + workout; "No class reserved on …" if none
|
||||
```
|
||||
|
||||
`list mine` takes `--days N` (1-14) to look ahead. "Mine" is any class whose schedule
|
||||
`Status` is non-empty: reserved, waitlist (printed as NOT a confirmed spot) or signed in.
|
||||
No class is a normal answer and exits 0.
|
||||
|
||||
`list date` prints IDs; `list workout <id>` consumes one. Both accept `--refresh`
|
||||
(bypass cache), `--json`, and `list workout` also takes `--notes` for the coach's brief.
|
||||
|
||||
@@ -96,6 +103,37 @@ A class ID resolves to nothing on its own — it is per-occurrence, and carries
|
||||
nor program. `list date` indexes the day's classes into SQLite, and `list workout` looks the
|
||||
ID up there. Querying an ID for a day never listed returns a message saying exactly that.
|
||||
|
||||
## MCP server
|
||||
|
||||
`wodify mcp` serves the CLI over MCP's stdio transport (newline-delimited JSON-RPC).
|
||||
It is **stdlib-only** -- no `mcp` SDK -- so it needs no install step, like the query path.
|
||||
|
||||
Each tool builds an argv and calls `cli.main` in-process with stdout captured. That is
|
||||
the whole design: there is no second code path, so the allowlist, the write guard, the
|
||||
SQLite cache and the output wording are the CLI's by construction. Do not add a tool that
|
||||
fetches on its own; add a CLI command and wrap it.
|
||||
|
||||
| Tool | Runs |
|
||||
|------|------|
|
||||
| `my_classes` | `list mine` -- reserved class material in one call, incl. "none reserved" |
|
||||
| `list_date`, `list_workout` | the `list` commands (cached) |
|
||||
| one per `actions.keys()` | the generic action commands (live, as in the CLI) |
|
||||
| `doctor`, `prime` | same |
|
||||
|
||||
- Single-user: it answers as whoever `prime` captured. No account parameter exists.
|
||||
- A non-zero CLI exit becomes `isError: true` with `[wodify exit N]` appended; the code is
|
||||
from whichever exit table that command uses (see "Exit codes").
|
||||
- Every argument is validated (date regex, digits, real booleans) before it reaches an
|
||||
argv, so a string can never be read as a flag. Unknown arguments are refused.
|
||||
- `prime` is the one tool not annotated `readOnlyHint`: it rewrites the local session
|
||||
cache. It still changes nothing in Wodify. It is exposed so an agent can heal STALE.
|
||||
- While serving, `sys.stdout` is pointed at stderr -- stdout is the protocol channel and a
|
||||
stray `print` would corrupt it.
|
||||
|
||||
Registered with hermes on luhpe as the `wodify` server (`command:
|
||||
/home/lucio/.local/bin/wodify`, `args: [mcp]`). From another machine:
|
||||
`ssh luhpe .local/bin/wodify mcp` is a working stdio command.
|
||||
|
||||
## SQLite cache
|
||||
|
||||
`~/.cache/wodify/wodify.db` (override with `WODIFY_DB`), created mode 600 — it holds other
|
||||
|
||||
Reference in new issue
Block a user