@prysmid/mcp 0.3.4 → 0.5.0
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.
- package/dist/index.js +166 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -354,7 +354,80 @@ var deleteOidcApp = defineTool({
|
|
|
354
354
|
{ method: "DELETE" }
|
|
355
355
|
)
|
|
356
356
|
});
|
|
357
|
-
var
|
|
357
|
+
var APP_TYPE = z.enum(["web", "spa", "native"]);
|
|
358
|
+
var AUTH_METHOD = z.enum([
|
|
359
|
+
"client_secret_basic",
|
|
360
|
+
"client_secret_post",
|
|
361
|
+
"none",
|
|
362
|
+
"private_key_jwt"
|
|
363
|
+
]);
|
|
364
|
+
var GRANT_TYPE = z.enum([
|
|
365
|
+
"authorization_code",
|
|
366
|
+
"refresh_token",
|
|
367
|
+
"implicit",
|
|
368
|
+
"device_code",
|
|
369
|
+
"token_exchange"
|
|
370
|
+
]);
|
|
371
|
+
var getApp = defineTool({
|
|
372
|
+
name: "get_app",
|
|
373
|
+
description: "Fetch full detail for one OIDC app: redirect URIs, grant types, auth method, dev_mode, timestamps. Never returns the client_secret \u2014 use regenerate_app_secret to mint a new one.",
|
|
374
|
+
inputShape: {
|
|
375
|
+
workspace: z.string().min(1).describe("Workspace slug or UUID"),
|
|
376
|
+
app_id: z.string().min(1)
|
|
377
|
+
},
|
|
378
|
+
handler: async ({ workspace, app_id }, { client }) => client.request(
|
|
379
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`
|
|
380
|
+
)
|
|
381
|
+
});
|
|
382
|
+
var updateApp = defineTool({
|
|
383
|
+
name: "update_app",
|
|
384
|
+
description: "Patch mutable fields on an OIDC app: redirect URIs, post-logout URIs, grant types, auth method, dev_mode. All fields optional \u2014 only provided keys change. client_secret is NEVER accepted here; use regenerate_app_secret to rotate it.",
|
|
385
|
+
inputShape: {
|
|
386
|
+
workspace: z.string().min(1),
|
|
387
|
+
app_id: z.string().min(1),
|
|
388
|
+
redirect_uris: z.array(z.string().url()).optional(),
|
|
389
|
+
post_logout_redirect_uris: z.array(z.string().url()).optional(),
|
|
390
|
+
grant_types: z.array(GRANT_TYPE).optional(),
|
|
391
|
+
auth_method: AUTH_METHOD.optional(),
|
|
392
|
+
dev_mode: z.boolean().optional().describe(
|
|
393
|
+
"Skip redirect URI HTTPS check \u2014 only for local dev, NEVER prod."
|
|
394
|
+
)
|
|
395
|
+
},
|
|
396
|
+
handler: async ({ workspace, app_id, ...patch }, { client }) => client.request(
|
|
397
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`,
|
|
398
|
+
{ method: "PATCH", body: patch }
|
|
399
|
+
)
|
|
400
|
+
});
|
|
401
|
+
var regenerateAppSecret = defineTool({
|
|
402
|
+
name: "regenerate_app_secret",
|
|
403
|
+
description: "Destructive \u2014 invalidates the current secret immediately. Returns the new secret plaintext ONCE. Set confirm=true to proceed. Only valid for app_type=web (confidential clients); spa/native are public and have no secret (the API returns 422 in that case).",
|
|
404
|
+
inputShape: {
|
|
405
|
+
workspace: z.string().min(1),
|
|
406
|
+
app_id: z.string().min(1),
|
|
407
|
+
confirm: z.literal(true).describe(
|
|
408
|
+
"Must be true to acknowledge that the current secret will be invalidated immediately."
|
|
409
|
+
)
|
|
410
|
+
},
|
|
411
|
+
handler: async ({ workspace, app_id, confirm }, { client }) => {
|
|
412
|
+
if (confirm !== true) {
|
|
413
|
+
throw new Error(
|
|
414
|
+
"regenerate_app_secret refused: pass confirm=true to acknowledge that the current secret will be invalidated immediately and the new secret is surfaced only once."
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
return client.request(
|
|
418
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}/regenerate-secret`,
|
|
419
|
+
{ method: "POST" }
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
var tools = [
|
|
424
|
+
listApps,
|
|
425
|
+
createOidcApp,
|
|
426
|
+
deleteOidcApp,
|
|
427
|
+
getApp,
|
|
428
|
+
updateApp,
|
|
429
|
+
regenerateAppSecret
|
|
430
|
+
];
|
|
358
431
|
|
|
359
432
|
// src/tools/billing.ts
|
|
360
433
|
import { z as z2 } from "zod";
|
|
@@ -527,13 +600,21 @@ function countItems(resp) {
|
|
|
527
600
|
if (Array.isArray(resp.items)) return resp.items.length;
|
|
528
601
|
return 0;
|
|
529
602
|
}
|
|
603
|
+
function listOf(resp) {
|
|
604
|
+
if (Array.isArray(resp)) return resp;
|
|
605
|
+
if (Array.isArray(resp.items)) return resp.items;
|
|
606
|
+
return [];
|
|
607
|
+
}
|
|
530
608
|
var prysmidSetupCheck = defineTool({
|
|
531
609
|
name: "prysmid_setup_check",
|
|
532
|
-
description: "Run a readiness checklist on a workspace: state=active, \u22651 OIDC app, \u22651 IdP OR password+register enabled, branding has a primary_color set, login_policy reasonable. Returns pass/fail per item plus a summary verdict.",
|
|
610
|
+
description: "Run a readiness checklist on a workspace: state=active, \u22651 OIDC app, \u22651 IdP OR password+register enabled, branding has a primary_color set, login_policy reasonable, AND (by default) every external IdP probes successfully against its upstream provider. Returns pass/fail per item plus a summary verdict. Set `probe_idps=false` to skip the live probe (faster, but won't catch redirect_uri_mismatch or invalid client_secret until a real end-user hits the broken IdP).",
|
|
533
611
|
inputShape: {
|
|
534
|
-
workspace: z4.string().min(1)
|
|
612
|
+
workspace: z4.string().min(1),
|
|
613
|
+
probe_idps: z4.boolean().optional().describe(
|
|
614
|
+
"Run a live probe against each external IdP's upstream authorize endpoint. Default true. Set false to skip if the latency matters more than the safety (will not catch redirect_uri_mismatch or invalid_client until a real end-user signs in)."
|
|
615
|
+
)
|
|
535
616
|
},
|
|
536
|
-
handler: async ({ workspace }, { client }) => {
|
|
617
|
+
handler: async ({ workspace, probe_idps = true }, { client }) => {
|
|
537
618
|
const ws = await client.request(
|
|
538
619
|
`/v1/workspaces/${encodeURIComponent(workspace)}`
|
|
539
620
|
);
|
|
@@ -551,6 +632,7 @@ var prysmidSetupCheck = defineTool({
|
|
|
551
632
|
);
|
|
552
633
|
const appsCount = countItems(appsResp);
|
|
553
634
|
const idpsCount = countItems(idpsResp);
|
|
635
|
+
const idpItems = listOf(idpsResp);
|
|
554
636
|
const passwordsOpen = policy.allow_username_password === true && policy.allow_register === true;
|
|
555
637
|
const checks = [
|
|
556
638
|
{
|
|
@@ -578,6 +660,42 @@ var prysmidSetupCheck = defineTool({
|
|
|
578
660
|
details: policy.force_mfa ? "force_mfa=true" : idpsCount > 0 ? `${idpsCount} external IdP(s) \u2014 strength delegated upstream` : "MFA off and no external IdPs \u2014 passwords-only is weak"
|
|
579
661
|
}
|
|
580
662
|
];
|
|
663
|
+
if (probe_idps && idpItems.length > 0) {
|
|
664
|
+
const probeResults = [];
|
|
665
|
+
for (const idp of idpItems) {
|
|
666
|
+
try {
|
|
667
|
+
const probe = await client.request(
|
|
668
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp.id)}/probe`,
|
|
669
|
+
{ method: "POST" }
|
|
670
|
+
);
|
|
671
|
+
probeResults.push({ id: idp.id, result: probe });
|
|
672
|
+
} catch (err) {
|
|
673
|
+
probeResults.push({
|
|
674
|
+
id: idp.id,
|
|
675
|
+
result: { ok: false, provider_reachable: false },
|
|
676
|
+
error: err instanceof Error ? err.message : String(err)
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
const allOk = probeResults.every((r) => r.result.ok);
|
|
681
|
+
const summary = probeResults.map((r) => {
|
|
682
|
+
const code = r.result.error_code ? ` (${r.result.error_code})` : "";
|
|
683
|
+
return `${r.id}=${r.result.ok ? "ok" : "fail"}${code}`;
|
|
684
|
+
}).join(", ");
|
|
685
|
+
const firstFailure = probeResults.find((r) => !r.result.ok);
|
|
686
|
+
const details = firstFailure ? `${summary}. First failure: ${firstFailure.result.error_detail ?? firstFailure.error ?? "no detail"}` : summary;
|
|
687
|
+
checks.push({
|
|
688
|
+
ok: allOk,
|
|
689
|
+
name: "idps_functional",
|
|
690
|
+
details
|
|
691
|
+
});
|
|
692
|
+
} else if (idpItems.length > 0) {
|
|
693
|
+
checks.push({
|
|
694
|
+
ok: true,
|
|
695
|
+
name: "idps_functional",
|
|
696
|
+
details: "skipped (probe_idps=false); won't catch redirect_uri_mismatch or invalid_client until a real end-user signs in."
|
|
697
|
+
});
|
|
698
|
+
}
|
|
581
699
|
const verdict = checks.every((c) => c.ok) ? "ready" : "incomplete";
|
|
582
700
|
return { verdict, checks };
|
|
583
701
|
}
|
|
@@ -630,7 +748,50 @@ var deleteIdp = defineTool({
|
|
|
630
748
|
{ method: "DELETE" }
|
|
631
749
|
)
|
|
632
750
|
});
|
|
633
|
-
var
|
|
751
|
+
var getIdp = defineTool({
|
|
752
|
+
name: "get_idp",
|
|
753
|
+
description: "Fetch full detail for one identity provider: type, state, client_id, issuer/tenant (when applicable), scopes, secret_updated_at, created_at. Never returns the client_secret.",
|
|
754
|
+
inputShape: {
|
|
755
|
+
workspace: z5.string().min(1),
|
|
756
|
+
idp_id: z5.string().min(1)
|
|
757
|
+
},
|
|
758
|
+
handler: async ({ workspace, idp_id }, { client }) => client.request(
|
|
759
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`
|
|
760
|
+
)
|
|
761
|
+
});
|
|
762
|
+
var updateIdp = defineTool({
|
|
763
|
+
name: "update_idp",
|
|
764
|
+
description: "Patch mutable fields on an identity provider. All fields optional. Passing client_secret rotates the upstream-issued value (Google/GitHub/Microsoft/OIDC client secret stored in Prysmid). Passing client_id retargets to a different upstream client. issuer/tenant_id apply only when relevant to the IdP type.",
|
|
765
|
+
inputShape: {
|
|
766
|
+
workspace: z5.string().min(1),
|
|
767
|
+
idp_id: z5.string().min(1),
|
|
768
|
+
name: z5.string().min(1).optional(),
|
|
769
|
+
client_id: z5.string().min(1).optional(),
|
|
770
|
+
client_secret: z5.string().min(1).optional().describe(
|
|
771
|
+
"Rotate the upstream-issued client secret. Not the Prysmid app secret \u2014 that one is rotated via regenerate_app_secret."
|
|
772
|
+
),
|
|
773
|
+
scopes: z5.array(z5.string()).optional(),
|
|
774
|
+
issuer: z5.string().url().optional().describe("Only meaningful for type=oidc."),
|
|
775
|
+
tenant_id: z5.string().optional().describe("Only meaningful for type=microsoft (Entra tenant GUID).")
|
|
776
|
+
},
|
|
777
|
+
handler: async ({ workspace, idp_id, ...patch }, { client }) => client.request(
|
|
778
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,
|
|
779
|
+
{ method: "PATCH", body: patch }
|
|
780
|
+
)
|
|
781
|
+
});
|
|
782
|
+
var probeIdp = defineTool({
|
|
783
|
+
name: "probe_idp",
|
|
784
|
+
description: "Probe an external identity provider end-to-end against its upstream authorize endpoint. Catches redirect_uri_mismatch (URI not registered at Google Cloud / GitHub / etc.), invalid_client (client_id rotated or deleted upstream), and provider_unreachable failures BEFORE a real end-user hits them. Use after enable_google_login / add_idp, and any time you suspect the IdP is misconfigured. Today: Google + GitHub get full classification; Microsoft + OIDC generic return `skipped` for the deterministic dimensions (only reachability is verified).",
|
|
785
|
+
inputShape: {
|
|
786
|
+
workspace: z5.string().min(1),
|
|
787
|
+
idp_id: z5.string().min(1)
|
|
788
|
+
},
|
|
789
|
+
handler: async ({ workspace, idp_id }, { client }) => client.request(
|
|
790
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}/probe`,
|
|
791
|
+
{ method: "POST" }
|
|
792
|
+
)
|
|
793
|
+
});
|
|
794
|
+
var tools5 = [listIdps, addIdp, deleteIdp, getIdp, updateIdp, probeIdp];
|
|
634
795
|
|
|
635
796
|
// src/tools/login_policy.ts
|
|
636
797
|
import { z as z6 } from "zod";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/auth.ts","../src/client.ts","../src/config.ts","../src/logger.ts","../src/tokenStore.ts","../src/tools/registry.ts","../src/tools/apps.ts","../src/tools/billing.ts","../src/tools/branding.ts","../src/tools/curated.ts","../src/tools/idps.ts","../src/tools/login_policy.ts","../src/tools/users.ts","../src/tools/workspaces.ts","../src/tools/generated/apps.ts","../src/tools/generated/billing.ts","../src/tools/generated/branding.ts","../src/tools/generated/idps.ts","../src/tools/generated/login-policy.ts","../src/tools/generated/smtp.ts","../src/tools/generated/users.ts","../src/tools/generated/workspaces.ts","../src/tools/generated/index.ts"],"sourcesContent":["/**\n * Entrypoint — boots an MCP server over stdio with the full Prysmid tool set.\n *\n * Three layers of tools:\n * 1. handwritten — `src/tools/{apps,users,...}.ts`. Polished schemas,\n * curated descriptions, the canonical surface.\n * 2. curated — `src/tools/curated.ts`. Multi-step orchestrators (e.g.\n * `setup_prysmid_workspace`).\n * 3. generated — `src/tools/generated/*.ts`. Auto-emitted from the live\n * OpenAPI spec by `scripts/generate-tools.ts`. Covers everything else.\n *\n * Merge rule: handwritten and curated names always win. A generated tool\n * with the same `name` as one of them is dropped silently — the handwritten\n * version is the source of truth.\n *\n * MCP transport contract:\n * - JSON-RPC over stdin/stdout\n * - stdout is RESERVED for protocol bytes; logs go to stderr (see logger.ts)\n * - one process == one client; the agent spawns a fresh server per session\n */\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\n\nimport { deviceFlow } from \"./auth.js\";\nimport { PrysmidClient } from \"./client.js\";\nimport { loadConfig, type Config } from \"./config.js\";\nimport { makeLogger, type Logger } from \"./logger.js\";\nimport { clearToken, loadToken, saveToken } from \"./tokenStore.js\";\nimport { registerAll, type ToolDef } from \"./tools/registry.js\";\nimport { tools as appsTools } from \"./tools/apps.js\";\nimport { tools as billingTools } from \"./tools/billing.js\";\nimport { tools as brandingTools } from \"./tools/branding.js\";\nimport { tools as curatedTools } from \"./tools/curated.js\";\nimport { tools as idpsTools } from \"./tools/idps.js\";\nimport { tools as loginPolicyTools } from \"./tools/login_policy.js\";\nimport { tools as usersTools } from \"./tools/users.js\";\nimport { tools as workspaceTools } from \"./tools/workspaces.js\";\nimport { generatedTools } from \"./tools/generated/index.js\";\n\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\n\nconst SERVER_NAME = \"prysmid\";\n\nfunction readVersion(): string {\n try {\n const here = dirname(fileURLToPath(import.meta.url));\n const pkg = JSON.parse(\n readFileSync(resolve(here, \"..\", \"package.json\"), \"utf8\"),\n );\n return typeof pkg.version === \"string\" ? pkg.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\n/**\n * Map of generated tool names that are superseded by a hand-written tool\n * with a different name (because the hand-written name is more agent-\n * friendly than what FastAPI's operationId produced). Without this, the\n * agent would see two near-duplicates: e.g. `add_idp` (curated) AND\n * `create_idp` (generated) for the same endpoint.\n *\n * Keep the LHS in sync with what the generator emits — if you rename a\n * hand-written tool, update this table.\n */\nconst GENERATED_ALIASES: Readonly<Record<string, string>> = {\n // generated name → handwritten that already covers it\n create_idp: \"add_idp\",\n create_app: \"create_oidc_app\",\n delete_app: \"delete_oidc_app\",\n update_spending_cap: \"set_spending_cap\",\n billing_checkout: \"start_billing_checkout\",\n billing_portal: \"start_billing_portal\",\n billing_get_state: \"get_billing\",\n};\n\n/**\n * Compose the final tool array. Hand-written + curated tools take\n * precedence over generated tools sharing the same `name`, AND over any\n * generated tool listed in {@link GENERATED_ALIASES}. Exported so tests\n * can assert merge behavior without booting the MCP server.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function composeToolset(): ToolDef<any>[] {\n const handwrittenAndCurated = [\n ...workspaceTools,\n ...appsTools,\n ...idpsTools,\n ...loginPolicyTools,\n ...usersTools,\n ...brandingTools,\n ...billingTools,\n ...curatedTools,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ] as ToolDef<any>[];\n\n const handwrittenNames = new Set(handwrittenAndCurated.map((t) => t.name));\n const filteredGenerated = generatedTools.filter((t) => {\n if (handwrittenNames.has(t.name)) return false;\n const alias = GENERATED_ALIASES[t.name];\n if (alias && handwrittenNames.has(alias)) return false;\n return true;\n });\n\n return [...handwrittenAndCurated, ...filteredGenerated];\n}\n\n/**\n * Resolve the bearer token to use for API calls. Resolution order:\n * 1. PRYSMID_API_TOKEN env var (CI / static service tokens)\n * 2. Cached device-flow token at ~/.config/prysmid-mcp/token.json (or %APPDATA% on Windows)\n * 3. Run interactive device flow (browser + user code) and save to cache\n *\n * Returns the token plus the human-readable mode string for logs.\n */\nexport async function resolveAuth(\n cfg: Config,\n log: Logger,\n): Promise<{ token: string | null; mode: \"bearer\" | \"cached\" | \"deviceflow\" | \"none\" }> {\n if (cfg.apiToken) return { token: cfg.apiToken, mode: \"bearer\" };\n\n const cached = loadToken(cfg.apiBase);\n if (cached) return { token: cached.accessToken, mode: \"cached\" };\n\n if (!process.stderr.isTTY && !process.env.PRYSMID_FORCE_DEVICE_FLOW) {\n log.warn(\n \"no PRYSMID_API_TOKEN and no cached token; stderr is not a TTY so refusing to start interactive device flow. Set PRYSMID_API_TOKEN, run `npx -y @prysmid/mcp` once interactively to populate the cache, or set PRYSMID_FORCE_DEVICE_FLOW=1 to override.\",\n );\n return { token: null, mode: \"none\" };\n }\n\n let result;\n try {\n result = await deviceFlow({ apiBase: cfg.apiBase, log });\n } catch (err) {\n log.error(\"device flow login failed\", {\n error: err instanceof Error ? err.message : String(err),\n });\n clearToken();\n return { token: null, mode: \"none\" };\n }\n\n const expiresAt =\n Math.floor(Date.now() / 1000) + (result.expiresIn ?? 3600);\n saveToken({\n apiBase: cfg.apiBase,\n accessToken: result.accessToken,\n refreshToken: result.refreshToken,\n expiresAt,\n });\n return { token: result.accessToken, mode: \"deviceflow\" };\n}\n\nexport async function main(): Promise<void> {\n // `prysmid-mcp logout` — small subcommand that just clears the cache.\n if (process.argv[2] === \"logout\") {\n clearToken();\n process.stderr.write(\"prysmid-mcp: logged out (token cache cleared)\\n\");\n return;\n }\n\n const cfg = loadConfig();\n const log = makeLogger(cfg);\n const auth = await resolveAuth(cfg, log);\n const client = new PrysmidClient(cfg, log, auth.token);\n\n const server = new McpServer({\n name: SERVER_NAME,\n version: readVersion(),\n });\n\n const allTools = composeToolset();\n\n registerAll(server, { client, log }, allTools);\n\n log.info(`prysmid-mcp starting`, {\n apiBase: cfg.apiBase,\n tools: allTools.length,\n authMode: auth.mode,\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\n// This module is only ever invoked as the package bin (MCP servers run as a\n// process per session). Cross-platform `import.meta.url === file://<argv[1]>`\n// is fragile (Windows backslash vs forward slash; symlinked paths) so we\n// just always boot UNLESS we're in vitest (which imports this module to\n// poke at the exports without wanting to connect a stdio transport).\nif (!process.env.VITEST) {\n main().catch((err) => {\n process.stderr.write(`fatal: ${err instanceof Error ? err.stack : err}\\n`);\n process.exit(1);\n });\n}\n","/**\n * OAuth 2.0 Device Authorization Grant client (RFC 8628).\n *\n * Flow:\n * 1. POST /v1/auth/device/start — get device_code + user_code + verification_uri\n * 2. Print user_code + URL to STDERR (stdout is reserved for MCP protocol)\n * 3. Poll POST /v1/auth/device/poll every `interval` seconds until:\n * - status=complete → return tokens\n * - status=slow_down → bump interval +5s, keep polling\n * - status=expired → throw\n * - status=denied → throw\n *\n * The platform side proxies these to Zitadel (auth.prysmid.com); the client\n * only ever talks to api.prysmid.com.\n */\nimport type { Logger } from \"./logger.js\";\n\nexport interface DeviceFlowToken {\n accessToken: string;\n refreshToken?: string;\n expiresIn?: number;\n}\n\ninterface DeviceStartResponse {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete?: string | null;\n interval: number;\n expires_in: number;\n}\n\ninterface DevicePollResponse {\n status: \"pending\" | \"slow_down\" | \"complete\" | \"expired\" | \"denied\";\n access_token?: string | null;\n refresh_token?: string | null;\n expires_in?: number | null;\n error?: string | null;\n}\n\nexport interface DeviceFlowOptions {\n apiBase: string;\n log: Logger;\n /**\n * Sleep function — overridable so tests can run instantly. Defaults to\n * setTimeout-based promise.\n */\n sleep?: (ms: number) => Promise<void>;\n /**\n * Print sink for the user-facing prompt (browser URL + code). Defaults to\n * stderr. Tests override to capture.\n */\n prompt?: (lines: string[]) => void;\n /**\n * Override the global fetch — kept for tests; production passes nothing.\n */\n fetchImpl?: typeof fetch;\n}\n\nconst DEFAULT_SLEEP = (ms: number): Promise<void> =>\n new Promise((r) => setTimeout(r, ms));\n\nconst DEFAULT_PROMPT = (lines: string[]): void => {\n for (const line of lines) process.stderr.write(`${line}\\n`);\n};\n\nexport async function deviceFlow(\n opts: DeviceFlowOptions,\n): Promise<DeviceFlowToken> {\n const sleep = opts.sleep ?? DEFAULT_SLEEP;\n const prompt = opts.prompt ?? DEFAULT_PROMPT;\n const fetchImpl = opts.fetchImpl ?? fetch;\n const { apiBase, log } = opts;\n\n const start = await postJson<DeviceStartResponse>(\n fetchImpl,\n `${apiBase}/v1/auth/device/start`,\n {},\n );\n\n const verifyUrl = start.verification_uri_complete || start.verification_uri;\n prompt([\n \"\",\n \"─────────────────────────────────────────────────────────\",\n \" Prysmid MCP — Sign in to your account\",\n \"─────────────────────────────────────────────────────────\",\n \"\",\n \" 1. Open this URL in your browser:\",\n ` ${verifyUrl}`,\n \"\",\n \" 2. Confirm the code:\",\n ` ${start.user_code}`,\n \"\",\n ` Waiting for confirmation (expires in ${start.expires_in}s)…`,\n \"\",\n ]);\n\n let interval = Math.max(1, start.interval || 5);\n const deadline = Date.now() + start.expires_in * 1000;\n\n while (Date.now() < deadline) {\n await sleep(interval * 1000);\n\n let res: DevicePollResponse;\n try {\n res = await postJson<DevicePollResponse>(\n fetchImpl,\n `${apiBase}/v1/auth/device/poll`,\n { device_code: start.device_code },\n );\n } catch (e) {\n log.warn(\"device poll request failed, retrying\", {\n error: e instanceof Error ? e.message : String(e),\n });\n continue;\n }\n\n if (res.status === \"complete\") {\n if (!res.access_token) {\n throw new Error(\n \"Device flow returned status=complete but no access_token\",\n );\n }\n log.info(\"device flow login complete\", {\n expiresIn: res.expires_in ?? null,\n });\n return {\n accessToken: res.access_token,\n refreshToken: res.refresh_token ?? undefined,\n expiresIn: res.expires_in ?? undefined,\n };\n }\n if (res.status === \"slow_down\") {\n interval += 5;\n log.debug(\"device flow slow_down\", { newInterval: interval });\n continue;\n }\n if (res.status === \"pending\") continue;\n if (res.status === \"expired\") {\n throw new Error(\"Device code expired before authorization\");\n }\n if (res.status === \"denied\") {\n throw new Error(\"Authorization denied\");\n }\n log.warn(\"unknown device poll status\", { status: res.status });\n }\n\n throw new Error(\"Device code expired before authorization\");\n}\n\nasync function postJson<T>(\n fetchImpl: typeof fetch,\n url: string,\n body: unknown,\n): Promise<T> {\n const res = await fetchImpl(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n body: JSON.stringify(body),\n });\n const text = await res.text();\n if (!res.ok) {\n throw new Error(`POST ${url} failed: ${res.status} ${text}`);\n }\n try {\n return JSON.parse(text) as T;\n } catch {\n throw new Error(`POST ${url} returned non-JSON: ${text.slice(0, 200)}`);\n }\n}\n","/**\n * Prysmid API client — thin fetch wrapper that adds auth + maps errors.\n *\n * Auth model (MVP): static bearer via `PRYSMID_API_TOKEN`. Device-flow OAuth\n * lives in `auth.ts` and produces a token compatible with this client.\n */\nimport type { Config } from \"./config.js\";\nimport type { Logger } from \"./logger.js\";\n\nexport class PrysmidApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n public readonly body: string,\n public readonly code?: string,\n ) {\n super(message);\n this.name = \"PrysmidApiError\";\n }\n}\n\nexport interface RequestOptions {\n method?: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined>;\n}\n\nexport class PrysmidClient {\n constructor(\n private readonly cfg: Config,\n private readonly log: Logger,\n /**\n * Optional override. When set (e.g. resolved via device flow + token cache),\n * takes precedence over `cfg.apiToken`. Keeps the env-driven path for the\n * `PRYSMID_API_TOKEN=…` mode untouched.\n */\n private readonly tokenOverride: string | null = null,\n ) {}\n\n private get effectiveToken(): string | null {\n return this.tokenOverride ?? this.cfg.apiToken;\n }\n\n async request<T = unknown>(path: string, opts: RequestOptions = {}): Promise<T> {\n const token = this.effectiveToken;\n if (!token) {\n throw new PrysmidApiError(\n \"No Prysmid API token. Set PRYSMID_API_TOKEN or complete device-flow login.\",\n 401,\n \"\",\n \"auth.no_token\",\n );\n }\n\n const url = new URL(this.cfg.apiBase + path);\n if (opts.query) {\n for (const [k, v] of Object.entries(opts.query)) {\n if (v !== undefined) url.searchParams.set(k, String(v));\n }\n }\n\n const method = opts.method ?? \"GET\";\n const headers: Record<string, string> = {\n Authorization: `Bearer ${token}`,\n Accept: \"application/json\",\n };\n if (opts.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n this.log.debug(`HTTP ${method} ${url.pathname}`);\n const res = await fetch(url, {\n method,\n headers,\n body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,\n });\n\n const text = await res.text();\n if (!res.ok) {\n let code: string | undefined;\n try {\n const parsed = JSON.parse(text);\n code = typeof parsed?.error === \"string\" ? parsed.error : parsed?.code;\n } catch {\n // body wasn't JSON\n }\n throw new PrysmidApiError(\n `Prysmid API ${res.status} on ${method} ${path}`,\n res.status,\n text,\n code,\n );\n }\n\n if (text === \"\") return undefined as T;\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n }\n}\n","/**\n * Runtime configuration. Pulled from env at startup; immutable thereafter.\n *\n * The MCP runs as a long-lived stdio process — env reads happen once.\n */\n\nexport interface Config {\n apiBase: string;\n apiToken: string | null;\n logLevel: \"debug\" | \"info\" | \"warn\" | \"error\";\n}\n\nconst DEFAULT_API_BASE = \"https://api.prysmid.com\";\n\nexport function loadConfig(env: NodeJS.ProcessEnv = process.env): Config {\n const apiBase = (env.PRYSMID_API_BASE ?? DEFAULT_API_BASE).replace(/\\/+$/, \"\");\n const apiToken = env.PRYSMID_API_TOKEN?.trim() || null;\n const rawLevel = (env.PRYSMID_MCP_LOG_LEVEL ?? \"info\").toLowerCase();\n const logLevel: Config[\"logLevel\"] =\n rawLevel === \"debug\" || rawLevel === \"warn\" || rawLevel === \"error\"\n ? rawLevel\n : \"info\";\n return { apiBase, apiToken, logLevel };\n}\n","/**\n * stderr-only logger. MCP servers MUST NOT write to stdout — that channel\n * is reserved for the JSON-RPC protocol; any stray byte breaks the agent.\n */\nimport type { Config } from \"./config.js\";\n\nconst ORDER = { debug: 10, info: 20, warn: 30, error: 40 } as const;\n\nexport interface Logger {\n debug: (msg: string, extra?: unknown) => void;\n info: (msg: string, extra?: unknown) => void;\n warn: (msg: string, extra?: unknown) => void;\n error: (msg: string, extra?: unknown) => void;\n}\n\nexport function makeLogger(cfg: Pick<Config, \"logLevel\">): Logger {\n const threshold = ORDER[cfg.logLevel];\n\n function emit(level: keyof typeof ORDER, msg: string, extra?: unknown) {\n if (ORDER[level] < threshold) return;\n const ts = new Date().toISOString();\n const payload = extra === undefined ? \"\" : ` ${safeJSON(extra)}`;\n process.stderr.write(`${ts} ${level.toUpperCase()} ${msg}${payload}\\n`);\n }\n\n return {\n debug: (m, e) => emit(\"debug\", m, e),\n info: (m, e) => emit(\"info\", m, e),\n warn: (m, e) => emit(\"warn\", m, e),\n error: (m, e) => emit(\"error\", m, e),\n };\n}\n\nfunction safeJSON(x: unknown): string {\n try {\n return JSON.stringify(x);\n } catch {\n return String(x);\n }\n}\n","/**\n * On-disk cache for the device-flow access token.\n *\n * Path layout:\n * - Windows: %APPDATA%\\prysmid-mcp\\token.json\n * - Linux/macOS: $XDG_CONFIG_HOME/prysmid-mcp/token.json (default ~/.config/prysmid-mcp)\n * - Fallback: ~/.prysmid-mcp/token.json\n *\n * The cache is keyed by `apiBase` so switching between staging/prod is safe.\n * Token file is mode 0600 on Unix; Windows ignores the chmod.\n */\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir, platform } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport interface CachedToken {\n apiBase: string;\n accessToken: string;\n refreshToken?: string;\n /** Unix epoch seconds. */\n expiresAt: number;\n}\n\nconst APP_DIR = \"prysmid-mcp\";\nconst FILE_NAME = \"token.json\";\nconst EXPIRY_SKEW_SECONDS = 60;\n\nexport function getTokenPath(env: NodeJS.ProcessEnv = process.env): string {\n if (platform() === \"win32\") {\n const base = env.APPDATA;\n if (base) return join(base, APP_DIR, FILE_NAME);\n return join(homedir(), `.${APP_DIR}`, FILE_NAME);\n }\n const xdg = env.XDG_CONFIG_HOME;\n if (xdg) return join(xdg, APP_DIR, FILE_NAME);\n return join(homedir(), \".config\", APP_DIR, FILE_NAME);\n}\n\nexport function loadToken(\n apiBase: string,\n env: NodeJS.ProcessEnv = process.env,\n): CachedToken | null {\n const path = getTokenPath(env);\n if (!existsSync(path)) return null;\n let parsed: CachedToken;\n try {\n parsed = JSON.parse(readFileSync(path, \"utf8\")) as CachedToken;\n } catch {\n return null;\n }\n if (parsed.apiBase !== apiBase) return null;\n const nowSec = Math.floor(Date.now() / 1000);\n if (parsed.expiresAt - EXPIRY_SKEW_SECONDS <= nowSec) return null;\n if (typeof parsed.accessToken !== \"string\" || !parsed.accessToken) {\n return null;\n }\n return parsed;\n}\n\nexport function saveToken(\n token: CachedToken,\n env: NodeJS.ProcessEnv = process.env,\n): void {\n const path = getTokenPath(env);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, JSON.stringify(token, null, 2), \"utf8\");\n if (platform() !== \"win32\") {\n try {\n chmodSync(path, 0o600);\n } catch {\n // best-effort\n }\n }\n}\n\nexport function clearToken(env: NodeJS.ProcessEnv = process.env): void {\n const path = getTokenPath(env);\n if (existsSync(path)) {\n rmSync(path, { force: true });\n }\n}\n","/**\n * Tool registry — single place where every MCP tool lives. Each tool exports\n * its input schema (Zod) + handler; `registerAll` wires them into the SDK.\n *\n * Two flavors of tools coexist:\n * - generated: 1:1 with REST endpoints, produced by `scripts/generate-tools.ts`\n * (lives under `tools/generated/*` once the script runs)\n * - curated: high-level orchestrators a human/agent actually wants to call,\n * e.g. `setup_prysmid_workspace(company_name)` that combines several\n * endpoints. These live under `tools/curated/*`.\n *\n * Both share the same `Tool` shape so the registry is uniform.\n */\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\n\nimport { PrysmidApiError, type PrysmidClient } from \"../client.js\";\nimport type { Logger } from \"../logger.js\";\n\nexport interface ToolContext {\n client: PrysmidClient;\n log: Logger;\n}\n\nexport interface ToolDef<I extends z.ZodRawShape> {\n name: string;\n description: string;\n inputShape: I;\n /**\n * Handler returns plain JSON-able output. The SDK serializes it into\n * MCP `content` blocks; we wrap to text by default (most MCP UIs render it\n * better than structured content).\n */\n handler: (\n input: z.infer<z.ZodObject<I>>,\n ctx: ToolContext,\n ) => Promise<unknown>;\n}\n\nexport function defineTool<I extends z.ZodRawShape>(t: ToolDef<I>): ToolDef<I> {\n return t;\n}\n\n// `ToolDef<any>` here intentionally — the array is heterogeneous (each tool\n// has its own input shape) and the SDK's registerTool only cares about the\n// runtime Zod object, not compile-time type inference. Without `any` there's\n// no single ZodRawShape that satisfies every entry simultaneously.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function registerAll(\n server: McpServer,\n ctx: ToolContext,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n tools: ReadonlyArray<ToolDef<any>>,\n): void {\n for (const tool of tools) {\n server.registerTool(\n tool.name,\n {\n description: tool.description,\n inputSchema: tool.inputShape,\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async (input: any) => {\n try {\n const result = await tool.handler(input, ctx);\n return {\n content: [\n {\n type: \"text\" as const,\n text:\n typeof result === \"string\"\n ? result\n : JSON.stringify(result, null, 2),\n },\n ],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n // For API errors, surface the response body so callers see the\n // FastAPI validation detail instead of a bare status code.\n const detail =\n err instanceof PrysmidApiError && err.body ? `\\n${err.body}` : \"\";\n ctx.log.error(`tool ${tool.name} failed`, { message });\n return {\n isError: true,\n content: [\n { type: \"text\" as const, text: `error: ${message}${detail}` },\n ],\n };\n }\n },\n );\n }\n}\n","/**\n * OIDC application tools — list, create, delete on a workspace's apps.\n * Apps are the integration unit: each one represents one downstream service\n * (web app, mobile app, CLI) that authenticates via Prysmid.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listApps = defineTool({\n name: \"list_apps\",\n description: \"List all OIDC apps in a workspace.\",\n inputShape: {\n workspace: z.string().min(1).describe(\"Workspace slug or UUID\"),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/apps`),\n});\n\nexport const createOidcApp = defineTool({\n name: \"create_oidc_app\",\n description:\n \"Create an OIDC application in a workspace. Returns client_id (and client_secret only when app_type=web). app_type=web is a confidential server-rendered app; spa and native are public clients that use PKCE and have no secret.\",\n inputShape: {\n workspace: z.string().min(1),\n name: z.string().min(1).max(255),\n redirect_uris: z.array(z.string().url()).min(1),\n post_logout_redirect_uris: z.array(z.string().url()).optional(),\n app_type: z.enum([\"web\", \"spa\", \"native\"]).default(\"web\"),\n dev_mode: z\n .boolean()\n .default(false)\n .describe(\n \"Skip redirect URI HTTPS check — only for local dev, NEVER prod.\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteOidcApp = defineTool({\n name: \"delete_oidc_app\",\n description: \"Delete an OIDC app. Idempotent — 404 returns success.\",\n inputShape: {\n workspace: z.string().min(1),\n app_id: z.string().min(1),\n },\n handler: async ({ workspace, app_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nexport const tools = [listApps, createOidcApp, deleteOidcApp] as const;\n","/**\n * Billing tools — read state, manage spending cap, generate Stripe portal URL.\n * Checkout/upgrade flow returns a Stripe-hosted URL; the agent surfaces it to\n * the user for them to navigate (we don't process payment data here).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getBilling = defineTool({\n name: \"get_billing\",\n description:\n \"Get current billing state: plan, subscription status, current period, spending_cap_cents, signups_blocked.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing`,\n ),\n});\n\nexport const setSpendingCap = defineTool({\n name: \"set_spending_cap\",\n description:\n \"Cap monthly Pro overage spend (cents). Pass null to remove cap (unlimited). When projected overage exceeds cap, signups_blocked flips on.\",\n inputShape: {\n workspace: z.string().min(1),\n spending_cap_cents: z\n .number()\n .int()\n .min(0)\n .max(10_000_000)\n .nullable()\n .describe(\"Max overage cents per period; null = unlimited\"),\n },\n handler: async ({ workspace, spending_cap_cents }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/spending-cap`,\n { method: \"PATCH\", body: { spending_cap_cents } },\n ),\n});\n\nexport const startCheckout = defineTool({\n name: \"start_billing_checkout\",\n description:\n \"Create a Stripe Checkout session for upgrading. Returns the URL the user must visit. Plan must be `pro` (Free has no checkout; Enterprise is sales-only).\",\n inputShape: {\n workspace: z.string().min(1),\n plan: z.enum([\"pro\"]),\n },\n handler: async ({ workspace, plan }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/checkout`,\n { method: \"POST\", body: { plan } },\n ),\n});\n\nexport const startBillingPortal = defineTool({\n name: \"start_billing_portal\",\n description:\n \"Create a Stripe customer-portal session URL where the user manages payment methods, downloads invoices, cancels subscription.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/portal`,\n { method: \"POST\" },\n ),\n});\n\nexport const tools = [\n getBilling,\n setSpendingCap,\n startCheckout,\n startBillingPortal,\n] as const;\n","/**\n * Branding tools — colors, fonts, logo for the login page. Logo upload is\n * out of MCP scope (multipart binary uploads don't fit MCP tool semantics\n * cleanly); use the dashboard or API directly for that.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getBranding = defineTool({\n name: \"get_branding\",\n description:\n \"Return the workspace's active branding policy (colors, fonts, hide-prysmid-watermark flag, logo URLs).\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n ),\n});\n\nexport const updateBranding = defineTool({\n name: \"update_branding\",\n description:\n \"Update branding colors and watermark. Hex colors as `#RRGGBB`. Activates the policy after update — change shows on next login screen render.\",\n inputShape: {\n workspace: z.string().min(1),\n primary_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n background_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n warn_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n font_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n disable_watermark: z\n .boolean()\n .optional()\n .describe(\n \"Hide 'Powered by Prysmid' on the login screen (Pro+ only — Free silently ignored).\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n { method: \"PATCH\", body },\n ),\n});\n\nexport const tools = [getBranding, updateBranding] as const;\n","/**\n * Curated high-level tools — the ones agents would naturally reach for to\n * accomplish a goal in one call, instead of orchestrating 4 raw endpoints.\n *\n * Keep these small: each represents one end-user intent (\"set up a workspace\n * with Google login\"). Branch logic and prompts stay on the agent side; this\n * file only owns the API choreography.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nconst SetupWorkspaceOutput = z.object({\n workspace_id: z.string(),\n slug: z.string(),\n auth_domain: z.string(),\n state: z.string(),\n});\n\nexport const setupPrysmidWorkspace = defineTool({\n name: \"setup_prysmid_workspace\",\n description:\n \"Create a new workspace and wait until it's fully provisioned (Zitadel instance, SMTP, DNS). Returns the live auth_domain ready to integrate.\",\n inputShape: {\n slug: z\n .string()\n .min(2)\n .max(63)\n .regex(/^[a-z0-9-]+$/),\n display_name: z.string().min(1),\n timeout_seconds: z\n .number()\n .int()\n .min(10)\n .max(300)\n .default(120)\n .describe(\"Max time to wait for provisioning before returning.\"),\n },\n handler: async (\n { slug, display_name, timeout_seconds },\n { client, log },\n ) => {\n const created = (await client.request(\"/v1/workspaces\", {\n method: \"POST\",\n body: { slug, display_name },\n })) as { id: string; slug: string; state: string; auth_domain?: string };\n\n const deadline = Date.now() + timeout_seconds * 1000;\n while (Date.now() < deadline) {\n const ws = (await client.request(\n `/v1/workspaces/${encodeURIComponent(created.id)}`,\n )) as {\n id: string;\n slug: string;\n state: string;\n auth_domain?: string;\n provisioning_error?: string;\n };\n if (ws.state === \"active\") {\n return SetupWorkspaceOutput.parse({\n workspace_id: ws.id,\n slug: ws.slug,\n auth_domain: ws.auth_domain ?? `auth.${ws.slug}.prysmid.com`,\n state: ws.state,\n });\n }\n if (ws.state === \"provisioning_failed\") {\n throw new Error(\n `Workspace provisioning failed: ${ws.provisioning_error ?? \"unknown reason\"}`,\n );\n }\n log.debug(`workspace ${created.id} state=${ws.state}, polling…`);\n await sleep(3000);\n }\n throw new Error(\n `Workspace did not reach state=active within ${timeout_seconds}s`,\n );\n },\n});\n\nfunction sleep(ms: number) {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nexport const enableGoogleLogin = defineTool({\n name: \"enable_google_login\",\n description:\n \"Add Google as an identity provider on a workspace and enable external IdPs in the login policy. Hands you a checklist if external IdPs were already disabled — agent should confirm before flipping that flag.\",\n inputShape: {\n workspace: z.string().min(1),\n google_client_id: z.string().min(1),\n google_client_secret: z.string().min(1),\n name: z.string().default(\"Google\"),\n },\n handler: async (\n { workspace, google_client_id, google_client_secret, name },\n { client },\n ) => {\n // The IdP create body is the discriminated-union shape that\n // app/schemas/idp.py expects: `type` (not `provider`), and client_id /\n // client_secret are flat top-level fields (not nested under `config`).\n // Sending `provider` or nested config 422s the request before any handler\n // runs.\n const idp = await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n {\n method: \"POST\",\n body: {\n type: \"google\",\n name,\n client_id: google_client_id,\n client_secret: google_client_secret,\n },\n },\n );\n\n // Force-enable external IdP toggle in case the workspace had it off.\n await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n { method: \"PATCH\", body: { allow_external_idp: true } },\n );\n\n return { idp, login_policy: \"allow_external_idp=true\" };\n },\n});\n\ninterface SetupCheckItem {\n ok: boolean;\n name: string;\n details?: string;\n}\n\ntype ListResp = { items?: unknown[]; total?: number } | unknown[];\n\nfunction countItems(resp: ListResp): number {\n if (Array.isArray(resp)) return resp.length;\n if (typeof resp.total === \"number\") return resp.total;\n if (Array.isArray(resp.items)) return resp.items.length;\n return 0;\n}\n\nexport const prysmidSetupCheck = defineTool({\n name: \"prysmid_setup_check\",\n description:\n \"Run a readiness checklist on a workspace: state=active, ≥1 OIDC app, ≥1 IdP OR password+register enabled, branding has a primary_color set, login_policy reasonable. Returns pass/fail per item plus a summary verdict.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) => {\n const ws = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}`,\n )) as { state: string; auth_domain?: string };\n const appsResp = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps`,\n )) as ListResp;\n const idpsResp = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n )) as ListResp;\n const policy = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n )) as {\n allow_username_password?: boolean;\n allow_register?: boolean;\n allow_external_idp?: boolean;\n force_mfa?: boolean;\n };\n const branding = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n )) as { primary_color?: string };\n\n // The list endpoints return { items, total } — but tolerate a raw array\n // too so the check stays robust if the projection ever flips back.\n const appsCount = countItems(appsResp);\n const idpsCount = countItems(idpsResp);\n const passwordsOpen =\n policy.allow_username_password === true &&\n policy.allow_register === true;\n\n const checks: SetupCheckItem[] = [\n {\n ok: ws.state === \"active\",\n name: \"workspace_active\",\n details: `state=${ws.state}`,\n },\n {\n ok: appsCount > 0,\n name: \"has_at_least_one_app\",\n details: `${appsCount} apps`,\n },\n {\n ok: idpsCount > 0 || passwordsOpen,\n name: \"users_can_sign_in\",\n details:\n idpsCount > 0\n ? `${idpsCount} idps`\n : passwordsOpen\n ? \"no idps but username+password (with self-registration) allowed\"\n : \"no idps; enable allow_username_password+allow_register or add an IdP\",\n },\n {\n ok: !!branding.primary_color,\n name: \"branding_primary_color_set\",\n },\n {\n ok: policy.force_mfa === true || idpsCount > 0,\n name: \"auth_strength_reasonable\",\n details: policy.force_mfa\n ? \"force_mfa=true\"\n : idpsCount > 0\n ? `${idpsCount} external IdP(s) — strength delegated upstream`\n : \"MFA off and no external IdPs — passwords-only is weak\",\n },\n ];\n const verdict = checks.every((c) => c.ok) ? \"ready\" : \"incomplete\";\n return { verdict, checks };\n },\n});\n\nexport const tools = [\n setupPrysmidWorkspace,\n enableGoogleLogin,\n prysmidSetupCheck,\n] as const;\n","/**\n * Identity provider tools — Google, GitHub, Microsoft, generic OIDC.\n * Each create_* operation atomically: creates the IdP config AND adds it to\n * the login policy so it appears on the login screen. The Prysmid API\n * encapsulates that two-step lifecycle behind a single endpoint.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listIdps = defineTool({\n name: \"list_idps\",\n description:\n \"List identity providers (Google/GitHub/Microsoft/OIDC) configured on a workspace.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/idps`),\n});\n\nexport const addIdp = defineTool({\n name: \"add_idp\",\n description:\n \"Add an identity provider to the workspace and attach it to the login policy in one atomic call.\",\n inputShape: {\n workspace: z.string().min(1),\n type: z\n .enum([\"google\", \"github\", \"microsoft\", \"oidc\"])\n .describe(\"Identity provider kind. `microsoft` covers Azure AD / Entra.\"),\n name: z.string().min(1).describe(\"Display name shown on login screen\"),\n client_id: z.string().min(1),\n client_secret: z.string().min(1),\n scopes: z.array(z.string()).optional(),\n issuer: z\n .string()\n .url()\n .optional()\n .describe(\"Required for `oidc`; ignored otherwise\"),\n tenant_id: z\n .string()\n .optional()\n .describe(\n \"Optional for `microsoft` — lock to a specific Entra tenant GUID. Default accepts any account.\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteIdp = defineTool({\n name: \"delete_idp\",\n description:\n \"Remove an identity provider. Strips it from the login policy then deletes the config. Idempotent.\",\n inputShape: {\n workspace: z.string().min(1),\n idp_id: z.string().min(1),\n },\n handler: async ({ workspace, idp_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nexport const tools = [listIdps, addIdp, deleteIdp] as const;\n","/**\n * Login policy tools — control which authentication methods are allowed,\n * MFA enforcement, lockout thresholds. Patches are merge semantics on the\n * server side; only fields you set are changed.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getLoginPolicy = defineTool({\n name: \"get_login_policy\",\n description:\n \"Return the workspace's current login policy (password rules, MFA, IdPs allowed, lockout, etc.).\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n ),\n});\n\nexport const updateLoginPolicy = defineTool({\n name: \"update_login_policy\",\n description:\n \"Update the login policy. PATCH semantics — only fields you pass are changed; other policy fields stay as they were.\",\n inputShape: {\n workspace: z.string().min(1),\n allow_username_password: z.boolean().optional(),\n allow_register: z.boolean().optional(),\n allow_external_idp: z.boolean().optional(),\n force_mfa: z\n .boolean()\n .optional()\n .describe(\"Require any second factor at login\"),\n passwordless_type: z\n .enum([\n \"PASSWORDLESS_TYPE_NOT_ALLOWED\",\n \"PASSWORDLESS_TYPE_ALLOWED\",\n ])\n .optional()\n .describe(\"Enables passkey-first when set to ALLOWED\"),\n max_password_attempts: z.number().int().min(0).max(20).optional(),\n lockout_password_attempts: z.number().int().min(0).max(20).optional(),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n { method: \"PATCH\", body },\n ),\n});\n\nexport const tools = [getLoginPolicy, updateLoginPolicy] as const;\n","/**\n * User tools — list, invite (sends Zitadel init email), delete.\n * Invite is the primary creation path; users set their own password via the\n * email link. Direct user creation with pre-set credentials is intentionally\n * not exposed here.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listUsers = defineTool({\n name: \"list_users\",\n description: \"List human users in a workspace.\",\n inputShape: {\n workspace: z.string().min(1),\n limit: z.number().int().min(1).max(500).default(100),\n },\n handler: async ({ workspace, limit }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users`,\n { query: { limit } },\n ),\n});\n\nexport const inviteUser = defineTool({\n name: \"invite_user\",\n description:\n \"Invite a user by email. Idempotent by email — re-inviting an existing user is a no-op. Triggers a Zitadel init email with a 'set your password' link.\",\n inputShape: {\n workspace: z.string().min(1),\n email: z\n .string()\n .regex(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/, \"must be a valid email\"),\n first_name: z.string().min(1),\n last_name: z.string().min(1),\n preferred_language: z\n .string()\n .length(2)\n .default(\"en\")\n .describe(\"ISO 639-1, e.g. en/es/pt\"),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users/invite`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteUser = defineTool({\n name: \"delete_user\",\n description: \"Delete a user by id. Idempotent.\",\n inputShape: {\n workspace: z.string().min(1),\n user_id: z.string().min(1),\n },\n handler: async ({ workspace, user_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users/${encodeURIComponent(user_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nexport const tools = [listUsers, inviteUser, deleteUser] as const;\n","/**\n * Hand-written workspace tools. These are the ones agents reach for first;\n * the rest of the surface is auto-generated from OpenAPI in a later pass.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listWorkspaces = defineTool({\n name: \"list_workspaces\",\n description:\n \"List Prysmid workspaces accessible to the current API token. Returns an array of {id, slug, display_name, plan, state}.\",\n inputShape: {},\n handler: async (_input, { client }) =>\n client.request(\"/v1/workspaces\", { method: \"GET\" }),\n});\n\nexport const getWorkspace = defineTool({\n name: \"get_workspace\",\n description: \"Get a single workspace by slug or id.\",\n inputShape: {\n workspace: z\n .string()\n .min(1)\n .describe(\"Workspace slug or UUID\"),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}`),\n});\n\nexport const createWorkspace = defineTool({\n name: \"create_workspace\",\n description:\n \"Create a new Prysmid workspace. Provisioning runs in the background; the response returns immediately with state=provisioning. Poll `get_workspace` until state=active (~30s).\",\n inputShape: {\n slug: z\n .string()\n .min(2)\n .max(63)\n .regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric and hyphens only\")\n .describe(\"Subdomain-safe slug — becomes auth.<slug>.prysmid.com\"),\n display_name: z.string().min(1).max(255),\n },\n handler: async (input, { client }) =>\n client.request(\"/v1/workspaces\", { method: \"POST\", body: input }),\n});\n\nexport const tools = [listWorkspaces, getWorkspace, createWorkspace] as const;\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createApp = defineTool({\n name: \"create_app\",\n description: \"Create App\",\n inputShape: {\n workspace_id: z.string().uuid(),\n name: z.string().min(1).max(200),\n redirect_uris: z.array(z.string().url().min(1).max(2083)).describe(\"Where the IdP sends the user back after auth. At least one required.\"),\n post_logout_redirect_uris: z.array(z.string().url().min(1).max(2083)).describe(\"Where the IdP sends the user after logout.\").optional(),\n app_type: z.enum([\"web\", \"spa\", \"native\"]).describe(\"App kind, drives OIDC grant + auth_method defaults.\\n\\n- `web`: server-rendered confidential client. Gets a `client_secret`.\\n- `spa`: single-page app (user-agent). Public, PKCE required, no secret.\\n- `native`: desktop/mobile. Public, PKCE required, no secret.\").optional(),\n dev_mode: z.boolean().describe(\"Relax HTTPS requirement on redirect_uris (allows http://localhost). Use only for local development; never in production.\").default(false),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps`, { method: \"POST\", body: __body });\n },\n});\n\nexport const deleteApp = defineTool({\n name: \"delete_app\",\n description: \"Delete App\",\n inputShape: {\n workspace_id: z.string().uuid(),\n app_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, app_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps/${encodeURIComponent(String(app_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const listApps = defineTool({\n name: \"list_apps\",\n description: \"List Apps\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps`, { method: \"GET\" });\n },\n});\n\nexport const generatedAppsTools = [\n createApp,\n deleteApp,\n listApps,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const billingCheckout = defineTool({\n name: \"billing_checkout\",\n description: \"Checkout\",\n inputShape: {\n workspace_id: z.string().uuid(),\n plan: z.enum([\"free\", \"pro\", \"enterprise\"]),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/checkout`, { method: \"POST\", body: __body });\n },\n});\n\nexport const billingGetState = defineTool({\n name: \"billing_get_state\",\n description: \"Get State\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing`, { method: \"GET\" });\n },\n});\n\nexport const billingPortal = defineTool({\n name: \"billing_portal\",\n description: \"Portal\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/portal`, { method: \"POST\" });\n },\n});\n\nexport const updateSpendingCap = defineTool({\n name: \"update_spending_cap\",\n description: \"Update Spending Cap\",\n inputShape: {\n workspace_id: z.string().uuid(),\n cents: z.number().int().min(0).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/spending-cap`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedBillingTools = [\n billingCheckout,\n billingGetState,\n billingPortal,\n updateSpendingCap,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const deleteLogo = defineTool({\n name: \"delete_logo\",\n description: \"Delete Logo\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding/logo`, { method: \"DELETE\" });\n },\n});\n\nexport const getBranding = defineTool({\n name: \"get_branding\",\n description: \"Get Branding\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding`, { method: \"GET\" });\n },\n});\n\nexport const updateBranding = defineTool({\n name: \"update_branding\",\n description: \"Update Branding\",\n inputShape: {\n workspace_id: z.string().uuid(),\n primary_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n background_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n warn_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n font_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n primary_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n background_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n warn_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n font_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n hide_login_name_suffix: z.boolean().nullable().optional(),\n disable_watermark: z.boolean().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedBrandingTools = [\n deleteLogo,\n getBranding,\n updateBranding,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createIdp = defineTool({\n name: \"create_idp\",\n description: \"Create Idp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n type: z.enum([\"google\", \"github\", \"microsoft\", \"oidc\"]),\n name: z.string().min(1).max(200),\n client_id: z.string().min(1),\n client_secret: z.string().min(1),\n issuer: z.string().url().min(1).max(2083).nullable().optional(),\n tenant_id: z.string().nullable().optional(),\n scopes: z.array(z.string()).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps`, { method: \"POST\", body: __body });\n },\n});\n\nexport const deleteIdp = defineTool({\n name: \"delete_idp\",\n description: \"Delete Idp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n idp_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, idp_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps/${encodeURIComponent(String(idp_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const listIdps = defineTool({\n name: \"list_idps\",\n description: \"List Idps\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps`, { method: \"GET\" });\n },\n});\n\nexport const generatedIdpsTools = [\n createIdp,\n deleteIdp,\n listIdps,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const getLoginPolicy = defineTool({\n name: \"get_login_policy\",\n description: \"Get Login Policy\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/login-policy`, { method: \"GET\" });\n },\n});\n\nexport const updateLoginPolicy = defineTool({\n name: \"update_login_policy\",\n description: \"Update Login Policy\",\n inputShape: {\n workspace_id: z.string().uuid(),\n allow_username_password: z.boolean().nullable().optional(),\n allow_register: z.boolean().nullable().optional(),\n allow_external_idp: z.boolean().nullable().optional(),\n force_mfa: z.boolean().nullable().optional(),\n passwordless_allowed: z.boolean().nullable().optional(),\n second_factors: z.array(z.enum([\"otp\", \"u2f\", \"otp_email\", \"otp_sms\"])).nullable().optional(),\n multi_factors: z.array(z.enum([\"u2f_verified\"])).nullable().optional(),\n hide_password_reset: z.boolean().nullable().optional(),\n ignore_unknown_usernames: z.boolean().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/login-policy`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedLoginPolicyTools = [\n getLoginPolicy,\n updateLoginPolicy,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const getSmtp = defineTool({\n name: \"get_smtp\",\n description: \"Get Smtp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"GET\" });\n },\n});\n\nexport const revertToPlatformDefault = defineTool({\n name: \"revert_to_platform_default\",\n description: \"Revert To Platform Default\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"DELETE\" });\n },\n});\n\nexport const setCustomSmtp = defineTool({\n name: \"set_custom_smtp\",\n description: \"Set Custom Smtp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n tls: z.boolean().default(true),\n sender_address: z.string().min(3).describe(\"Address that appears in the From header.\"),\n sender_name: z.string().min(1).max(200),\n user: z.string().min(1).describe(\"SMTP auth username.\"),\n password: z.string().min(1).describe(\"SMTP auth password / API key.\"),\n reply_to_address: z.string().describe(\"Optional Reply-To header.\").default(\"\"),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"PUT\", body: __body });\n },\n});\n\nexport const generatedSmtpTools = [\n getSmtp,\n revertToPlatformDefault,\n setCustomSmtp,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const deleteUser = defineTool({\n name: \"delete_user\",\n description: \"Delete User\",\n inputShape: {\n workspace_id: z.string().uuid(),\n user_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, user_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users/${encodeURIComponent(String(user_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const inviteUser = defineTool({\n name: \"invite_user\",\n description: \"Invite User\",\n inputShape: {\n workspace_id: z.string().uuid(),\n email: z.string().max(320).regex(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/),\n first_name: z.string().min(1).max(100),\n last_name: z.string().min(1).max(100),\n user_name: z.string().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users/invite`, { method: \"POST\", body: __body });\n },\n});\n\nexport const listUsers = defineTool({\n name: \"list_users\",\n description: \"List Users\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users`, { method: \"GET\" });\n },\n});\n\nexport const generatedUsersTools = [\n deleteUser,\n inviteUser,\n listUsers,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createWorkspace = defineTool({\n name: \"create_workspace\",\n description: \"Create Workspace\",\n inputShape: {\n slug: z.string().min(3).max(63).regex(/^[a-z][a-z0-9-]*[a-z0-9]$/).describe(\"URL-safe lowercase slug. Becomes part of auth.<slug>.prysmid.com.\"),\n display_name: z.string().min(1).max(255),\n plan: z.enum([\"free\", \"pro\", \"enterprise\"]).optional(),\n },\n handler: async (input, { client }) => {\n return client.request(`/v1/workspaces`, { method: \"POST\", body: input });\n },\n});\n\nexport const deleteWorkspace = defineTool({\n name: \"delete_workspace\",\n description: \"Delete Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const getWorkspace = defineTool({\n name: \"get_workspace\",\n description: \"Get Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"GET\" });\n },\n});\n\nexport const listWorkspaces = defineTool({\n name: \"list_workspaces\",\n description: \"List Workspaces\",\n inputShape: {},\n handler: async (_input, { client }) => {\n return client.request(`/v1/workspaces`, { method: \"GET\" });\n },\n});\n\nexport const retryProvisioning = defineTool({\n name: \"retry_provisioning\",\n description: \"Retry Provisioning\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/retry-provisioning`, { method: \"POST\" });\n },\n});\n\nexport const updateWorkspace = defineTool({\n name: \"update_workspace\",\n description: \"Update Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n display_name: z.string().min(1).max(255).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedWorkspacesTools = [\n createWorkspace,\n deleteWorkspace,\n getWorkspace,\n listWorkspaces,\n retryProvisioning,\n updateWorkspace,\n];\n","/**\n * AUTO-GENERATED. Do not edit.\n *\n * Aggregates every tag's generated tools into a single array. The merge with\n * hand-written tools (where hand-written wins on name collision) lives in\n * src/index.ts.\n */\nimport { generatedAppsTools } from \"./apps.js\";\nimport { generatedBillingTools } from \"./billing.js\";\nimport { generatedBrandingTools } from \"./branding.js\";\nimport { generatedIdpsTools } from \"./idps.js\";\nimport { generatedLoginPolicyTools } from \"./login-policy.js\";\nimport { generatedSmtpTools } from \"./smtp.js\";\nimport { generatedUsersTools } from \"./users.js\";\nimport { generatedWorkspacesTools } from \"./workspaces.js\";\n\nexport const generatedTools = [\n ...generatedAppsTools,\n ...generatedBillingTools,\n ...generatedBrandingTools,\n ...generatedIdpsTools,\n ...generatedLoginPolicyTools,\n ...generatedSmtpTools,\n ...generatedUsersTools,\n ...generatedWorkspacesTools,\n];\n"],"mappings":";;;AAoBA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACsCrC,IAAM,gBAAgB,CAAC,OACrB,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAEtC,IAAM,iBAAiB,CAAC,UAA0B;AAChD,aAAW,QAAQ,MAAO,SAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAC5D;AAEA,eAAsB,WACpB,MAC0B;AAC1B,QAAMA,SAAQ,KAAK,SAAS;AAC5B,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,YAAY,KAAK,aAAa;AACpC,QAAM,EAAE,SAAS,IAAI,IAAI;AAEzB,QAAM,QAAQ,MAAM;AAAA,IAClB;AAAA,IACA,GAAG,OAAO;AAAA,IACV,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,MAAM,6BAA6B,MAAM;AAC3D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,SAAS;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU,MAAM,SAAS;AAAA,IACzB;AAAA,IACA,0CAA0C,MAAM,UAAU;AAAA,IAC1D;AAAA,EACF,CAAC;AAED,MAAI,WAAW,KAAK,IAAI,GAAG,MAAM,YAAY,CAAC;AAC9C,QAAM,WAAW,KAAK,IAAI,IAAI,MAAM,aAAa;AAEjD,SAAO,KAAK,IAA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ED,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAOA,IAAI,CAAC,QAAQ,IAAI,QAAQ;AACvB,OAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,YAAQ,OAAO,MAAM,UAAU,eAAe,QAAQ,IAAI,QAAQ,GAAG;AAAA,CAAI;AACzE,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["sleep","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","listApps","z","z","z","z","getBranding","updateBranding","z","z","deleteIdp","listIdps","z","getLoginPolicy","z","updateLoginPolicy","z","z","z","deleteUser","z","inviteUser","listUsers","z","createWorkspace","z","getWorkspace","listWorkspaces","readFileSync","dirname","tools"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/auth.ts","../src/client.ts","../src/config.ts","../src/logger.ts","../src/tokenStore.ts","../src/tools/registry.ts","../src/tools/apps.ts","../src/tools/billing.ts","../src/tools/branding.ts","../src/tools/curated.ts","../src/tools/idps.ts","../src/tools/login_policy.ts","../src/tools/users.ts","../src/tools/workspaces.ts","../src/tools/generated/apps.ts","../src/tools/generated/billing.ts","../src/tools/generated/branding.ts","../src/tools/generated/idps.ts","../src/tools/generated/login-policy.ts","../src/tools/generated/smtp.ts","../src/tools/generated/users.ts","../src/tools/generated/workspaces.ts","../src/tools/generated/index.ts"],"sourcesContent":["/**\n * Entrypoint — boots an MCP server over stdio with the full Prysmid tool set.\n *\n * Three layers of tools:\n * 1. handwritten — `src/tools/{apps,users,...}.ts`. Polished schemas,\n * curated descriptions, the canonical surface.\n * 2. curated — `src/tools/curated.ts`. Multi-step orchestrators (e.g.\n * `setup_prysmid_workspace`).\n * 3. generated — `src/tools/generated/*.ts`. Auto-emitted from the live\n * OpenAPI spec by `scripts/generate-tools.ts`. Covers everything else.\n *\n * Merge rule: handwritten and curated names always win. A generated tool\n * with the same `name` as one of them is dropped silently — the handwritten\n * version is the source of truth.\n *\n * MCP transport contract:\n * - JSON-RPC over stdin/stdout\n * - stdout is RESERVED for protocol bytes; logs go to stderr (see logger.ts)\n * - one process == one client; the agent spawns a fresh server per session\n */\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\n\nimport { deviceFlow } from \"./auth.js\";\nimport { PrysmidClient } from \"./client.js\";\nimport { loadConfig, type Config } from \"./config.js\";\nimport { makeLogger, type Logger } from \"./logger.js\";\nimport { clearToken, loadToken, saveToken } from \"./tokenStore.js\";\nimport { registerAll, type ToolDef } from \"./tools/registry.js\";\nimport { tools as appsTools } from \"./tools/apps.js\";\nimport { tools as billingTools } from \"./tools/billing.js\";\nimport { tools as brandingTools } from \"./tools/branding.js\";\nimport { tools as curatedTools } from \"./tools/curated.js\";\nimport { tools as idpsTools } from \"./tools/idps.js\";\nimport { tools as loginPolicyTools } from \"./tools/login_policy.js\";\nimport { tools as usersTools } from \"./tools/users.js\";\nimport { tools as workspaceTools } from \"./tools/workspaces.js\";\nimport { generatedTools } from \"./tools/generated/index.js\";\n\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\n\nconst SERVER_NAME = \"prysmid\";\n\nfunction readVersion(): string {\n try {\n const here = dirname(fileURLToPath(import.meta.url));\n const pkg = JSON.parse(\n readFileSync(resolve(here, \"..\", \"package.json\"), \"utf8\"),\n );\n return typeof pkg.version === \"string\" ? pkg.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\n/**\n * Map of generated tool names that are superseded by a hand-written tool\n * with a different name (because the hand-written name is more agent-\n * friendly than what FastAPI's operationId produced). Without this, the\n * agent would see two near-duplicates: e.g. `add_idp` (curated) AND\n * `create_idp` (generated) for the same endpoint.\n *\n * Keep the LHS in sync with what the generator emits — if you rename a\n * hand-written tool, update this table.\n */\nconst GENERATED_ALIASES: Readonly<Record<string, string>> = {\n // generated name → handwritten that already covers it\n create_idp: \"add_idp\",\n create_app: \"create_oidc_app\",\n delete_app: \"delete_oidc_app\",\n update_spending_cap: \"set_spending_cap\",\n billing_checkout: \"start_billing_checkout\",\n billing_portal: \"start_billing_portal\",\n billing_get_state: \"get_billing\",\n};\n\n/**\n * Compose the final tool array. Hand-written + curated tools take\n * precedence over generated tools sharing the same `name`, AND over any\n * generated tool listed in {@link GENERATED_ALIASES}. Exported so tests\n * can assert merge behavior without booting the MCP server.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function composeToolset(): ToolDef<any>[] {\n const handwrittenAndCurated = [\n ...workspaceTools,\n ...appsTools,\n ...idpsTools,\n ...loginPolicyTools,\n ...usersTools,\n ...brandingTools,\n ...billingTools,\n ...curatedTools,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ] as ToolDef<any>[];\n\n const handwrittenNames = new Set(handwrittenAndCurated.map((t) => t.name));\n const filteredGenerated = generatedTools.filter((t) => {\n if (handwrittenNames.has(t.name)) return false;\n const alias = GENERATED_ALIASES[t.name];\n if (alias && handwrittenNames.has(alias)) return false;\n return true;\n });\n\n return [...handwrittenAndCurated, ...filteredGenerated];\n}\n\n/**\n * Resolve the bearer token to use for API calls. Resolution order:\n * 1. PRYSMID_API_TOKEN env var (CI / static service tokens)\n * 2. Cached device-flow token at ~/.config/prysmid-mcp/token.json (or %APPDATA% on Windows)\n * 3. Run interactive device flow (browser + user code) and save to cache\n *\n * Returns the token plus the human-readable mode string for logs.\n */\nexport async function resolveAuth(\n cfg: Config,\n log: Logger,\n): Promise<{ token: string | null; mode: \"bearer\" | \"cached\" | \"deviceflow\" | \"none\" }> {\n if (cfg.apiToken) return { token: cfg.apiToken, mode: \"bearer\" };\n\n const cached = loadToken(cfg.apiBase);\n if (cached) return { token: cached.accessToken, mode: \"cached\" };\n\n if (!process.stderr.isTTY && !process.env.PRYSMID_FORCE_DEVICE_FLOW) {\n log.warn(\n \"no PRYSMID_API_TOKEN and no cached token; stderr is not a TTY so refusing to start interactive device flow. Set PRYSMID_API_TOKEN, run `npx -y @prysmid/mcp` once interactively to populate the cache, or set PRYSMID_FORCE_DEVICE_FLOW=1 to override.\",\n );\n return { token: null, mode: \"none\" };\n }\n\n let result;\n try {\n result = await deviceFlow({ apiBase: cfg.apiBase, log });\n } catch (err) {\n log.error(\"device flow login failed\", {\n error: err instanceof Error ? err.message : String(err),\n });\n clearToken();\n return { token: null, mode: \"none\" };\n }\n\n const expiresAt =\n Math.floor(Date.now() / 1000) + (result.expiresIn ?? 3600);\n saveToken({\n apiBase: cfg.apiBase,\n accessToken: result.accessToken,\n refreshToken: result.refreshToken,\n expiresAt,\n });\n return { token: result.accessToken, mode: \"deviceflow\" };\n}\n\nexport async function main(): Promise<void> {\n // `prysmid-mcp logout` — small subcommand that just clears the cache.\n if (process.argv[2] === \"logout\") {\n clearToken();\n process.stderr.write(\"prysmid-mcp: logged out (token cache cleared)\\n\");\n return;\n }\n\n const cfg = loadConfig();\n const log = makeLogger(cfg);\n const auth = await resolveAuth(cfg, log);\n const client = new PrysmidClient(cfg, log, auth.token);\n\n const server = new McpServer({\n name: SERVER_NAME,\n version: readVersion(),\n });\n\n const allTools = composeToolset();\n\n registerAll(server, { client, log }, allTools);\n\n log.info(`prysmid-mcp starting`, {\n apiBase: cfg.apiBase,\n tools: allTools.length,\n authMode: auth.mode,\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\n// This module is only ever invoked as the package bin (MCP servers run as a\n// process per session). Cross-platform `import.meta.url === file://<argv[1]>`\n// is fragile (Windows backslash vs forward slash; symlinked paths) so we\n// just always boot UNLESS we're in vitest (which imports this module to\n// poke at the exports without wanting to connect a stdio transport).\nif (!process.env.VITEST) {\n main().catch((err) => {\n process.stderr.write(`fatal: ${err instanceof Error ? err.stack : err}\\n`);\n process.exit(1);\n });\n}\n","/**\n * OAuth 2.0 Device Authorization Grant client (RFC 8628).\n *\n * Flow:\n * 1. POST /v1/auth/device/start — get device_code + user_code + verification_uri\n * 2. Print user_code + URL to STDERR (stdout is reserved for MCP protocol)\n * 3. Poll POST /v1/auth/device/poll every `interval` seconds until:\n * - status=complete → return tokens\n * - status=slow_down → bump interval +5s, keep polling\n * - status=expired → throw\n * - status=denied → throw\n *\n * The platform side proxies these to Zitadel (auth.prysmid.com); the client\n * only ever talks to api.prysmid.com.\n */\nimport type { Logger } from \"./logger.js\";\n\nexport interface DeviceFlowToken {\n accessToken: string;\n refreshToken?: string;\n expiresIn?: number;\n}\n\ninterface DeviceStartResponse {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete?: string | null;\n interval: number;\n expires_in: number;\n}\n\ninterface DevicePollResponse {\n status: \"pending\" | \"slow_down\" | \"complete\" | \"expired\" | \"denied\";\n access_token?: string | null;\n refresh_token?: string | null;\n expires_in?: number | null;\n error?: string | null;\n}\n\nexport interface DeviceFlowOptions {\n apiBase: string;\n log: Logger;\n /**\n * Sleep function — overridable so tests can run instantly. Defaults to\n * setTimeout-based promise.\n */\n sleep?: (ms: number) => Promise<void>;\n /**\n * Print sink for the user-facing prompt (browser URL + code). Defaults to\n * stderr. Tests override to capture.\n */\n prompt?: (lines: string[]) => void;\n /**\n * Override the global fetch — kept for tests; production passes nothing.\n */\n fetchImpl?: typeof fetch;\n}\n\nconst DEFAULT_SLEEP = (ms: number): Promise<void> =>\n new Promise((r) => setTimeout(r, ms));\n\nconst DEFAULT_PROMPT = (lines: string[]): void => {\n for (const line of lines) process.stderr.write(`${line}\\n`);\n};\n\nexport async function deviceFlow(\n opts: DeviceFlowOptions,\n): Promise<DeviceFlowToken> {\n const sleep = opts.sleep ?? DEFAULT_SLEEP;\n const prompt = opts.prompt ?? DEFAULT_PROMPT;\n const fetchImpl = opts.fetchImpl ?? fetch;\n const { apiBase, log } = opts;\n\n const start = await postJson<DeviceStartResponse>(\n fetchImpl,\n `${apiBase}/v1/auth/device/start`,\n {},\n );\n\n const verifyUrl = start.verification_uri_complete || start.verification_uri;\n prompt([\n \"\",\n \"─────────────────────────────────────────────────────────\",\n \" Prysmid MCP — Sign in to your account\",\n \"─────────────────────────────────────────────────────────\",\n \"\",\n \" 1. Open this URL in your browser:\",\n ` ${verifyUrl}`,\n \"\",\n \" 2. Confirm the code:\",\n ` ${start.user_code}`,\n \"\",\n ` Waiting for confirmation (expires in ${start.expires_in}s)…`,\n \"\",\n ]);\n\n let interval = Math.max(1, start.interval || 5);\n const deadline = Date.now() + start.expires_in * 1000;\n\n while (Date.now() < deadline) {\n await sleep(interval * 1000);\n\n let res: DevicePollResponse;\n try {\n res = await postJson<DevicePollResponse>(\n fetchImpl,\n `${apiBase}/v1/auth/device/poll`,\n { device_code: start.device_code },\n );\n } catch (e) {\n log.warn(\"device poll request failed, retrying\", {\n error: e instanceof Error ? e.message : String(e),\n });\n continue;\n }\n\n if (res.status === \"complete\") {\n if (!res.access_token) {\n throw new Error(\n \"Device flow returned status=complete but no access_token\",\n );\n }\n log.info(\"device flow login complete\", {\n expiresIn: res.expires_in ?? null,\n });\n return {\n accessToken: res.access_token,\n refreshToken: res.refresh_token ?? undefined,\n expiresIn: res.expires_in ?? undefined,\n };\n }\n if (res.status === \"slow_down\") {\n interval += 5;\n log.debug(\"device flow slow_down\", { newInterval: interval });\n continue;\n }\n if (res.status === \"pending\") continue;\n if (res.status === \"expired\") {\n throw new Error(\"Device code expired before authorization\");\n }\n if (res.status === \"denied\") {\n throw new Error(\"Authorization denied\");\n }\n log.warn(\"unknown device poll status\", { status: res.status });\n }\n\n throw new Error(\"Device code expired before authorization\");\n}\n\nasync function postJson<T>(\n fetchImpl: typeof fetch,\n url: string,\n body: unknown,\n): Promise<T> {\n const res = await fetchImpl(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n body: JSON.stringify(body),\n });\n const text = await res.text();\n if (!res.ok) {\n throw new Error(`POST ${url} failed: ${res.status} ${text}`);\n }\n try {\n return JSON.parse(text) as T;\n } catch {\n throw new Error(`POST ${url} returned non-JSON: ${text.slice(0, 200)}`);\n }\n}\n","/**\n * Prysmid API client — thin fetch wrapper that adds auth + maps errors.\n *\n * Auth model (MVP): static bearer via `PRYSMID_API_TOKEN`. Device-flow OAuth\n * lives in `auth.ts` and produces a token compatible with this client.\n */\nimport type { Config } from \"./config.js\";\nimport type { Logger } from \"./logger.js\";\n\nexport class PrysmidApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n public readonly body: string,\n public readonly code?: string,\n ) {\n super(message);\n this.name = \"PrysmidApiError\";\n }\n}\n\nexport interface RequestOptions {\n method?: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined>;\n}\n\nexport class PrysmidClient {\n constructor(\n private readonly cfg: Config,\n private readonly log: Logger,\n /**\n * Optional override. When set (e.g. resolved via device flow + token cache),\n * takes precedence over `cfg.apiToken`. Keeps the env-driven path for the\n * `PRYSMID_API_TOKEN=…` mode untouched.\n */\n private readonly tokenOverride: string | null = null,\n ) {}\n\n private get effectiveToken(): string | null {\n return this.tokenOverride ?? this.cfg.apiToken;\n }\n\n async request<T = unknown>(path: string, opts: RequestOptions = {}): Promise<T> {\n const token = this.effectiveToken;\n if (!token) {\n throw new PrysmidApiError(\n \"No Prysmid API token. Set PRYSMID_API_TOKEN or complete device-flow login.\",\n 401,\n \"\",\n \"auth.no_token\",\n );\n }\n\n const url = new URL(this.cfg.apiBase + path);\n if (opts.query) {\n for (const [k, v] of Object.entries(opts.query)) {\n if (v !== undefined) url.searchParams.set(k, String(v));\n }\n }\n\n const method = opts.method ?? \"GET\";\n const headers: Record<string, string> = {\n Authorization: `Bearer ${token}`,\n Accept: \"application/json\",\n };\n if (opts.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n this.log.debug(`HTTP ${method} ${url.pathname}`);\n const res = await fetch(url, {\n method,\n headers,\n body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,\n });\n\n const text = await res.text();\n if (!res.ok) {\n let code: string | undefined;\n try {\n const parsed = JSON.parse(text);\n code = typeof parsed?.error === \"string\" ? parsed.error : parsed?.code;\n } catch {\n // body wasn't JSON\n }\n throw new PrysmidApiError(\n `Prysmid API ${res.status} on ${method} ${path}`,\n res.status,\n text,\n code,\n );\n }\n\n if (text === \"\") return undefined as T;\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n }\n}\n","/**\n * Runtime configuration. Pulled from env at startup; immutable thereafter.\n *\n * The MCP runs as a long-lived stdio process — env reads happen once.\n */\n\nexport interface Config {\n apiBase: string;\n apiToken: string | null;\n logLevel: \"debug\" | \"info\" | \"warn\" | \"error\";\n}\n\nconst DEFAULT_API_BASE = \"https://api.prysmid.com\";\n\nexport function loadConfig(env: NodeJS.ProcessEnv = process.env): Config {\n const apiBase = (env.PRYSMID_API_BASE ?? DEFAULT_API_BASE).replace(/\\/+$/, \"\");\n const apiToken = env.PRYSMID_API_TOKEN?.trim() || null;\n const rawLevel = (env.PRYSMID_MCP_LOG_LEVEL ?? \"info\").toLowerCase();\n const logLevel: Config[\"logLevel\"] =\n rawLevel === \"debug\" || rawLevel === \"warn\" || rawLevel === \"error\"\n ? rawLevel\n : \"info\";\n return { apiBase, apiToken, logLevel };\n}\n","/**\n * stderr-only logger. MCP servers MUST NOT write to stdout — that channel\n * is reserved for the JSON-RPC protocol; any stray byte breaks the agent.\n */\nimport type { Config } from \"./config.js\";\n\nconst ORDER = { debug: 10, info: 20, warn: 30, error: 40 } as const;\n\nexport interface Logger {\n debug: (msg: string, extra?: unknown) => void;\n info: (msg: string, extra?: unknown) => void;\n warn: (msg: string, extra?: unknown) => void;\n error: (msg: string, extra?: unknown) => void;\n}\n\nexport function makeLogger(cfg: Pick<Config, \"logLevel\">): Logger {\n const threshold = ORDER[cfg.logLevel];\n\n function emit(level: keyof typeof ORDER, msg: string, extra?: unknown) {\n if (ORDER[level] < threshold) return;\n const ts = new Date().toISOString();\n const payload = extra === undefined ? \"\" : ` ${safeJSON(extra)}`;\n process.stderr.write(`${ts} ${level.toUpperCase()} ${msg}${payload}\\n`);\n }\n\n return {\n debug: (m, e) => emit(\"debug\", m, e),\n info: (m, e) => emit(\"info\", m, e),\n warn: (m, e) => emit(\"warn\", m, e),\n error: (m, e) => emit(\"error\", m, e),\n };\n}\n\nfunction safeJSON(x: unknown): string {\n try {\n return JSON.stringify(x);\n } catch {\n return String(x);\n }\n}\n","/**\n * On-disk cache for the device-flow access token.\n *\n * Path layout:\n * - Windows: %APPDATA%\\prysmid-mcp\\token.json\n * - Linux/macOS: $XDG_CONFIG_HOME/prysmid-mcp/token.json (default ~/.config/prysmid-mcp)\n * - Fallback: ~/.prysmid-mcp/token.json\n *\n * The cache is keyed by `apiBase` so switching between staging/prod is safe.\n * Token file is mode 0600 on Unix; Windows ignores the chmod.\n */\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir, platform } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport interface CachedToken {\n apiBase: string;\n accessToken: string;\n refreshToken?: string;\n /** Unix epoch seconds. */\n expiresAt: number;\n}\n\nconst APP_DIR = \"prysmid-mcp\";\nconst FILE_NAME = \"token.json\";\nconst EXPIRY_SKEW_SECONDS = 60;\n\nexport function getTokenPath(env: NodeJS.ProcessEnv = process.env): string {\n if (platform() === \"win32\") {\n const base = env.APPDATA;\n if (base) return join(base, APP_DIR, FILE_NAME);\n return join(homedir(), `.${APP_DIR}`, FILE_NAME);\n }\n const xdg = env.XDG_CONFIG_HOME;\n if (xdg) return join(xdg, APP_DIR, FILE_NAME);\n return join(homedir(), \".config\", APP_DIR, FILE_NAME);\n}\n\nexport function loadToken(\n apiBase: string,\n env: NodeJS.ProcessEnv = process.env,\n): CachedToken | null {\n const path = getTokenPath(env);\n if (!existsSync(path)) return null;\n let parsed: CachedToken;\n try {\n parsed = JSON.parse(readFileSync(path, \"utf8\")) as CachedToken;\n } catch {\n return null;\n }\n if (parsed.apiBase !== apiBase) return null;\n const nowSec = Math.floor(Date.now() / 1000);\n if (parsed.expiresAt - EXPIRY_SKEW_SECONDS <= nowSec) return null;\n if (typeof parsed.accessToken !== \"string\" || !parsed.accessToken) {\n return null;\n }\n return parsed;\n}\n\nexport function saveToken(\n token: CachedToken,\n env: NodeJS.ProcessEnv = process.env,\n): void {\n const path = getTokenPath(env);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, JSON.stringify(token, null, 2), \"utf8\");\n if (platform() !== \"win32\") {\n try {\n chmodSync(path, 0o600);\n } catch {\n // best-effort\n }\n }\n}\n\nexport function clearToken(env: NodeJS.ProcessEnv = process.env): void {\n const path = getTokenPath(env);\n if (existsSync(path)) {\n rmSync(path, { force: true });\n }\n}\n","/**\n * Tool registry — single place where every MCP tool lives. Each tool exports\n * its input schema (Zod) + handler; `registerAll` wires them into the SDK.\n *\n * Two flavors of tools coexist:\n * - generated: 1:1 with REST endpoints, produced by `scripts/generate-tools.ts`\n * (lives under `tools/generated/*` once the script runs)\n * - curated: high-level orchestrators a human/agent actually wants to call,\n * e.g. `setup_prysmid_workspace(company_name)` that combines several\n * endpoints. These live under `tools/curated/*`.\n *\n * Both share the same `Tool` shape so the registry is uniform.\n */\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\n\nimport { PrysmidApiError, type PrysmidClient } from \"../client.js\";\nimport type { Logger } from \"../logger.js\";\n\nexport interface ToolContext {\n client: PrysmidClient;\n log: Logger;\n}\n\nexport interface ToolDef<I extends z.ZodRawShape> {\n name: string;\n description: string;\n inputShape: I;\n /**\n * Handler returns plain JSON-able output. The SDK serializes it into\n * MCP `content` blocks; we wrap to text by default (most MCP UIs render it\n * better than structured content).\n */\n handler: (\n input: z.infer<z.ZodObject<I>>,\n ctx: ToolContext,\n ) => Promise<unknown>;\n}\n\nexport function defineTool<I extends z.ZodRawShape>(t: ToolDef<I>): ToolDef<I> {\n return t;\n}\n\n// `ToolDef<any>` here intentionally — the array is heterogeneous (each tool\n// has its own input shape) and the SDK's registerTool only cares about the\n// runtime Zod object, not compile-time type inference. Without `any` there's\n// no single ZodRawShape that satisfies every entry simultaneously.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function registerAll(\n server: McpServer,\n ctx: ToolContext,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n tools: ReadonlyArray<ToolDef<any>>,\n): void {\n for (const tool of tools) {\n server.registerTool(\n tool.name,\n {\n description: tool.description,\n inputSchema: tool.inputShape,\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async (input: any) => {\n try {\n const result = await tool.handler(input, ctx);\n return {\n content: [\n {\n type: \"text\" as const,\n text:\n typeof result === \"string\"\n ? result\n : JSON.stringify(result, null, 2),\n },\n ],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n // For API errors, surface the response body so callers see the\n // FastAPI validation detail instead of a bare status code.\n const detail =\n err instanceof PrysmidApiError && err.body ? `\\n${err.body}` : \"\";\n ctx.log.error(`tool ${tool.name} failed`, { message });\n return {\n isError: true,\n content: [\n { type: \"text\" as const, text: `error: ${message}${detail}` },\n ],\n };\n }\n },\n );\n }\n}\n","/**\n * OIDC application tools — list, create, delete on a workspace's apps.\n * Apps are the integration unit: each one represents one downstream service\n * (web app, mobile app, CLI) that authenticates via Prysmid.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listApps = defineTool({\n name: \"list_apps\",\n description: \"List all OIDC apps in a workspace.\",\n inputShape: {\n workspace: z.string().min(1).describe(\"Workspace slug or UUID\"),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/apps`),\n});\n\nexport const createOidcApp = defineTool({\n name: \"create_oidc_app\",\n description:\n \"Create an OIDC application in a workspace. Returns client_id (and client_secret only when app_type=web). app_type=web is a confidential server-rendered app; spa and native are public clients that use PKCE and have no secret.\",\n inputShape: {\n workspace: z.string().min(1),\n name: z.string().min(1).max(255),\n redirect_uris: z.array(z.string().url()).min(1),\n post_logout_redirect_uris: z.array(z.string().url()).optional(),\n app_type: z.enum([\"web\", \"spa\", \"native\"]).default(\"web\"),\n dev_mode: z\n .boolean()\n .default(false)\n .describe(\n \"Skip redirect URI HTTPS check — only for local dev, NEVER prod.\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteOidcApp = defineTool({\n name: \"delete_oidc_app\",\n description: \"Delete an OIDC app. Idempotent — 404 returns success.\",\n inputShape: {\n workspace: z.string().min(1),\n app_id: z.string().min(1),\n },\n handler: async ({ workspace, app_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nconst APP_TYPE = z.enum([\"web\", \"spa\", \"native\"]);\nconst AUTH_METHOD = z.enum([\n \"client_secret_basic\",\n \"client_secret_post\",\n \"none\",\n \"private_key_jwt\",\n]);\nconst GRANT_TYPE = z.enum([\n \"authorization_code\",\n \"refresh_token\",\n \"implicit\",\n \"device_code\",\n \"token_exchange\",\n]);\n\nexport const getApp = defineTool({\n name: \"get_app\",\n description:\n \"Fetch full detail for one OIDC app: redirect URIs, grant types, auth method, dev_mode, timestamps. Never returns the client_secret — use regenerate_app_secret to mint a new one.\",\n inputShape: {\n workspace: z.string().min(1).describe(\"Workspace slug or UUID\"),\n app_id: z.string().min(1),\n },\n handler: async ({ workspace, app_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`,\n ),\n});\n\nexport const updateApp = defineTool({\n name: \"update_app\",\n description:\n \"Patch mutable fields on an OIDC app: redirect URIs, post-logout URIs, grant types, auth method, dev_mode. All fields optional — only provided keys change. client_secret is NEVER accepted here; use regenerate_app_secret to rotate it.\",\n inputShape: {\n workspace: z.string().min(1),\n app_id: z.string().min(1),\n redirect_uris: z.array(z.string().url()).optional(),\n post_logout_redirect_uris: z.array(z.string().url()).optional(),\n grant_types: z.array(GRANT_TYPE).optional(),\n auth_method: AUTH_METHOD.optional(),\n dev_mode: z\n .boolean()\n .optional()\n .describe(\n \"Skip redirect URI HTTPS check — only for local dev, NEVER prod.\",\n ),\n },\n handler: async ({ workspace, app_id, ...patch }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}`,\n { method: \"PATCH\", body: patch },\n ),\n});\n\nexport const regenerateAppSecret = defineTool({\n name: \"regenerate_app_secret\",\n description:\n \"Destructive — invalidates the current secret immediately. Returns the new secret plaintext ONCE. Set confirm=true to proceed. Only valid for app_type=web (confidential clients); spa/native are public and have no secret (the API returns 422 in that case).\",\n inputShape: {\n workspace: z.string().min(1),\n app_id: z.string().min(1),\n confirm: z\n .literal(true)\n .describe(\n \"Must be true to acknowledge that the current secret will be invalidated immediately.\",\n ),\n },\n handler: async ({ workspace, app_id, confirm }, { client }) => {\n if (confirm !== true) {\n throw new Error(\n \"regenerate_app_secret refused: pass confirm=true to acknowledge that the current secret will be invalidated immediately and the new secret is surfaced only once.\",\n );\n }\n return client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps/${encodeURIComponent(app_id)}/regenerate-secret`,\n { method: \"POST\" },\n );\n },\n});\n\n// Exported for use in index.ts composeToolset (handwritten precedence).\n// Also re-exported as `appTypeEnum` etc. would be unnecessary; the tools list\n// is the only surface the registry needs.\nexport const tools = [\n listApps,\n createOidcApp,\n deleteOidcApp,\n getApp,\n updateApp,\n regenerateAppSecret,\n] as const;\n","/**\n * Billing tools — read state, manage spending cap, generate Stripe portal URL.\n * Checkout/upgrade flow returns a Stripe-hosted URL; the agent surfaces it to\n * the user for them to navigate (we don't process payment data here).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getBilling = defineTool({\n name: \"get_billing\",\n description:\n \"Get current billing state: plan, subscription status, current period, spending_cap_cents, signups_blocked.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing`,\n ),\n});\n\nexport const setSpendingCap = defineTool({\n name: \"set_spending_cap\",\n description:\n \"Cap monthly Pro overage spend (cents). Pass null to remove cap (unlimited). When projected overage exceeds cap, signups_blocked flips on.\",\n inputShape: {\n workspace: z.string().min(1),\n spending_cap_cents: z\n .number()\n .int()\n .min(0)\n .max(10_000_000)\n .nullable()\n .describe(\"Max overage cents per period; null = unlimited\"),\n },\n handler: async ({ workspace, spending_cap_cents }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/spending-cap`,\n { method: \"PATCH\", body: { spending_cap_cents } },\n ),\n});\n\nexport const startCheckout = defineTool({\n name: \"start_billing_checkout\",\n description:\n \"Create a Stripe Checkout session for upgrading. Returns the URL the user must visit. Plan must be `pro` (Free has no checkout; Enterprise is sales-only).\",\n inputShape: {\n workspace: z.string().min(1),\n plan: z.enum([\"pro\"]),\n },\n handler: async ({ workspace, plan }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/checkout`,\n { method: \"POST\", body: { plan } },\n ),\n});\n\nexport const startBillingPortal = defineTool({\n name: \"start_billing_portal\",\n description:\n \"Create a Stripe customer-portal session URL where the user manages payment methods, downloads invoices, cancels subscription.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/billing/portal`,\n { method: \"POST\" },\n ),\n});\n\nexport const tools = [\n getBilling,\n setSpendingCap,\n startCheckout,\n startBillingPortal,\n] as const;\n","/**\n * Branding tools — colors, fonts, logo for the login page. Logo upload is\n * out of MCP scope (multipart binary uploads don't fit MCP tool semantics\n * cleanly); use the dashboard or API directly for that.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getBranding = defineTool({\n name: \"get_branding\",\n description:\n \"Return the workspace's active branding policy (colors, fonts, hide-prysmid-watermark flag, logo URLs).\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n ),\n});\n\nexport const updateBranding = defineTool({\n name: \"update_branding\",\n description:\n \"Update branding colors and watermark. Hex colors as `#RRGGBB`. Activates the policy after update — change shows on next login screen render.\",\n inputShape: {\n workspace: z.string().min(1),\n primary_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n background_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n warn_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n font_color: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .optional(),\n disable_watermark: z\n .boolean()\n .optional()\n .describe(\n \"Hide 'Powered by Prysmid' on the login screen (Pro+ only — Free silently ignored).\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n { method: \"PATCH\", body },\n ),\n});\n\nexport const tools = [getBranding, updateBranding] as const;\n","/**\n * Curated high-level tools — the ones agents would naturally reach for to\n * accomplish a goal in one call, instead of orchestrating 4 raw endpoints.\n *\n * Keep these small: each represents one end-user intent (\"set up a workspace\n * with Google login\"). Branch logic and prompts stay on the agent side; this\n * file only owns the API choreography.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nconst SetupWorkspaceOutput = z.object({\n workspace_id: z.string(),\n slug: z.string(),\n auth_domain: z.string(),\n state: z.string(),\n});\n\nexport const setupPrysmidWorkspace = defineTool({\n name: \"setup_prysmid_workspace\",\n description:\n \"Create a new workspace and wait until it's fully provisioned (Zitadel instance, SMTP, DNS). Returns the live auth_domain ready to integrate.\",\n inputShape: {\n slug: z\n .string()\n .min(2)\n .max(63)\n .regex(/^[a-z0-9-]+$/),\n display_name: z.string().min(1),\n timeout_seconds: z\n .number()\n .int()\n .min(10)\n .max(300)\n .default(120)\n .describe(\"Max time to wait for provisioning before returning.\"),\n },\n handler: async (\n { slug, display_name, timeout_seconds },\n { client, log },\n ) => {\n const created = (await client.request(\"/v1/workspaces\", {\n method: \"POST\",\n body: { slug, display_name },\n })) as { id: string; slug: string; state: string; auth_domain?: string };\n\n const deadline = Date.now() + timeout_seconds * 1000;\n while (Date.now() < deadline) {\n const ws = (await client.request(\n `/v1/workspaces/${encodeURIComponent(created.id)}`,\n )) as {\n id: string;\n slug: string;\n state: string;\n auth_domain?: string;\n provisioning_error?: string;\n };\n if (ws.state === \"active\") {\n return SetupWorkspaceOutput.parse({\n workspace_id: ws.id,\n slug: ws.slug,\n auth_domain: ws.auth_domain ?? `auth.${ws.slug}.prysmid.com`,\n state: ws.state,\n });\n }\n if (ws.state === \"provisioning_failed\") {\n throw new Error(\n `Workspace provisioning failed: ${ws.provisioning_error ?? \"unknown reason\"}`,\n );\n }\n log.debug(`workspace ${created.id} state=${ws.state}, polling…`);\n await sleep(3000);\n }\n throw new Error(\n `Workspace did not reach state=active within ${timeout_seconds}s`,\n );\n },\n});\n\nfunction sleep(ms: number) {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nexport const enableGoogleLogin = defineTool({\n name: \"enable_google_login\",\n description:\n \"Add Google as an identity provider on a workspace and enable external IdPs in the login policy. Hands you a checklist if external IdPs were already disabled — agent should confirm before flipping that flag.\",\n inputShape: {\n workspace: z.string().min(1),\n google_client_id: z.string().min(1),\n google_client_secret: z.string().min(1),\n name: z.string().default(\"Google\"),\n },\n handler: async (\n { workspace, google_client_id, google_client_secret, name },\n { client },\n ) => {\n // The IdP create body is the discriminated-union shape that\n // app/schemas/idp.py expects: `type` (not `provider`), and client_id /\n // client_secret are flat top-level fields (not nested under `config`).\n // Sending `provider` or nested config 422s the request before any handler\n // runs.\n const idp = await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n {\n method: \"POST\",\n body: {\n type: \"google\",\n name,\n client_id: google_client_id,\n client_secret: google_client_secret,\n },\n },\n );\n\n // Force-enable external IdP toggle in case the workspace had it off.\n await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n { method: \"PATCH\", body: { allow_external_idp: true } },\n );\n\n return { idp, login_policy: \"allow_external_idp=true\" };\n },\n});\n\ninterface SetupCheckItem {\n ok: boolean;\n name: string;\n details?: string;\n}\n\ntype ListResp = { items?: unknown[]; total?: number } | unknown[];\n\nfunction countItems(resp: ListResp): number {\n if (Array.isArray(resp)) return resp.length;\n if (typeof resp.total === \"number\") return resp.total;\n if (Array.isArray(resp.items)) return resp.items.length;\n return 0;\n}\n\ntype IdpListItem = { id: string; name?: string; type?: string };\ntype IdpListResp = ListResp & { items?: IdpListItem[] };\ntype ProbeResp = {\n ok: boolean;\n provider_reachable: boolean;\n credentials_ok?: boolean | null;\n redirect_uri_ok?: boolean | null;\n error_code?: string | null;\n error_detail?: string | null;\n};\n\nfunction listOf(resp: ListResp): unknown[] {\n if (Array.isArray(resp)) return resp;\n if (Array.isArray(resp.items)) return resp.items;\n return [];\n}\n\nexport const prysmidSetupCheck = defineTool({\n name: \"prysmid_setup_check\",\n description:\n \"Run a readiness checklist on a workspace: state=active, ≥1 OIDC app, ≥1 IdP OR password+register enabled, branding has a primary_color set, login_policy reasonable, AND (by default) every external IdP probes successfully against its upstream provider. Returns pass/fail per item plus a summary verdict. Set `probe_idps=false` to skip the live probe (faster, but won't catch redirect_uri_mismatch or invalid client_secret until a real end-user hits the broken IdP).\",\n inputShape: {\n workspace: z.string().min(1),\n probe_idps: z\n .boolean()\n .optional()\n .describe(\n \"Run a live probe against each external IdP's upstream authorize endpoint. Default true. Set false to skip if the latency matters more than the safety (will not catch redirect_uri_mismatch or invalid_client until a real end-user signs in).\",\n ),\n },\n handler: async ({ workspace, probe_idps = true }, { client }) => {\n const ws = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}`,\n )) as { state: string; auth_domain?: string };\n const appsResp = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/apps`,\n )) as ListResp;\n const idpsResp = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n )) as IdpListResp;\n const policy = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n )) as {\n allow_username_password?: boolean;\n allow_register?: boolean;\n allow_external_idp?: boolean;\n force_mfa?: boolean;\n };\n const branding = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/branding`,\n )) as { primary_color?: string };\n\n // The list endpoints return { items, total } — but tolerate a raw array\n // too so the check stays robust if the projection ever flips back.\n const appsCount = countItems(appsResp);\n const idpsCount = countItems(idpsResp);\n const idpItems = listOf(idpsResp) as IdpListItem[];\n const passwordsOpen =\n policy.allow_username_password === true &&\n policy.allow_register === true;\n\n const checks: SetupCheckItem[] = [\n {\n ok: ws.state === \"active\",\n name: \"workspace_active\",\n details: `state=${ws.state}`,\n },\n {\n ok: appsCount > 0,\n name: \"has_at_least_one_app\",\n details: `${appsCount} apps`,\n },\n {\n ok: idpsCount > 0 || passwordsOpen,\n name: \"users_can_sign_in\",\n details:\n idpsCount > 0\n ? `${idpsCount} idps`\n : passwordsOpen\n ? \"no idps but username+password (with self-registration) allowed\"\n : \"no idps; enable allow_username_password+allow_register or add an IdP\",\n },\n {\n ok: !!branding.primary_color,\n name: \"branding_primary_color_set\",\n },\n {\n ok: policy.force_mfa === true || idpsCount > 0,\n name: \"auth_strength_reasonable\",\n details: policy.force_mfa\n ? \"force_mfa=true\"\n : idpsCount > 0\n ? `${idpsCount} external IdP(s) — strength delegated upstream`\n : \"MFA off and no external IdPs — passwords-only is weak\",\n },\n ];\n\n // Functional probe of each external IdP. Closes the gap where the\n // checklist reported `ready` because the IdP record existed, but the\n // OAuth flow was actually broken (redirect_uri_mismatch, invalid client_id)\n // — discoverable only via real-world login. Default-on so casual users\n // don't have to know to ask for it; opt-out via probe_idps=false for the\n // rare case where the probe latency matters more than the safety.\n if (probe_idps && idpItems.length > 0) {\n const probeResults: { id: string; result: ProbeResp; error?: string }[] = [];\n for (const idp of idpItems) {\n try {\n const probe = (await client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp.id)}/probe`,\n { method: \"POST\" },\n )) as ProbeResp;\n probeResults.push({ id: idp.id, result: probe });\n } catch (err) {\n probeResults.push({\n id: idp.id,\n result: { ok: false, provider_reachable: false },\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n const allOk = probeResults.every((r) => r.result.ok);\n const summary = probeResults\n .map((r) => {\n const code = r.result.error_code ? ` (${r.result.error_code})` : \"\";\n return `${r.id}=${r.result.ok ? \"ok\" : \"fail\"}${code}`;\n })\n .join(\", \");\n const firstFailure = probeResults.find((r) => !r.result.ok);\n const details = firstFailure\n ? `${summary}. First failure: ${firstFailure.result.error_detail ?? firstFailure.error ?? \"no detail\"}`\n : summary;\n checks.push({\n ok: allOk,\n name: \"idps_functional\",\n details,\n });\n } else if (idpItems.length > 0) {\n checks.push({\n ok: true,\n name: \"idps_functional\",\n details: \"skipped (probe_idps=false); won't catch redirect_uri_mismatch or invalid_client until a real end-user signs in.\",\n });\n }\n\n const verdict = checks.every((c) => c.ok) ? \"ready\" : \"incomplete\";\n return { verdict, checks };\n },\n});\n\nexport const tools = [\n setupPrysmidWorkspace,\n enableGoogleLogin,\n prysmidSetupCheck,\n] as const;\n","/**\n * Identity provider tools — Google, GitHub, Microsoft, generic OIDC.\n * Each create_* operation atomically: creates the IdP config AND adds it to\n * the login policy so it appears on the login screen. The Prysmid API\n * encapsulates that two-step lifecycle behind a single endpoint.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listIdps = defineTool({\n name: \"list_idps\",\n description:\n \"List identity providers (Google/GitHub/Microsoft/OIDC) configured on a workspace.\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/idps`),\n});\n\nexport const addIdp = defineTool({\n name: \"add_idp\",\n description:\n \"Add an identity provider to the workspace and attach it to the login policy in one atomic call.\",\n inputShape: {\n workspace: z.string().min(1),\n type: z\n .enum([\"google\", \"github\", \"microsoft\", \"oidc\"])\n .describe(\"Identity provider kind. `microsoft` covers Azure AD / Entra.\"),\n name: z.string().min(1).describe(\"Display name shown on login screen\"),\n client_id: z.string().min(1),\n client_secret: z.string().min(1),\n scopes: z.array(z.string()).optional(),\n issuer: z\n .string()\n .url()\n .optional()\n .describe(\"Required for `oidc`; ignored otherwise\"),\n tenant_id: z\n .string()\n .optional()\n .describe(\n \"Optional for `microsoft` — lock to a specific Entra tenant GUID. Default accepts any account.\",\n ),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteIdp = defineTool({\n name: \"delete_idp\",\n description:\n \"Remove an identity provider. Strips it from the login policy then deletes the config. Idempotent.\",\n inputShape: {\n workspace: z.string().min(1),\n idp_id: z.string().min(1),\n },\n handler: async ({ workspace, idp_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nexport const getIdp = defineTool({\n name: \"get_idp\",\n description:\n \"Fetch full detail for one identity provider: type, state, client_id, issuer/tenant (when applicable), scopes, secret_updated_at, created_at. Never returns the client_secret.\",\n inputShape: {\n workspace: z.string().min(1),\n idp_id: z.string().min(1),\n },\n handler: async ({ workspace, idp_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,\n ),\n});\n\nexport const updateIdp = defineTool({\n name: \"update_idp\",\n description:\n \"Patch mutable fields on an identity provider. All fields optional. Passing client_secret rotates the upstream-issued value (Google/GitHub/Microsoft/OIDC client secret stored in Prysmid). Passing client_id retargets to a different upstream client. issuer/tenant_id apply only when relevant to the IdP type.\",\n inputShape: {\n workspace: z.string().min(1),\n idp_id: z.string().min(1),\n name: z.string().min(1).optional(),\n client_id: z.string().min(1).optional(),\n client_secret: z\n .string()\n .min(1)\n .optional()\n .describe(\n \"Rotate the upstream-issued client secret. Not the Prysmid app secret — that one is rotated via regenerate_app_secret.\",\n ),\n scopes: z.array(z.string()).optional(),\n issuer: z\n .string()\n .url()\n .optional()\n .describe(\"Only meaningful for type=oidc.\"),\n tenant_id: z\n .string()\n .optional()\n .describe(\"Only meaningful for type=microsoft (Entra tenant GUID).\"),\n },\n handler: async ({ workspace, idp_id, ...patch }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,\n { method: \"PATCH\", body: patch },\n ),\n});\n\nexport const probeIdp = defineTool({\n name: \"probe_idp\",\n description:\n \"Probe an external identity provider end-to-end against its upstream authorize endpoint. Catches redirect_uri_mismatch (URI not registered at Google Cloud / GitHub / etc.), invalid_client (client_id rotated or deleted upstream), and provider_unreachable failures BEFORE a real end-user hits them. Use after enable_google_login / add_idp, and any time you suspect the IdP is misconfigured. Today: Google + GitHub get full classification; Microsoft + OIDC generic return `skipped` for the deterministic dimensions (only reachability is verified).\",\n inputShape: {\n workspace: z.string().min(1),\n idp_id: z.string().min(1),\n },\n handler: async ({ workspace, idp_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}/probe`,\n { method: \"POST\" },\n ),\n});\n\nexport const tools = [listIdps, addIdp, deleteIdp, getIdp, updateIdp, probeIdp] as const;\n","/**\n * Login policy tools — control which authentication methods are allowed,\n * MFA enforcement, lockout thresholds. Patches are merge semantics on the\n * server side; only fields you set are changed.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const getLoginPolicy = defineTool({\n name: \"get_login_policy\",\n description:\n \"Return the workspace's current login policy (password rules, MFA, IdPs allowed, lockout, etc.).\",\n inputShape: {\n workspace: z.string().min(1),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n ),\n});\n\nexport const updateLoginPolicy = defineTool({\n name: \"update_login_policy\",\n description:\n \"Update the login policy. PATCH semantics — only fields you pass are changed; other policy fields stay as they were.\",\n inputShape: {\n workspace: z.string().min(1),\n allow_username_password: z.boolean().optional(),\n allow_register: z.boolean().optional(),\n allow_external_idp: z.boolean().optional(),\n force_mfa: z\n .boolean()\n .optional()\n .describe(\"Require any second factor at login\"),\n passwordless_type: z\n .enum([\n \"PASSWORDLESS_TYPE_NOT_ALLOWED\",\n \"PASSWORDLESS_TYPE_ALLOWED\",\n ])\n .optional()\n .describe(\"Enables passkey-first when set to ALLOWED\"),\n max_password_attempts: z.number().int().min(0).max(20).optional(),\n lockout_password_attempts: z.number().int().min(0).max(20).optional(),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,\n { method: \"PATCH\", body },\n ),\n});\n\nexport const tools = [getLoginPolicy, updateLoginPolicy] as const;\n","/**\n * User tools — list, invite (sends Zitadel init email), delete.\n * Invite is the primary creation path; users set their own password via the\n * email link. Direct user creation with pre-set credentials is intentionally\n * not exposed here.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listUsers = defineTool({\n name: \"list_users\",\n description: \"List human users in a workspace.\",\n inputShape: {\n workspace: z.string().min(1),\n limit: z.number().int().min(1).max(500).default(100),\n },\n handler: async ({ workspace, limit }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users`,\n { query: { limit } },\n ),\n});\n\nexport const inviteUser = defineTool({\n name: \"invite_user\",\n description:\n \"Invite a user by email. Idempotent by email — re-inviting an existing user is a no-op. Triggers a Zitadel init email with a 'set your password' link.\",\n inputShape: {\n workspace: z.string().min(1),\n email: z\n .string()\n .regex(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/, \"must be a valid email\"),\n first_name: z.string().min(1),\n last_name: z.string().min(1),\n preferred_language: z\n .string()\n .length(2)\n .default(\"en\")\n .describe(\"ISO 639-1, e.g. en/es/pt\"),\n },\n handler: async ({ workspace, ...body }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users/invite`,\n { method: \"POST\", body },\n ),\n});\n\nexport const deleteUser = defineTool({\n name: \"delete_user\",\n description: \"Delete a user by id. Idempotent.\",\n inputShape: {\n workspace: z.string().min(1),\n user_id: z.string().min(1),\n },\n handler: async ({ workspace, user_id }, { client }) =>\n client.request(\n `/v1/workspaces/${encodeURIComponent(workspace)}/users/${encodeURIComponent(user_id)}`,\n { method: \"DELETE\" },\n ),\n});\n\nexport const tools = [listUsers, inviteUser, deleteUser] as const;\n","/**\n * Hand-written workspace tools. These are the ones agents reach for first;\n * the rest of the surface is auto-generated from OpenAPI in a later pass.\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"./registry.js\";\n\nexport const listWorkspaces = defineTool({\n name: \"list_workspaces\",\n description:\n \"List Prysmid workspaces accessible to the current API token. Returns an array of {id, slug, display_name, plan, state}.\",\n inputShape: {},\n handler: async (_input, { client }) =>\n client.request(\"/v1/workspaces\", { method: \"GET\" }),\n});\n\nexport const getWorkspace = defineTool({\n name: \"get_workspace\",\n description: \"Get a single workspace by slug or id.\",\n inputShape: {\n workspace: z\n .string()\n .min(1)\n .describe(\"Workspace slug or UUID\"),\n },\n handler: async ({ workspace }, { client }) =>\n client.request(`/v1/workspaces/${encodeURIComponent(workspace)}`),\n});\n\nexport const createWorkspace = defineTool({\n name: \"create_workspace\",\n description:\n \"Create a new Prysmid workspace. Provisioning runs in the background; the response returns immediately with state=provisioning. Poll `get_workspace` until state=active (~30s).\",\n inputShape: {\n slug: z\n .string()\n .min(2)\n .max(63)\n .regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric and hyphens only\")\n .describe(\"Subdomain-safe slug — becomes auth.<slug>.prysmid.com\"),\n display_name: z.string().min(1).max(255),\n },\n handler: async (input, { client }) =>\n client.request(\"/v1/workspaces\", { method: \"POST\", body: input }),\n});\n\nexport const tools = [listWorkspaces, getWorkspace, createWorkspace] as const;\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createApp = defineTool({\n name: \"create_app\",\n description: \"Create App\",\n inputShape: {\n workspace_id: z.string().uuid(),\n name: z.string().min(1).max(200),\n redirect_uris: z.array(z.string().url().min(1).max(2083)).describe(\"Where the IdP sends the user back after auth. At least one required.\"),\n post_logout_redirect_uris: z.array(z.string().url().min(1).max(2083)).describe(\"Where the IdP sends the user after logout.\").optional(),\n app_type: z.enum([\"web\", \"spa\", \"native\"]).describe(\"App kind, drives OIDC grant + auth_method defaults.\\n\\n- `web`: server-rendered confidential client. Gets a `client_secret`.\\n- `spa`: single-page app (user-agent). Public, PKCE required, no secret.\\n- `native`: desktop/mobile. Public, PKCE required, no secret.\").optional(),\n dev_mode: z.boolean().describe(\"Relax HTTPS requirement on redirect_uris (allows http://localhost). Use only for local development; never in production.\").default(false),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps`, { method: \"POST\", body: __body });\n },\n});\n\nexport const deleteApp = defineTool({\n name: \"delete_app\",\n description: \"Delete App\",\n inputShape: {\n workspace_id: z.string().uuid(),\n app_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, app_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps/${encodeURIComponent(String(app_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const listApps = defineTool({\n name: \"list_apps\",\n description: \"List Apps\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/apps`, { method: \"GET\" });\n },\n});\n\nexport const generatedAppsTools = [\n createApp,\n deleteApp,\n listApps,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const billingCheckout = defineTool({\n name: \"billing_checkout\",\n description: \"Checkout\",\n inputShape: {\n workspace_id: z.string().uuid(),\n plan: z.enum([\"free\", \"pro\", \"enterprise\"]),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/checkout`, { method: \"POST\", body: __body });\n },\n});\n\nexport const billingGetState = defineTool({\n name: \"billing_get_state\",\n description: \"Get State\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing`, { method: \"GET\" });\n },\n});\n\nexport const billingPortal = defineTool({\n name: \"billing_portal\",\n description: \"Portal\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/portal`, { method: \"POST\" });\n },\n});\n\nexport const updateSpendingCap = defineTool({\n name: \"update_spending_cap\",\n description: \"Update Spending Cap\",\n inputShape: {\n workspace_id: z.string().uuid(),\n cents: z.number().int().min(0).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/billing/spending-cap`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedBillingTools = [\n billingCheckout,\n billingGetState,\n billingPortal,\n updateSpendingCap,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const deleteLogo = defineTool({\n name: \"delete_logo\",\n description: \"Delete Logo\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding/logo`, { method: \"DELETE\" });\n },\n});\n\nexport const getBranding = defineTool({\n name: \"get_branding\",\n description: \"Get Branding\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding`, { method: \"GET\" });\n },\n});\n\nexport const updateBranding = defineTool({\n name: \"update_branding\",\n description: \"Update Branding\",\n inputShape: {\n workspace_id: z.string().uuid(),\n primary_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n background_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n warn_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n font_color: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n primary_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n background_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n warn_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n font_color_dark: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n hide_login_name_suffix: z.boolean().nullable().optional(),\n disable_watermark: z.boolean().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/branding`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedBrandingTools = [\n deleteLogo,\n getBranding,\n updateBranding,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createIdp = defineTool({\n name: \"create_idp\",\n description: \"Create Idp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n type: z.enum([\"google\", \"github\", \"microsoft\", \"oidc\"]),\n name: z.string().min(1).max(200),\n client_id: z.string().min(1),\n client_secret: z.string().min(1),\n issuer: z.string().url().min(1).max(2083).nullable().optional(),\n tenant_id: z.string().nullable().optional(),\n scopes: z.array(z.string()).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps`, { method: \"POST\", body: __body });\n },\n});\n\nexport const deleteIdp = defineTool({\n name: \"delete_idp\",\n description: \"Delete Idp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n idp_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, idp_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps/${encodeURIComponent(String(idp_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const listIdps = defineTool({\n name: \"list_idps\",\n description: \"List Idps\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/idps`, { method: \"GET\" });\n },\n});\n\nexport const generatedIdpsTools = [\n createIdp,\n deleteIdp,\n listIdps,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const getLoginPolicy = defineTool({\n name: \"get_login_policy\",\n description: \"Get Login Policy\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/login-policy`, { method: \"GET\" });\n },\n});\n\nexport const updateLoginPolicy = defineTool({\n name: \"update_login_policy\",\n description: \"Update Login Policy\",\n inputShape: {\n workspace_id: z.string().uuid(),\n allow_username_password: z.boolean().nullable().optional(),\n allow_register: z.boolean().nullable().optional(),\n allow_external_idp: z.boolean().nullable().optional(),\n force_mfa: z.boolean().nullable().optional(),\n passwordless_allowed: z.boolean().nullable().optional(),\n second_factors: z.array(z.enum([\"otp\", \"u2f\", \"otp_email\", \"otp_sms\"])).nullable().optional(),\n multi_factors: z.array(z.enum([\"u2f_verified\"])).nullable().optional(),\n hide_password_reset: z.boolean().nullable().optional(),\n ignore_unknown_usernames: z.boolean().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/login-policy`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedLoginPolicyTools = [\n getLoginPolicy,\n updateLoginPolicy,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const getSmtp = defineTool({\n name: \"get_smtp\",\n description: \"Get Smtp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"GET\" });\n },\n});\n\nexport const revertToPlatformDefault = defineTool({\n name: \"revert_to_platform_default\",\n description: \"Revert To Platform Default\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"DELETE\" });\n },\n});\n\nexport const setCustomSmtp = defineTool({\n name: \"set_custom_smtp\",\n description: \"Set Custom Smtp\",\n inputShape: {\n workspace_id: z.string().uuid(),\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n tls: z.boolean().default(true),\n sender_address: z.string().min(3).describe(\"Address that appears in the From header.\"),\n sender_name: z.string().min(1).max(200),\n user: z.string().min(1).describe(\"SMTP auth username.\"),\n password: z.string().min(1).describe(\"SMTP auth password / API key.\"),\n reply_to_address: z.string().describe(\"Optional Reply-To header.\").default(\"\"),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/smtp`, { method: \"PUT\", body: __body });\n },\n});\n\nexport const generatedSmtpTools = [\n getSmtp,\n revertToPlatformDefault,\n setCustomSmtp,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const deleteUser = defineTool({\n name: \"delete_user\",\n description: \"Delete User\",\n inputShape: {\n workspace_id: z.string().uuid(),\n user_id: z.string(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, user_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users/${encodeURIComponent(String(user_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const inviteUser = defineTool({\n name: \"invite_user\",\n description: \"Invite User\",\n inputShape: {\n workspace_id: z.string().uuid(),\n email: z.string().max(320).regex(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/),\n first_name: z.string().min(1).max(100),\n last_name: z.string().min(1).max(100),\n user_name: z.string().nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users/invite`, { method: \"POST\", body: __body });\n },\n});\n\nexport const listUsers = defineTool({\n name: \"list_users\",\n description: \"List Users\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/users`, { method: \"GET\" });\n },\n});\n\nexport const generatedUsersTools = [\n deleteUser,\n inviteUser,\n listUsers,\n];\n","/**\n * AUTO-GENERATED by scripts/generate-tools.ts. DO NOT EDIT BY HAND.\n *\n * Tools here are 1:1 with REST endpoints from the Prysmid OpenAPI spec.\n * Hand-written / curated tools with the same `name` shadow these at\n * registration time (see src/index.ts).\n */\nimport { z } from \"zod\";\n\nimport { defineTool } from \"../registry.js\";\n\nexport const createWorkspace = defineTool({\n name: \"create_workspace\",\n description: \"Create Workspace\",\n inputShape: {\n slug: z.string().min(3).max(63).regex(/^[a-z][a-z0-9-]*[a-z0-9]$/).describe(\"URL-safe lowercase slug. Becomes part of auth.<slug>.prysmid.com.\"),\n display_name: z.string().min(1).max(255),\n plan: z.enum([\"free\", \"pro\", \"enterprise\"]).optional(),\n },\n handler: async (input, { client }) => {\n return client.request(`/v1/workspaces`, { method: \"POST\", body: input });\n },\n});\n\nexport const deleteWorkspace = defineTool({\n name: \"delete_workspace\",\n description: \"Delete Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"DELETE\" });\n },\n});\n\nexport const getWorkspace = defineTool({\n name: \"get_workspace\",\n description: \"Get Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"GET\" });\n },\n});\n\nexport const listWorkspaces = defineTool({\n name: \"list_workspaces\",\n description: \"List Workspaces\",\n inputShape: {},\n handler: async (_input, { client }) => {\n return client.request(`/v1/workspaces`, { method: \"GET\" });\n },\n});\n\nexport const retryProvisioning = defineTool({\n name: \"retry_provisioning\",\n description: \"Retry Provisioning\",\n inputShape: {\n workspace_id: z.string().uuid(),\n },\n handler: async (input, { client }) => {\n const { workspace_id } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}/retry-provisioning`, { method: \"POST\" });\n },\n});\n\nexport const updateWorkspace = defineTool({\n name: \"update_workspace\",\n description: \"Update Workspace\",\n inputShape: {\n workspace_id: z.string().uuid(),\n display_name: z.string().min(1).max(255).nullable().optional(),\n },\n handler: async (input, { client }) => {\n const { workspace_id, ...__body } = input;\n return client.request(`/v1/workspaces/${encodeURIComponent(String(workspace_id))}`, { method: \"PATCH\", body: __body });\n },\n});\n\nexport const generatedWorkspacesTools = [\n createWorkspace,\n deleteWorkspace,\n getWorkspace,\n listWorkspaces,\n retryProvisioning,\n updateWorkspace,\n];\n","/**\n * AUTO-GENERATED. Do not edit.\n *\n * Aggregates every tag's generated tools into a single array. The merge with\n * hand-written tools (where hand-written wins on name collision) lives in\n * src/index.ts.\n */\nimport { generatedAppsTools } from \"./apps.js\";\nimport { generatedBillingTools } from \"./billing.js\";\nimport { generatedBrandingTools } from \"./branding.js\";\nimport { generatedIdpsTools } from \"./idps.js\";\nimport { generatedLoginPolicyTools } from \"./login-policy.js\";\nimport { generatedSmtpTools } from \"./smtp.js\";\nimport { generatedUsersTools } from \"./users.js\";\nimport { generatedWorkspacesTools } from \"./workspaces.js\";\n\nexport const generatedTools = [\n ...generatedAppsTools,\n ...generatedBillingTools,\n ...generatedBrandingTools,\n ...generatedIdpsTools,\n ...generatedLoginPolicyTools,\n ...generatedSmtpTools,\n ...generatedUsersTools,\n ...generatedWorkspacesTools,\n];\n"],"mappings":";;;AAoBA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACsCrC,IAAM,gBAAgB,CAAC,OACrB,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAEtC,IAAM,iBAAiB,CAAC,UAA0B;AAChD,aAAW,QAAQ,MAAO,SAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAC5D;AAEA,eAAsB,WACpB,MAC0B;AAC1B,QAAMA,SAAQ,KAAK,SAAS;AAC5B,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,YAAY,KAAK,aAAa;AACpC,QAAM,EAAE,SAAS,IAAI,IAAI;AAEzB,QAAM,QAAQ,MAAM;AAAA,IAClB;AAAA,IACA,GAAG,OAAO;AAAA,IACV,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,MAAM,6BAA6B,MAAM;AAC3D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,SAAS;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU,MAAM,SAAS;AAAA,IACzB;AAAA,IACA,0CAA0C,MAAM,UAAU;AAAA,IAC1D;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KAAK,wBAAwB;AAAA,IAC/B,SAAS,IAAI;AAAA,IACb,OAAO,SAAS;AAAA,IAChB,UAAU,KAAK;AAAA,EACjB,CAAC;AAED,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAOA,IAAI,CAAC,QAAQ,IAAI,QAAQ;AACvB,OAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,YAAQ,OAAO,MAAM,UAAU,eAAe,QAAQ,IAAI,QAAQ,GAAG;AAAA,CAAI;AACzE,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["sleep","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","tools","z","z","listApps","z","z","z","z","getBranding","updateBranding","z","z","deleteIdp","listIdps","z","getLoginPolicy","z","updateLoginPolicy","z","z","z","deleteUser","z","inviteUser","listUsers","z","createWorkspace","z","getWorkspace","listWorkspaces","readFileSync","dirname","tools"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prysmid/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Official Prysmid MCP server — manage workspaces, apps OIDC, login policy, IdPs, branding, users from any MCP-compatible agent (Claude Code, Cursor, etc.)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://prysmid.com",
|