@kadoa/mcp 0.6.2 → 0.6.4

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 (3) hide show
  1. package/README.md +83 -14
  2. package/dist/index.js +43520 -32146
  3. package/package.json +10 -6
package/README.md CHANGED
@@ -2,6 +2,73 @@
2
2
 
3
3
  Use [Kadoa](https://kadoa.com) from ChatGPT, Claude.ai, Claude Code, Cursor, and other MCP clients.
4
4
 
5
+ ## Authentication
6
+
7
+ Public API is the only OAuth authority. This server is an MCP resource server:
8
+ it publishes protected-resource metadata, verifies RS256 resource tokens against
9
+ Public API JWKS, enforces the exact issuer and resource audience, and exchanges
10
+ each resource token for a request-local Public API token using workload identity.
11
+ It does not mount authorization, registration, token, refresh, or revocation
12
+ routes and does not store credentials.
13
+
14
+ ```sh
15
+ MCP_AUTH_ISSUER=https://api.kadoa.com/v5/auth
16
+ MCP_AUTH_JWKS_URL=https://api.kadoa.com/v5/auth/.well-known/jwks.json
17
+ MCP_AUTH_AUDIENCE=https://mcp.kadoa.com/mcp
18
+ MCP_DOWNSTREAM_TOKEN_ENDPOINT=https://api.kadoa.com/v5/auth/mcp/downstream-token
19
+ MCP_DOWNSTREAM_WORKLOAD_AUDIENCE=https://api.kadoa.com/v5/auth/mcp/downstream-token
20
+ MCP_ALLOWED_ORIGIN_HOSTNAMES=mcp.kadoa.com,service.mcp.kadoa.com
21
+ MCP_LEGACY_TRANSPORT_ENABLED=true
22
+ ```
23
+
24
+ `MCP_LEGACY_TRANSPORT_ENABLED` controls protocol-version compatibility only.
25
+ When `true`, supported 2025 protocol requests use the same central verifier and
26
+ downstream exchange as modern requests. It never selects another authentication
27
+ implementation. Missing central configuration fails startup.
28
+
29
+ ### Interactive local central-mode proof
30
+
31
+ The normal `dev` entrypoint uses Google workload identity in central mode. For a
32
+ local Dashboard Assistant proof, use the test-only launcher. It imports the real
33
+ backend downstream-exchange owner and replaces only Google's identity-token
34
+ verification with a deterministic local identity. It refuses to start unless
35
+ `KADOA_ENVIRONMENT=local`, binds to `127.0.0.1:3002`, and is not included in the
36
+ published package build.
37
+
38
+ Start the backend services without the regular MCP child. The shared environment
39
+ pins the backend issuer, Assistant MCP URL, resource audience, and downstream
40
+ Public API audience to literal loopback addresses. If the backend root `.env`
41
+ defines `KADOA_MCP_TOKEN_ALLOWED_RESOURCES`, set it to
42
+ `http://127.0.0.1:3002/mcp` as well. Backend package processes load that file and
43
+ a conflicting value makes the Assistant exchange fail with `invalid_target`.
44
+ The backend `turbo.json` dev task must propagate every variable exported by
45
+ `local-central-env.sh`; the launcher checks this before it starts.
46
+
47
+ ```sh
48
+ cd /home/gabrielziegler/kadoa/kadoa-backend
49
+ direnv exec . bash -lc '
50
+ source /home/gabrielziegler/kadoa/kadoa-mcp/tests/integration/local-central-env.sh
51
+ ./start-kadoa.sh --quick --services=dashboard,api,shelly,events-gateway,operations
52
+ '
53
+ ```
54
+
55
+ In a second terminal, start the local central resource server with the backend's
56
+ local environment:
57
+
58
+ ```sh
59
+ direnv exec /home/gabrielziegler/kadoa/kadoa-backend bash -lc '
60
+ source /home/gabrielziegler/kadoa/kadoa-mcp/tests/integration/local-central-env.sh
61
+ cd /home/gabrielziegler/kadoa/kadoa-mcp
62
+ KADOA_BACKEND_ROOT=/home/gabrielziegler/kadoa/kadoa-backend bun run dev:central-local
63
+ '
64
+ ```
65
+
66
+ Open a new Dashboard Assistant session and request a workflow list. The proof
67
+ covers the central resource server, backend-owned token exchange, live team
68
+ membership checks, downstream Public API credentials, and real tool calls. It
69
+ does not cover Google workload identity, browser OAuth consent, or a deployed
70
+ network boundary. Google workload identity remains a beta check.
71
+
5
72
  ## Remote Server (no install needed)
6
73
 
7
74
  A hosted MCP server is available at `https://mcp.kadoa.com/mcp`. Connect from any MCP client — no local install needed. You sign in with your Kadoa account via OAuth.
@@ -77,8 +144,6 @@ Point your client to `https://mcp.kadoa.com/mcp` with OAuth authentication.
77
144
  | `get_workflow_history` | Get the workflow's configuration revision history (audit log) — who changed it, when, from which channel, and a `changedFields` summary per revision |
78
145
  | `list_activity` | List the team's Activity log (audit trail) across all workflows and resources: actor email, resource name, action, interface, timestamp, change summary; filter by time window, user, workflow, action, interface, resource type. Use `get_workflow_history` for one workflow's config diffs |
79
146
  | `list_workflow_runs` | List a workflow's execution run history (status, start/finish, record count, errors); filter by outcome and paginate |
80
- | `get_usage` | Current plan usage for the active team or its organization: workflow slot quota and usage, billable and active workflows, extracted rows, billing period and renewal date |
81
- | `get_usage_history` | Daily usage history (active workflows, billing-period cumulative, or daily activity) for up to 366 days |
82
147
  | `get_observability` | Team-wide workflow health for a window of days: uptime, failed runs, MTTR, records delivered, health counts, and a ranked list of down or degraded workflows (the Observability page data) |
83
148
  | `run_workflow` | Execute a workflow |
84
149
  | `fetch_data` | Get extracted data from a workflow |
@@ -98,7 +163,6 @@ For detailed customer guidance, see the [Kadoa documentation](https://docs.kadoa
98
163
  - **Run history:** `list_workflow_runs` filters by `status` (`success`, `failed`, or `in_progress`) and supports 1-based `page` and `limit` pagination.
99
164
  - **Notifications:** `create_realtime_monitor` requires at least one email, webhook, Slack, or WebSocket notification channel. Notifications are optional when creating a standard one-time or scheduled workflow with `create_workflow`.
100
165
  - **Template changes:** `update_template` changes template name and description only. To change template-controlled configuration, create an immutable version with `create_template_version`, then roll it out to linked workflows with `apply_template_version`.
101
- - **Usage:** `get_usage` reports slots and rows, not credits. `usedThisPeriod` resets at the renewal date; `usedActive` is the current slot count; `usedAllTime` never resets. Pass `scope: "organization"` to match the Usage page for organization members.
102
166
 
103
167
  ## Usage Examples
104
168
 
@@ -304,7 +368,7 @@ Use this when you want to validate a change end-to-end against real clients (Cla
304
368
  There are two ways to consume an RC:
305
369
 
306
370
  - **Local stdio**: `npx @kadoa/mcp@rc` — installs from the `rc` dist-tag on npm. Good for quick sanity checks where the bug doesn't depend on the hosted OAuth flow.
307
- - **Hosted `mcp-server-test`**: a separate k8s deployment alongside prod in the same GKE cluster. Required when you need to validate the OAuth callback, Redis token store, multi-tenant session behavior, etc.
371
+ - **Hosted `mcp-server-test`**: a separate k8s deployment alongside prod in the same GKE cluster. Use it to validate protected-resource discovery, OAuth callbacks owned by Public API, and multi-tenant behavior.
308
372
 
309
373
  #### Publish an RC to npm
310
374
 
@@ -383,13 +447,18 @@ The server starts in HTTP mode. You authenticate via OAuth the same way as with
383
447
 
384
448
  ### HTTP server environment variables
385
449
 
386
- Opaque OAuth bearer tokens are routed to the existing OAuth verifier. RS256 Kadoa access tokens (Public API tokens, including delegated Kadoa Assistant tokens) additionally require:
450
+ | Variable | Description |
451
+ |---|---|
452
+ | `MCP_AUTH_ISSUER` | Exact Public API OAuth issuer, such as `https://api.kadoa.com/v5/auth` |
453
+ | `MCP_AUTH_JWKS_URL` | JWKS URL for the issuer |
454
+ | `MCP_AUTH_AUDIENCE` | Exact MCP resource URL served by this deployment; its path must be `/mcp` |
455
+ | `MCP_DOWNSTREAM_TOKEN_ENDPOINT` | Public API workload-authenticated downstream exchange endpoint |
456
+ | `MCP_DOWNSTREAM_WORKLOAD_AUDIENCE` | Audience used when the MCP workload requests its Google ID token |
457
+ | `MCP_ALLOWED_ORIGIN_HOSTNAMES` | Comma-separated hostnames admitted when an HTTP Origin header is present; required outside loopback |
458
+ | `MCP_LEGACY_TRANSPORT_ENABLED` | `true` serves supported 2025 protocol versions through central auth; `false` rejects them |
387
459
 
388
- | Variable | Description | If unset |
389
- |---|---|---|
390
- | `MCP_AUTH_ISSUER` | Issuer of Public API RS256 access tokens, `https://api.kadoa.com/v5/auth` | RS256 bearers rejected |
391
- | `MCP_AUTH_JWKS_URL` | JWKS of that issuer, `https://api.kadoa.com/v5/auth/.well-known/jwks.json` | RS256 bearers rejected |
392
- | `MCP_AUTH_AUDIENCE` | This pod's exact resource URL, e.g. `https://beta.mcp.kadoa.com/mcp` — must match the pod actually serving the request; a value copied from another pod's config cross-accepts that pod's tokens | RS256 bearers rejected |
460
+ All authentication and downstream-exchange settings are required. Old opaque
461
+ MCP bearer credentials are rejected.
393
462
 
394
463
  ## Contributing
395
464
 
@@ -450,10 +519,10 @@ CLI and MCP both call **identical** SDK domain methods. A new feature added to t
450
519
  ### Where to find things in this repo
451
520
 
452
521
  - `src/tools.ts` — every MCP tool. Single file by design; search for the tool name.
453
- - `src/auth.ts` — OAuth flow, JWT verification, team selection.
454
- - `src/client.ts` — wires `@kadoa/node-sdk` per request, injects bearer token.
455
- - `src/http.ts` — Express server, transport adapter, session handling.
456
- - `src/redis-store.ts` — token store for the hosted server.
522
+ - `src/kadoa-access-token.ts` — verifies Public API resource tokens.
523
+ - `src/downstream-token.ts` — exchanges resource tokens for request-local Public API credentials.
524
+ - `src/client.ts` — wires `@kadoa/node-sdk` per request.
525
+ - `src/http.ts` — Express resource server and transport adapter.
457
526
  - `tests/unit/` — bun tests; run with `bun run test`.
458
527
 
459
528
  ## License