@kadoa/mcp 0.6.3 → 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 -11
  2. package/dist/index.js +42261 -30718
  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.
@@ -301,7 +368,7 @@ Use this when you want to validate a change end-to-end against real clients (Cla
301
368
  There are two ways to consume an RC:
302
369
 
303
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.
304
- - **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.
305
372
 
306
373
  #### Publish an RC to npm
307
374
 
@@ -380,13 +447,18 @@ The server starts in HTTP mode. You authenticate via OAuth the same way as with
380
447
 
381
448
  ### HTTP server environment variables
382
449
 
383
- 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 |
384
459
 
385
- | Variable | Description | If unset |
386
- |---|---|---|
387
- | `MCP_AUTH_ISSUER` | Issuer of Public API RS256 access tokens, `https://api.kadoa.com/v5/auth` | RS256 bearers rejected |
388
- | `MCP_AUTH_JWKS_URL` | JWKS of that issuer, `https://api.kadoa.com/v5/auth/.well-known/jwks.json` | RS256 bearers rejected |
389
- | `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.
390
462
 
391
463
  ## Contributing
392
464
 
@@ -447,10 +519,10 @@ CLI and MCP both call **identical** SDK domain methods. A new feature added to t
447
519
  ### Where to find things in this repo
448
520
 
449
521
  - `src/tools.ts` — every MCP tool. Single file by design; search for the tool name.
450
- - `src/auth.ts` — OAuth flow, JWT verification, team selection.
451
- - `src/client.ts` — wires `@kadoa/node-sdk` per request, injects bearer token.
452
- - `src/http.ts` — Express server, transport adapter, session handling.
453
- - `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.
454
526
  - `tests/unit/` — bun tests; run with `bun run test`.
455
527
 
456
528
  ## License