wave-mcp
# wave-mcp
An MCP (Model Context Protocol) server that lets Claude, or any other MCP client, work in a **Wave Accounting** business: look up customers, invoices, products, taxes and accounts, and create or change them.
This is **Propel Digital Marketing's extended fork of [LunaParker/waveapps-mcp](https://github.com/LunaParker/waveapps-mcp)** (MIT). It is shared as-is, as a starting point. It has not been packaged or tested for anyone else's setup, and **it will not run until you make the edits listed in [What you must change](#what-you-must-change)**.
## What this fork adds
Compared with the upstream project:
- **Wave's official public API.** Most tools now use Wave's public GraphQL API with a Full Access Token from Wave's developer portal, instead of the browser session. Only customer contacts and recurring invoices still use the internal (signed-in session) API.
- **One business per server.** The server is pinned to one Wave business (`WAVE_BUSINESS_ID`) and refuses requests for any other.
- **Tool policy.** Only read tools are switched on by default. Write and destructive tools must be enabled on purpose in a policy file (see [Tool policy](#tool-policy)).
- **Confirmation for risky writes.** Approving, sending or marking an invoice sent, and recording, changing or deleting a payment, return a preview first and only run when the caller confirms that exact preview.
- **Write audit log.** Every write attempt is logged to stderr with the tool, the target and the caller's ID.
- **Named HTTP callers.** The HTTP transport can admit several callers, each with its own bearer token and ID, and keeps their sessions apart.
- **Hosted mode.** `WAVE_MCP_HOSTED=1` runs the server as a long-lived service. At startup it fetches the Wave token and an automation user's login from [Infisical](https://infisical.com), signs in with a headless browser, and checks that the login can see the pinned business.
- **Docker image** (`Dockerfile`) and an example `docker-compose.example.yml`.
## Tools
31 tools. `read` tools are on by default; the rest need the [tool policy](#tool-policy).
| Tier | Tools |
| --- | --- |
| read | `wave_get_business`, `wave_list_businesses`, `wave_list_customers`, `wave_get_customer`, `wave_list_invoices`, `wave_get_invoice`, `wave_list_products`, `wave_get_product`, `wave_list_sales_taxes`, `wave_list_accounts`, `wave_list_customer_contacts`*, `wave_list_recurring_invoices`, `wave_get_recurring_invoice` |
| write | `wave_create_customer`, `wave_update_customer`, `wave_create_product`, `wave_update_product`, `wave_archive_product`, `wave_create_invoice`, `wave_update_invoice`, `wave_clone_invoice`, `wave_approve_invoice`*, `wave_send_invoice`*, `wave_mark_invoice_sent`*, `wave_record_payment`*, `wave_update_payment`*, `wave_set_customer_contacts`* |
| destructive | `wave_delete_customer`, `wave_delete_invoice`, `wave_delete_payment`* |
\* Needs a confirmed preview before it runs.
The full list, with which API each tool uses, is in `src/tools/tool-catalog.ts`.
## What you must change
Nothing below is filled in. Work through this list before the first run.
| # | What | Where | Why |
| --- | --- | --- | --- |
| 1 | **Your Wave business ID** (a UUID) | `WAVE_BUSINESS_ID` environment variable | Required in every mode. The server will not start without a valid UUID. Find it in the Wave URL after sign-in: `next.waveapps.com/<business-uuid>/dashboard/`. |
| 2 | **Wave public-API Full Access Token** | `WAVE_PUBLIC_ACCESS_TOKEN` (local use), or an Infisical secret (hosted mode, see #6) | Most tools call Wave's public API. Create the token in Wave's developer portal while signed in as the business owner. Without it, public-API tools fail. |
| 3 | **A Wave sign-in** for the internal-API tools | Run `node dist/server.js login` once (local use), or Infisical login secrets (hosted mode, see #6) | Customer-contact and recurring-invoice tools use Wave's internal API, which needs a signed-in browser session. |
| 4 | **Which write tools to allow** | A JSON file named in `WAVE_MCP_TOOL_POLICY_FILE` | Only read tools work until you allow others. See [Tool policy](#tool-policy). |
| 5 | **HTTP caller tokens** (only for HTTP transport) | `WAVE_MCP_HTTP_CONSUMERS` or `WAVE_MCP_HTTP_TOKEN` | Generate your own long random tokens (for example `openssl rand -hex 32`). Never reuse a token between callers. |
| 6 | **Infisical settings** (only for hosted mode) | `INFISICAL_URL`, `INFISICAL_TOKEN` and the `WAVE_INFISICAL_*` variables | Hosted mode reads secrets from Infisical only. See [Hosted mode](#run-it-as-a-hosted-service-docker). If you don't use Infisical, don't use hosted mode; or replace `src/auth/infisical-startup.ts` with your own secret source. |
| 7 | **Docker compose values** (only for Docker) | `docker-compose.example.yml` → copy to `docker-compose.yml` | Replace every `<PLACEHOLDER>`: business UUID, Infisical IDs and paths, secrets env file path, host IP to publish on, and host folder for the browser profile. |
| 8 | **Repository links** (only if you re-publish) | `package.json` (`repository`, `bugs`, `homepage`), `SECURITY.md` | They point at this repo. Change them to yours. |
## Quick start (local, one person, stdio)
Needs Node.js 20.18 or newer and a Wave account.
```bash
git clone https://github.com/propel-marketing/wave-mcp.git
cd wave-mcp
npm install
npm run build
npx playwright install chromium # browser used for Wave sign-in
node dist/server.js login # sign in to Wave in the window that opens (needed for #3)
```
Then add it to your MCP client with your own values. Claude Desktop (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"wave": {
"command": "node",
"args": ["/absolute/path/to/wave-mcp/dist/server.js"],
"env": {
"WAVE_BUSINESS_ID": "<your-business-uuid>",
"WAVE_PUBLIC_ACCESS_TOKEN": "<your-wave-full-access-token>",
"WAVE_MCP_TOOL_POLICY_FILE": "/absolute/path/to/tool-policy.json"
}
}
}
}
```
Claude Code:
```bash
claude mcp add wave \
-e WAVE_BUSINESS_ID=<your-business-uuid> \
-e WAVE_PUBLIC_ACCESS_TOKEN=<your-wave-full-access-token> \
-- node /absolute/path/to/wave-mcp/dist/server.js
```
Keep the token out of any file you commit or share.
### Wave sign-in commands
These come from upstream and are unchanged: `login` (sign in in a browser window), `paste` (paste session cookies by hand), `save-password` (store your Wave password and TOTP secret in the OS credential store for automatic re-sign-in), `refresh`, `whoami` and `logout`. Run them as `node dist/server.js <command>`. Wave sessions last at most 18 hours. Storing the password and TOTP secret lets the server sign itself back in, but it means one machine alone can sign in as you. Read upstream's README for the full trade-offs.
## Tool policy
Without a policy file, only read tools work. To allow writes, create a JSON file and point `WAVE_MCP_TOOL_POLICY_FILE` at it:
```json
{
"allowedTiers": ["read", "write"],
"tools": {
"wave_create_customer": { "allow": true, "tier": "write" },
"wave_create_invoice": { "allow": true, "tier": "write" },
"wave_send_invoice": { "allow": true, "tier": "write" }
}
}
```
Rules:
- A tool runs only if it is allowed **and** its tier is in `allowedTiers`.
- `tier` must match the tool's tier in `src/tools/tool-catalog.ts`, and tool names must exist. Otherwise the server refuses to start.
- Add `"destructive"` to `allowedTiers` only if you really want deletes.
## HTTP transport
Set `WAVE_MCP_TRANSPORT=http`. It listens on `WAVE_MCP_BIND`:`WAVE_MCP_PORT` (default `127.0.0.1:8765`) at `/mcp`.
Use **one** of these to set who may call it:
- **Several named callers (recommended):**
```bash
WAVE_MCP_HTTP_CONSUMERS='[{"consumerId":"alice","token":"<long-random-token-1>"},{"consumerId":"reporting-bot","token":"<long-random-token-2>"}]'
```
IDs and tokens must all be different. Callers send `Authorization: Bearer <their token>`, and their ID appears in the write audit log.
- **One caller:** `WAVE_MCP_HTTP_TOKEN` (or `WAVE_MCP_HTTP_TOKEN_FILE`), plus optional `WAVE_MCP_HTTP_CONSUMER_ID`.
A token is required whenever the bind address isn't loopback. Don't expose the port on the public internet. Use a private network or VPN, or the `gateway/` folder (Google sign-in in front of the server; its setup is in upstream's README).
## Run it as a hosted service (Docker)
Hosted mode is how Propel runs it. It suits a server shared by several callers, and **requires Infisical**.
1. **Store four secrets in Infisical:**
- The Wave Full Access Token, at the project, environment and path you name in `WAVE_INFISICAL_PUBLIC_*`. Its secret name goes in `WAVE_INFISICAL_PUBLIC_KEY`.
- A dedicated Wave automation user's login, at the location named in `WAVE_INFISICAL_LOGIN_*`, under exactly these secret names: `LOGIN_IDENTIFIER` (email), `LOGIN_PASSWORD` and `LOGIN_TOTP_SECRET`. Secrets must be type "shared".
- The automation user must be a member of the business in `WAVE_BUSINESS_ID`.
2. **Create an Infisical machine identity** with read access to those paths only, and get its access token for `INFISICAL_TOKEN`. `INFISICAL_URL` must be an HTTPS origin only, such as `https://app.infisical.com`.
3. **Create a secrets env file on the host** (`chmod 600`, not in git) with `INFISICAL_TOKEN=...` and `WAVE_MCP_HTTP_CONSUMERS=[...]`.
4. **Copy `docker-compose.example.yml` to `docker-compose.yml`** and replace every `<PLACEHOLDER>`.
5. **Build and start:**
```bash
docker compose build
docker compose up -d
docker compose logs -f
```
At startup the server checks its configuration, reads the secrets, signs in once with the headless browser, and confirms the login can see the pinned business. Only then does it listen. If any step fails, it exits with a `STARTUP_*` error and a hint, and does not retry (`restart: "no"`). Check the hint before you restart: repeated failed sign-ins can make Wave ask for a CAPTCHA.
Hosted mode refuses `WAVE_MCP_HTTP_TOKEN_FILE`, `WAVE_PASSWORD_FILE` and `WAVE_TOTP_SECRET_FILE`, and must have no CLI command. A healthy server answers an unauthenticated request to `/mcp` with 401.
## Environment variables
| Variable | Used in | Meaning |
| --- | --- | --- |
| `WAVE_BUSINESS_ID` | all | **Required.** The one Wave business UUID this server works on. |
| `WAVE_PUBLIC_ACCESS_TOKEN` | local | Wave public-API Full Access Token. In hosted mode it comes from Infisical instead. |
| `WAVE_MCP_TOOL_POLICY_FILE` | all | Path to the tool policy JSON. Unset means read tools only. |
| `WAVE_MCP_TRANSPORT` | all | `stdio` (default) or `http`. |
| `WAVE_MCP_BIND` / `WAVE_MCP_PORT` | http | Listen address and port. Default `127.0.0.1` / `8765`. |
| `WAVE_MCP_HTTP_CONSUMERS` | http | JSON list of `{consumerId, token}`. Don't combine with the single-token variables. |
| `WAVE_MCP_HTTP_TOKEN` / `WAVE_MCP_HTTP_TOKEN_FILE` / `WAVE_MCP_HTTP_CONSUMER_ID` | http | Single-caller alternative. |
| `WAVE_MCP_HOSTED` | hosted | `1` turns on hosted mode. Needs `WAVE_MCP_TRANSPORT=http`. |
| `INFISICAL_URL`, `INFISICAL_TOKEN` | hosted | Infisical HTTPS origin and machine-identity access token. |
| `WAVE_INFISICAL_PUBLIC_PROJECT_ID` / `_ENVIRONMENT` / `_PATH` / `_KEY` | hosted | Where the Wave Full Access Token is stored. |
| `WAVE_INFISICAL_LOGIN_PROJECT_ID` / `_ENVIRONMENT` / `_PATH` | hosted | Where `LOGIN_IDENTIFIER`, `LOGIN_PASSWORD` and `LOGIN_TOTP_SECRET` are stored. |
| `WAVE_AUTH_TOKEN` / `WAVE_CSRF_TOKEN` | local | Use these session cookies instead of the stored sign-in. |
| `WAVE_EMAIL`, `WAVE_PASSWORD_FILE`, `WAVE_TOTP_SECRET_FILE` | local | Automatic re-sign-in without an OS credential store. |
| `WAVE_MCP_CONFIG_DIR` | all | Where the sign-in and browser profile are kept. Default `~/.config/waveapps-mcp`. |
| `WAVE_MCP_BROWSER_PATH` | all | Use this Chromium-based browser instead of Playwright's. |
| `WAVE_MCP_LOG_LEVEL` | all | `debug`, `info` (default), `warn` or `error`. Logs go to stderr. |
## Development
- `npm test` runs the test suite. It is fully mocked and never touches Wave.
- `npm run test:live` checks the tools still match Wave's APIs without signing in. `test:live:signed-in` and `test:live:writes` use a real account (see the scripts in `package.json`).
- `cd gateway && uv sync --locked && uv run pytest` tests the optional gateway.
- This copy has had no tests run on it since it was taken from Propel's working repository.
## Caveats
- Wave's internal API is undocumented and can change without notice. Tools that use it (contacts, recurring invoices, sign-in) can break.
- Everything acts on your real Wave books. Start with read-only, then allow write tools one at a time.
- This repository is provided as-is, with no support commitment.
## Licence
MIT, see [LICENSE](./LICENSE). The original work is © Luna Parker; Propel Digital Marketing's changes are under the same licence.
TDQS
Scored across 30 tools
Most tools map to a distinct resource/action pair, and descriptions clarify subtle boundaries like send vs. mark-sent. However, get_business and list_businesses effectively return the same configured business, and update_payment/delete_payment are present but fail-closed, creating misleading choices.
All tools use a consistent wave_ prefix followed by snake_case verb_noun naming, such as wave_create_invoice, wave_list_customers, and wave_delete_customer. Conventions remain stable across the entire 30-tool set.
The server exposes 30 tools, which is heavy for the apparent scope, especially since two payment tools are deferred and nonfunctional. The accounting domain is broad, but several read-only resources and lifecycle variants inflate the surface beyond a well-scoped set.
Core customer, product, invoice, and payment-recording workflows are covered, but recurring invoices are read-only with no create/update/delete, payment update/delete are explicitly deferred, and account/tax surfaces are read-only. These are notable gaps for a full accounting lifecycle.