@kadoa/mcp 0.6.3 → 0.6.5-rc.1

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 +98 -11
  2. package/dist/index.js +28242 -32378
  3. package/package.json +9 -6
package/README.md CHANGED
@@ -2,6 +2,88 @@
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 a dedicated service secret.
11
+ It does not mount authorization, registration, token, refresh, or revocation
12
+ routes and does not store end-user credentials.
13
+
14
+ This runtime targets the separate `mcp-server-beta` deployment. Production MCP
15
+ at `https://mcp.kadoa.com/mcp` remains on legacy authentication until a separate
16
+ approved migration.
17
+
18
+ ```sh
19
+ MCP_AUTH_ISSUER=https://api.kadoa.com/v5/auth
20
+ MCP_AUTH_JWKS_URL=https://api.kadoa.com/v5/auth/.well-known/jwks.json
21
+ MCP_AUTH_AUDIENCE=https://beta.mcp.kadoa.com/mcp
22
+ MCP_DOWNSTREAM_TOKEN_ENDPOINT=https://api.kadoa.com/v5/auth/mcp/downstream-token
23
+ # Inject MCP_DOWNSTREAM_EXCHANGE_SECRET from a dedicated secret store.
24
+ MCP_ALLOWED_ORIGIN_HOSTNAMES=beta.mcp.kadoa.com
25
+ MCP_LEGACY_TRANSPORT_ENABLED=true
26
+ ```
27
+
28
+ `MCP_LEGACY_TRANSPORT_ENABLED` controls protocol-version compatibility only.
29
+ When `true`, supported 2025 protocol requests use the same central verifier and
30
+ downstream exchange as modern requests. It never selects another authentication
31
+ implementation. Missing central configuration fails startup.
32
+
33
+ The exchange secret must contain at least 32 characters without whitespace.
34
+ Generate at least 32 random bytes, encode as hex, and inject the same value into
35
+ Public API as `KADOA_MCP_DOWNSTREAM_EXCHANGE_SECRET`. Never reuse the worker or
36
+ legacy registry credentials. Secret rotation requires restarting both consumers.
37
+ The service secret does not replace the user token or its authorization checks.
38
+ No Google service account or metadata-server access is required.
39
+
40
+ ### Historical local central-mode fixture
41
+
42
+ This fixture depends on the earlier backend local-issuer configuration, which
43
+ is absent from the narrowed beta rollout candidate. The commands below are not
44
+ a validated proof for that candidate. Do not restore browser OAuth or local-issuer
45
+ support to run this rollout.
46
+
47
+ The normal `dev` entrypoint authenticates downstream exchange with
48
+ `MCP_DOWNSTREAM_EXCHANGE_SECRET`. The test-only launcher imports the backend
49
+ exchange owner and uses a local-only fixture secret. It requires
50
+ `KADOA_ENVIRONMENT=local`, binds to `127.0.0.1:3002`, and is not included in the
51
+ published package build.
52
+
53
+ Start the backend services without the regular MCP child. The shared environment
54
+ pins the backend issuer, Assistant MCP URL, resource audience, and downstream
55
+ Public API audience to literal loopback addresses. If the backend root `.env`
56
+ defines `KADOA_MCP_TOKEN_ALLOWED_RESOURCES`, set it to
57
+ `http://127.0.0.1:3002/mcp` as well. Backend package processes load that file and
58
+ a conflicting value makes the Assistant exchange fail with `invalid_target`.
59
+ The backend `turbo.json` dev task must propagate every variable exported by
60
+ `local-central-env.sh`; the launcher checks this before it starts.
61
+
62
+ ```sh
63
+ cd /home/gabrielziegler/kadoa/kadoa-backend
64
+ direnv exec . bash -lc '
65
+ source /home/gabrielziegler/kadoa/kadoa-mcp/tests/integration/local-central-env.sh
66
+ ./start-kadoa.sh --quick --services=dashboard,api,shelly,events-gateway,operations
67
+ '
68
+ ```
69
+
70
+ In a second terminal, start the local central resource server with the backend's
71
+ local environment:
72
+
73
+ ```sh
74
+ direnv exec /home/gabrielziegler/kadoa/kadoa-backend bash -lc '
75
+ source /home/gabrielziegler/kadoa/kadoa-mcp/tests/integration/local-central-env.sh
76
+ cd /home/gabrielziegler/kadoa/kadoa-mcp
77
+ KADOA_BACKEND_ROOT=/home/gabrielziegler/kadoa/kadoa-backend bun run dev:central-local
78
+ '
79
+ ```
80
+
81
+ Open a new Dashboard Assistant session and request a workflow list. The proof
82
+ covers the central resource server, backend-owned token exchange, live team
83
+ membership checks, downstream Public API credentials, and real tool calls. It
84
+ does not prove the current beta candidate, browser OAuth consent, or a deployed
85
+ network boundary.
86
+
5
87
  ## Remote Server (no install needed)
6
88
 
7
89
  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 +383,7 @@ Use this when you want to validate a change end-to-end against real clients (Cla
301
383
  There are two ways to consume an RC:
302
384
 
303
385
  - **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.
386
+ - **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
387
 
306
388
  #### Publish an RC to npm
307
389
 
@@ -380,13 +462,18 @@ The server starts in HTTP mode. You authenticate via OAuth the same way as with
380
462
 
381
463
  ### HTTP server environment variables
382
464
 
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:
465
+ | Variable | Description |
466
+ |---|---|
467
+ | `MCP_AUTH_ISSUER` | Exact Public API OAuth issuer, such as `https://api.kadoa.com/v5/auth` |
468
+ | `MCP_AUTH_JWKS_URL` | JWKS URL for the issuer |
469
+ | `MCP_AUTH_AUDIENCE` | Exact MCP resource URL served by this deployment; its path must be `/mcp` |
470
+ | `MCP_DOWNSTREAM_TOKEN_ENDPOINT` | Public API service-authenticated downstream exchange endpoint |
471
+ | `MCP_DOWNSTREAM_EXCHANGE_SECRET` | Dedicated service credential shared only with the downstream exchange |
472
+ | `MCP_ALLOWED_ORIGIN_HOSTNAMES` | Comma-separated hostnames admitted when an HTTP Origin header is present; required outside loopback |
473
+ | `MCP_LEGACY_TRANSPORT_ENABLED` | `true` serves supported 2025 protocol versions through central auth; `false` rejects them |
384
474
 
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 |
475
+ All authentication and downstream-exchange settings are required. Old opaque
476
+ MCP bearer credentials are rejected.
390
477
 
391
478
  ## Contributing
392
479
 
@@ -447,10 +534,10 @@ CLI and MCP both call **identical** SDK domain methods. A new feature added to t
447
534
  ### Where to find things in this repo
448
535
 
449
536
  - `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.
537
+ - `src/kadoa-access-token.ts` — verifies Public API resource tokens.
538
+ - `src/downstream-token.ts` — exchanges resource tokens for request-local Public API credentials.
539
+ - `src/client.ts` — wires `@kadoa/node-sdk` per request.
540
+ - `src/http.ts` — Express resource server and transport adapter.
454
541
  - `tests/unit/` — bun tests; run with `bun run test`.
455
542
 
456
543
  ## License