bookingkoala-api-mcp 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. bookingkoala_api_mcp-1.0.2/.github/workflows/ci.yml +42 -0
  2. bookingkoala_api_mcp-1.0.2/.github/workflows/publish.yml +27 -0
  3. bookingkoala_api_mcp-1.0.2/.gitignore +11 -0
  4. bookingkoala_api_mcp-1.0.2/AGENTS.md +73 -0
  5. bookingkoala_api_mcp-1.0.2/CLAUDE.md +1 -0
  6. bookingkoala_api_mcp-1.0.2/LICENSE +133 -0
  7. bookingkoala_api_mcp-1.0.2/PKG-INFO +461 -0
  8. bookingkoala_api_mcp-1.0.2/README.md +440 -0
  9. bookingkoala_api_mcp-1.0.2/assets/logo-white.svg +1 -0
  10. bookingkoala_api_mcp-1.0.2/assets/logo.svg +1 -0
  11. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/__init__.py +28 -0
  12. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/api.py +213 -0
  13. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/app.py +42 -0
  14. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/__init__.py +0 -0
  15. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/auth.py +26 -0
  16. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/client.py +183 -0
  17. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/__init__.py +0 -0
  18. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/_bookings.py +130 -0
  19. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/_people.py +64 -0
  20. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/assign_provider.py +57 -0
  21. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/cancel_booking.py +76 -0
  22. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/create_booking.py +61 -0
  23. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/create_customer.py +114 -0
  24. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/dashboard.py +164 -0
  25. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/get_booking.py +134 -0
  26. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/get_customer.py +138 -0
  27. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/get_provider.py +130 -0
  28. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_bookings.py +82 -0
  29. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_charges.py +125 -0
  30. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_customers.py +84 -0
  31. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_drafts.py +82 -0
  32. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_invoices.py +154 -0
  33. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/list_providers.py +120 -0
  34. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/reschedule_booking.py +88 -0
  35. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/resend_invoice.py +121 -0
  36. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/bookingkoala/tools/send_quote.py +189 -0
  37. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/cli.py +201 -0
  38. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/__init__.py +0 -0
  39. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/account_guard.py +33 -0
  40. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/context.py +192 -0
  41. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/errors.py +78 -0
  42. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/helpers.py +33 -0
  43. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/profile.py +28 -0
  44. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/core/tools.py +106 -0
  45. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/mcp_context.py +126 -0
  46. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/mcp_server.py +67 -0
  47. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/runner.py +106 -0
  48. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/scripting.py +80 -0
  49. bookingkoala_api_mcp-1.0.2/bookingkoala_api_mcp/session.py +285 -0
  50. bookingkoala_api_mcp-1.0.2/examples/add_customer.py +52 -0
  51. bookingkoala_api_mcp-1.0.2/examples/assign_provider.py +37 -0
  52. bookingkoala_api_mcp-1.0.2/examples/assign_unassigned.py +55 -0
  53. bookingkoala_api_mcp-1.0.2/examples/cancel_booking.py +45 -0
  54. bookingkoala_api_mcp-1.0.2/examples/export_customers.py +29 -0
  55. bookingkoala_api_mcp-1.0.2/examples/list_bookings.py +52 -0
  56. bookingkoala_api_mcp-1.0.2/examples/overdue_invoices.py +54 -0
  57. bookingkoala_api_mcp-1.0.2/examples/provider_pay_report.py +40 -0
  58. bookingkoala_api_mcp-1.0.2/examples/rebook_customer.py +50 -0
  59. bookingkoala_api_mcp-1.0.2/examples/reschedule_day.py +57 -0
  60. bookingkoala_api_mcp-1.0.2/examples/send_quote.py +32 -0
  61. bookingkoala_api_mcp-1.0.2/examples/store_dashboard.py +24 -0
  62. bookingkoala_api_mcp-1.0.2/glama.json +4 -0
  63. bookingkoala_api_mcp-1.0.2/mcp.json +13 -0
  64. bookingkoala_api_mcp-1.0.2/pyproject.toml +37 -0
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ smoke:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v6
14
+ with:
15
+ python-version: "3.12"
16
+ - name: Install
17
+ run: uv sync
18
+ - name: Compile
19
+ run: uv run python -m compileall -q bookingkoala_api_mcp
20
+ - name: MCP server starts and lists its tools
21
+ run: |
22
+ uv run python - <<'PY'
23
+ import json, subprocess, sys
24
+ proc = subprocess.Popen([".venv/bin/bookingkoala-mcp", "mcp"], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
25
+ stderr=subprocess.PIPE, text=True)
26
+ def ask(msg, want=None):
27
+ proc.stdin.write(json.dumps(msg) + "\n")
28
+ proc.stdin.flush()
29
+ while want is not None:
30
+ line = proc.stdout.readline()
31
+ if not line:
32
+ sys.exit("server exited: " + proc.stderr.read()[-2000:])
33
+ reply = json.loads(line)
34
+ if reply.get("id") == want:
35
+ return reply
36
+ ask({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "ci", "version": "1"}}}, 1)
37
+ ask({"jsonrpc": "2.0", "method": "notifications/initialized"})
38
+ tools = ask({"jsonrpc": "2.0", "id": 2, "method": "tools/list"}, 2)["result"]["tools"]
39
+ proc.terminate()
40
+ assert tools, "no tools"
41
+ print(len(tools), "tools")
42
+ PY
@@ -0,0 +1,27 @@
1
+ name: Publish to PyPI
2
+
3
+ # A tag v<version> (the same as `version` in pyproject.toml) builds the package and publishes it to PyPI
4
+ # through Trusted Publishing: no token, PyPI trusts this workflow in the `pypi` environment.
5
+
6
+ on:
7
+ push:
8
+ tags: ["v*"]
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v6
19
+ with:
20
+ python-version: "3.12"
21
+ - name: Tag matches the package version
22
+ run: |
23
+ version=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
24
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME, pyproject $version"; exit 1; }
25
+ - name: Build
26
+ run: uv build
27
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ .env
2
+ session.json
3
+ __pycache__/
4
+ *.pyc
5
+ .venv/
6
+ *.egg-info/
7
+ dist/
8
+ *.csv
9
+ *.json
10
+ !mcp.json
11
+ !glama.json
@@ -0,0 +1,73 @@
1
+ # AGENTS.md
2
+
3
+ You are an AI agent in a clone of this repo. It is a self-hosted BookingKoala API and MCP server: 17 tools that work in the user's own BookingKoala store admin, through the session of their own Google Chrome. Your usual job is one of three: set it up for the user, use its tools for them, or change its code. Human docs: `README.md`.
4
+
5
+ ## Before you start
6
+
7
+ - The license allows noncommercial use only (PolyForm Noncommercial 1.0.0, `LICENSE`). Running a BookingKoala store for a business is business use. If the user is setting this up for a company, a team or clients, say so and point to the hosted version at https://cotlet.dev/integrations/bookingkoala-api-mcp-server. Do not continue the setup for that use.
8
+ - Every tool acts as the user in their store. Tools with access `write` assign providers (BookingKoala tells the provider), email quotes and invoices to customers, add customers (BookingKoala emails them an invitation), and cancel or move bookings. Real people see the result.
9
+
10
+ ## Set it up for the user
11
+
12
+ Do the steps yourself. Ask the user only for what needs their hands in Chrome.
13
+
14
+ 1. Check Python: `python3 --version` must be 3.11 or newer.
15
+ 2. Install in the repo root:
16
+
17
+ ```bash
18
+ python3 -m venv .venv && .venv/bin/pip install -e .
19
+ .venv/bin/bookingkoala-mcp --version
20
+ ```
21
+
22
+ On Windows the path is `.venv\Scripts\bookingkoala-mcp`. With uv: `uv venv && uv pip install -e .`.
23
+ 3. Ask the user to do two things in Chrome. You cannot open `chrome://` pages for them.
24
+ - Open `chrome://inspect/#remote-debugging` and switch remote debugging on.
25
+ - Be signed in to their store admin at `https://<their store>.bookingkoala.com/admin`.
26
+ 4. Run `.venv/bin/bookingkoala-mcp connect`. Tell the user to click **Allow** when Chrome asks about the connection. Success prints `Signed in to BookingKoala as <name> (<email>), <store>`.
27
+ 5. Check: `.venv/bin/bookingkoala-mcp status`, then `.venv/bin/bookingkoala-mcp call dashboard`.
28
+ 6. Add the MCP server to the user's client. Use the absolute path of `.venv/bin/bookingkoala-mcp`:
29
+ - Claude Code: `claude mcp add bookingkoala -- <abs path>/.venv/bin/bookingkoala-mcp mcp`
30
+ - Claude Desktop, Cursor, Codex: the config blocks in `README.md`, section "MCP server".
31
+ - Add `--read-only` after `mcp` if the user only wants to read.
32
+ The client loads new MCP servers on its next start. Tell the user.
33
+
34
+ If step 4 fails:
35
+
36
+ | Message | What to do |
37
+ |---|---|
38
+ | `Chrome remote debugging is off` | Step 3 is not done, or Chrome is Beta, Canary or a custom profile: pass `--profile-dir "<profile folder>"`. |
39
+ | `Could not connect to Chrome` | The user did not click Allow, or Chrome is closed. Run `connect` again. |
40
+ | `This Chrome is not signed in to BookingKoala` | The user signs in to the store admin in that Chrome, then run `connect` again. |
41
+ | No Chrome on this machine (a server) | The user copies the `IRON_GATEWAY_CTX` cookie from Chrome DevTools (Application, Cookies, `https://<store>.bookingkoala.com`) and runs `bookingkoala-mcp connect --token` themselves. It asks for the store name, then the value. Never ask them to paste the value into the chat. |
42
+
43
+ ## Use the tools
44
+
45
+ - With the MCP server added, call its tools. Without it: `.venv/bin/bookingkoala-mcp call <tool> key=value ...`, or one JSON object as the argument.
46
+ - `.venv/bin/bookingkoala-mcp tools` lists every tool with access and route. `tools --json` adds the input schemas.
47
+ - Start with `dashboard` or `list_bookings`. Ids come from the list tools: `booking_id` from `list_bookings`, `customer_id` from `list_customers`, `provider_id` from `list_providers`, `draft_id` from `list_drafts`, `invoice_id` from `list_invoices`.
48
+ - Lists return `next_cursor`. Pass it back as `cursor` for the next page. Keep `limit` at 20 or less: a larger page can come back empty. A page can repeat the last item of the page before it, so drop repeats by id. `scripting.paginate` does both.
49
+ - Before a `write` tool, show the user what you will send and to whom, and get their OK. `notify` on `cancel_booking` and `reschedule_booking` emails the customer and providers: set it only when the user asks.
50
+ - For a script or a cron job, use `bookingkoala_api_mcp.scripting` (`call`, `paginate`, `write_rows`) and the scripts in `examples/` as models.
51
+ - For a REST API (n8n, other languages): `.venv/bin/bookingkoala-mcp serve`, routes under `http://127.0.0.1:8787/api/v1/bookingkoala`, docs at `/docs`.
52
+
53
+ Errors come as `<code>: <message>`. `auth_expired` means BookingKoala signed the session out: the user signs in again in Chrome and you run `connect`. `target_error` carries BookingKoala's own reason, such as a provider who is not available at that time. More codes: `README.md`, section "Errors".
54
+
55
+ ## Keep secrets out
56
+
57
+ - `~/.config/bookingkoala-api-mcp/session.json` and `BOOKINGKOALA_AUTH_TOKEN` give full access to the user's store admin. Never print, log, commit or copy their content.
58
+ - `serve` listens on 127.0.0.1. Never start it on another address without `BOOKINGKOALA_MCP_TOKEN`.
59
+
60
+ ## Change the code
61
+
62
+ | Path | What | Edit? |
63
+ |---|---|---|
64
+ | `bookingkoala_api_mcp/bookingkoala/` | the BookingKoala tools, one file per tool in `tools/`, request signing (bearer token, csrf, per-request header) in `client.py` | Yes for a local fix, but the next `git pull` brings our version of these files. Report the bug at https://github.com/cotletdev/bookingkoala-api-mcp-server/issues |
65
+ | `bookingkoala_api_mcp/app.py` | app name, domains, session cookie, account paths, REST prefix | Rarely |
66
+ | `bookingkoala_api_mcp/core/` | `@tool` declaration, errors, the HTTP client with the session (`context.py`), the account guard, the profile tools read | Yes |
67
+ | `bookingkoala_api_mcp/session.py` | reading cookies and the time zone from Chrome over CDP, the session file | Yes |
68
+ | `bookingkoala_api_mcp/runner.py`, `api.py`, `mcp_server.py`, `mcp_context.py`, `cli.py` | tool registry, REST API, MCP server, its prompts and resources, command line | Yes |
69
+ | `examples/` | scripts for common jobs | Yes |
70
+
71
+ A new tool is a new file in `bookingkoala_api_mcp/bookingkoala/tools/` with a `@tool(...)` declaration (name, access, input schema, `route`). The registry finds it, and the REST API, the MCP server and the CLI show it without other changes. Never add a tool that refunds, charges or changes the user's own BookingKoala plan.
72
+
73
+ There is no test suite. After a change, run `.venv/bin/bookingkoala-mcp tools` and one read tool against the user's store.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,133 @@
1
+ Required Notice: Copyright (c) 2026 Take Group sp. z o.o. (Cotlet, https://cotlet.dev)
2
+
3
+ # PolyForm Noncommercial License 1.0.0
4
+
5
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree
10
+ to them as both strict obligations and conditions to all
11
+ your licenses.
12
+
13
+ ## Copyright License
14
+
15
+ The licensor grants you a copyright license for the
16
+ software to do everything you might do with the software
17
+ that would otherwise infringe the licensor's copyright
18
+ in it for any permitted purpose. However, you may
19
+ only distribute the software according to [Distribution
20
+ License](#distribution-license) and make changes or new works
21
+ based on the software according to [Changes and New Works
22
+ License](#changes-and-new-works-license).
23
+
24
+ ## Distribution License
25
+
26
+ The licensor grants you an additional copyright license
27
+ to distribute copies of the software. Your license
28
+ to distribute covers distributing the software with
29
+ changes and new works permitted by [Changes and New Works
30
+ License](#changes-and-new-works-license).
31
+
32
+ ## Notices
33
+
34
+ You must ensure that anyone who gets a copy of any part of
35
+ the software from you also gets a copy of these terms or the
36
+ URL for them above, as well as copies of any plain-text lines
37
+ beginning with `Required Notice:` that the licensor provided
38
+ with the software. For example:
39
+
40
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
41
+
42
+ ## Changes and New Works License
43
+
44
+ The licensor grants you an additional copyright license to
45
+ make changes and new works based on the software for any
46
+ permitted purpose.
47
+
48
+ ## Patent License
49
+
50
+ The licensor grants you a patent license for the software that
51
+ covers patent claims the licensor can license, or becomes able
52
+ to license, that you would infringe by using the software.
53
+
54
+ ## Noncommercial Purposes
55
+
56
+ Any noncommercial purpose is a permitted purpose.
57
+
58
+ ## Personal Uses
59
+
60
+ Personal use for research, experiment, and testing for
61
+ the benefit of public knowledge, personal study, private
62
+ entertainment, hobby projects, amateur pursuits, or religious
63
+ observance, without any anticipated commercial application,
64
+ is use for a permitted purpose.
65
+
66
+ ## Noncommercial Organizations
67
+
68
+ Use by any charitable organization, educational institution,
69
+ public research organization, public safety or health
70
+ organization, environmental protection organization,
71
+ or government institution is use for a permitted purpose
72
+ regardless of the source of funding or obligations resulting
73
+ from the funding.
74
+
75
+ ## Fair Use
76
+
77
+ You may have "fair use" rights for the software under the
78
+ law. These terms do not limit them.
79
+
80
+ ## No Other Rights
81
+
82
+ These terms do not allow you to sublicense or transfer any of
83
+ your licenses to anyone else, or prevent the licensor from
84
+ granting licenses to anyone else. These terms do not imply
85
+ any other licenses.
86
+
87
+ ## Patent Defense
88
+
89
+ If you make any written claim that the software infringes or
90
+ contributes to infringement of any patent, your patent license
91
+ for the software granted under these terms ends immediately. If
92
+ your company makes such a claim, your patent license ends
93
+ immediately for work on behalf of your company.
94
+
95
+ ## Violations
96
+
97
+ The first time you are notified in writing that you have
98
+ violated any of these terms, or done anything with the software
99
+ not covered by your licenses, your licenses can nonetheless
100
+ continue if you come into full compliance with these terms,
101
+ and take practical steps to correct past violations, within
102
+ 32 days of receiving notice. Otherwise, all your licenses
103
+ end immediately.
104
+
105
+ ## No Liability
106
+
107
+ ***As far as the law allows, the software comes as is, without
108
+ any warranty or condition, and the licensor will not be liable
109
+ to you for any damages arising out of these terms or the use
110
+ or nature of the software, under any kind of legal claim.***
111
+
112
+ ## Definitions
113
+
114
+ The **licensor** is the individual or entity offering these
115
+ terms, and the **software** is the software the licensor makes
116
+ available under these terms.
117
+
118
+ **You** refers to the individual or entity agreeing to these
119
+ terms.
120
+
121
+ **Your company** is any legal entity, sole proprietorship,
122
+ or other kind of organization that you work for, plus all
123
+ organizations that have control over, are under the control of,
124
+ or are under common control with that organization. **Control**
125
+ means ownership of substantially all the assets of an entity,
126
+ or the power to direct its management and policies by vote,
127
+ contract, or otherwise. Control can be direct or indirect.
128
+
129
+ **Your licenses** are all the licenses granted to you for the
130
+ software under these terms.
131
+
132
+ **Use** means anything you do with the software requiring one
133
+ of your licenses.