@kadoa/mcp 0.5.4-rc.1 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +42 -705
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29556,7 +29556,7 @@ var require_combined_stream = __commonJS((exports, module) => {
29556
29556
  };
29557
29557
  });
29558
29558
 
29559
- // node_modules/form-data/node_modules/mime-db/db.json
29559
+ // node_modules/form-data/node_modules/mime-types/node_modules/mime-db/db.json
29560
29560
  var require_db = __commonJS((exports, module) => {
29561
29561
  module.exports = {
29562
29562
  "application/1d-interleaved-parityfec": {
@@ -41039,11 +41039,6 @@ var require_follow_redirects = __commonJS((exports, module) => {
41039
41039
  } catch (error48) {
41040
41040
  useNativeURL = error48.code === "ERR_INVALID_URL";
41041
41041
  }
41042
- var sensitiveHeaders = [
41043
- "Authorization",
41044
- "Proxy-Authorization",
41045
- "Cookie"
41046
- ];
41047
41042
  var preservedUrlFields = [
41048
41043
  "auth",
41049
41044
  "host",
@@ -41091,7 +41086,6 @@ var require_follow_redirects = __commonJS((exports, module) => {
41091
41086
  self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
41092
41087
  }
41093
41088
  };
41094
- this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex2).join("|") + ")$", "i");
41095
41089
  this._performRequest();
41096
41090
  }
41097
41091
  RedirectableRequest.prototype = Object.create(Writable.prototype);
@@ -41229,9 +41223,6 @@ var require_follow_redirects = __commonJS((exports, module) => {
41229
41223
  if (!options.headers) {
41230
41224
  options.headers = {};
41231
41225
  }
41232
- if (!isArray2(options.sensitiveHeaders)) {
41233
- options.sensitiveHeaders = [];
41234
- }
41235
41226
  if (options.host) {
41236
41227
  if (!options.hostname) {
41237
41228
  options.hostname = options.host;
@@ -41328,7 +41319,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
41328
41319
  this._isRedirect = true;
41329
41320
  spreadUrlObject(redirectUrl, this._options);
41330
41321
  if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
41331
- removeMatchingHeaders(this._headerFilter, this._options.headers);
41322
+ removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
41332
41323
  }
41333
41324
  if (isFunction2(beforeRedirect)) {
41334
41325
  var responseDetails = {
@@ -41476,9 +41467,6 @@ var require_follow_redirects = __commonJS((exports, module) => {
41476
41467
  var dot = subdomain.length - domain2.length - 1;
41477
41468
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain2);
41478
41469
  }
41479
- function isArray2(value) {
41480
- return value instanceof Array;
41481
- }
41482
41470
  function isString2(value) {
41483
41471
  return typeof value === "string" || value instanceof String;
41484
41472
  }
@@ -41491,9 +41479,6 @@ var require_follow_redirects = __commonJS((exports, module) => {
41491
41479
  function isURL(value) {
41492
41480
  return URL2 && value instanceof URL2;
41493
41481
  }
41494
- function escapeRegex2(regex) {
41495
- return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
41496
- }
41497
41482
  module.exports = wrap({ http, https });
41498
41483
  module.exports.wrap = wrap;
41499
41484
  });
@@ -51217,12 +51202,12 @@ function registerTools(server, ctx) {
51217
51202
  const FETCH_DATA_DEFAULT_LIMIT = 50;
51218
51203
  const FETCH_DATA_MAX_LIMIT = 500;
51219
51204
  server.registerTool("fetch_data", {
51220
- description: "Get a page of extracted data from a workflow. Use for previews, sorted/filtered slices, or 'first N rows' queries. For full datasets (especially >500 rows or anything destined for Excel/pandas), use export_data instead. Data is only available after the workflow run has completed (status is no longer 'Running' or 'Validating'). Do NOT poll or sleep-wait for completion.",
51205
+ description: "Get a PAGE of extracted data from a workflow. Use ONLY for previews, sorted/filtered slices, or explicit 'first N rows' / 'top N' queries (capped at 500 rows per call). Do NOT use this to retrieve a full dataset, 'all rows', or anything the user wants to analyze in Excel / pandas / duckdb — use export_data for those. Data is only available after the workflow run has completed (status is no longer 'Running' or 'Validating'). Do NOT poll or sleep-wait for completion.",
51221
51206
  inputSchema: {
51222
51207
  workflowId: exports_external.string().describe("The workflow ID"),
51223
51208
  limit: exports_external.preprocess(coerceNumber(), exports_external.number()).optional().describe(`Maximum number of records to return. Default ${FETCH_DATA_DEFAULT_LIMIT}, max ${FETCH_DATA_MAX_LIMIT}.`),
51224
51209
  page: exports_external.preprocess(coerceNumber(), exports_external.number()).optional().describe("Page number for pagination (1-based)"),
51225
- filters: exports_external.string().optional().describe("JSON-encoded filter array, same shape accepted by the /data endpoint"),
51210
+ filters: exports_external.string().optional().describe('JSON-encoded filter array. Each filter has shape {"field":"<fieldName>","operator":"<OP>","value":"<v>"}. Operators are UPPERCASE: CONTAINS, EQUALS, NOT_EQUALS, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL. Example: [{"field":"title","operator":"CONTAINS","value":"Manager"}].'),
51226
51211
  sortBy: exports_external.string().optional().describe("Field name to sort by"),
51227
51212
  order: exports_external.enum(["asc", "desc"]).optional().describe("Sort order: asc or desc")
51228
51213
  },
@@ -51252,12 +51237,12 @@ function registerTools(server, ctx) {
51252
51237
  return jsonResult(result);
51253
51238
  }));
51254
51239
  server.registerTool("export_data", {
51255
- description: "Materialize a workflow's full dataset to object storage and return a signed download URL. Use this for full datasets, large workflows (>500 rows), or anything destined for Excel / pandas / duckdb. The URL is self-authenticating: open with `fetch(url)` no Authorization header needed.",
51240
+ description: "PREFERRED tool for retrieving a workflow's FULL dataset. Materializes the data to object storage and returns a signed download URL. Use this whenever the user wants 'all rows', 'the full dataset', 'everything', an export, or anything destined for Excel / pandas / duckdb / a CSV file — even for small workflows. The URL is self-authenticating (open with `fetch(url)`, no Authorization header). Use fetch_data ONLY when the user explicitly asks for a small preview slice (e.g., 'first 10', 'top N sorted by X').",
51256
51241
  inputSchema: {
51257
51242
  workflowId: exports_external.string().describe("The workflow ID"),
51258
51243
  format: exports_external.enum(["csv", "json"]).optional().describe("Export format. Default 'csv'."),
51259
51244
  runId: exports_external.string().optional().describe("Specific run ID to export. Defaults to the latest completed run."),
51260
- filters: exports_external.string().optional().describe("JSON-encoded filter array, same shape as /data"),
51245
+ filters: exports_external.string().optional().describe('JSON-encoded filter array. Each filter has shape {"field":"<fieldName>","operator":"<OP>","value":"<v>"}. Operators are UPPERCASE: CONTAINS, EQUALS, NOT_EQUALS, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL.'),
51261
51246
  sortBy: exports_external.string().optional().describe("Field name to sort by"),
51262
51247
  order: exports_external.enum(["asc", "desc"]).optional().describe("Sort order: asc or desc"),
51263
51248
  rowIds: exports_external.string().optional().describe("Comma-separated list (or JSON array) of row ids to include")
@@ -52002,7 +51987,7 @@ var package_default;
52002
51987
  var init_package = __esm(() => {
52003
51988
  package_default = {
52004
51989
  name: "@kadoa/mcp",
52005
- version: "0.5.4-rc.1",
51990
+ version: "0.5.4",
52006
51991
  description: "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
52007
51992
  type: "module",
52008
51993
  main: "dist/index.js",
@@ -56044,6 +56029,10 @@ function generatePKCE() {
56044
56029
  const challenge = createHash2("sha256").update(verifier).digest("base64url");
56045
56030
  return { verifier, challenge };
56046
56031
  }
56032
+ function kadoaAuthUrl() {
56033
+ const raw = process.env.KADOA_AUTH_URL || "https://auth.kadoa.com";
56034
+ return raw.replace(/\/+$/, "");
56035
+ }
56047
56036
  function jwtClaims(jwt2) {
56048
56037
  try {
56049
56038
  const payload = JSON.parse(Buffer.from(jwt2.split(".")[1], "base64url").toString());
@@ -56056,76 +56045,6 @@ function jwtClaims(jwt2) {
56056
56045
  return {};
56057
56046
  }
56058
56047
  }
56059
- async function exchangeSupabaseCode(code, codeVerifier) {
56060
- const supabaseUrl = process.env.SUPABASE_URL;
56061
- if (!supabaseUrl)
56062
- throw new Error("SUPABASE_URL is not configured");
56063
- const res = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=pkce`, {
56064
- method: "POST",
56065
- headers: {
56066
- "Content-Type": "application/json",
56067
- apikey: process.env.SUPABASE_ANON_KEY
56068
- },
56069
- body: JSON.stringify({ auth_code: code, code_verifier: codeVerifier })
56070
- });
56071
- if (!res.ok) {
56072
- const body = await res.text();
56073
- throw new Error(`Supabase token exchange failed (${res.status}): ${body}`);
56074
- }
56075
- const data = await res.json();
56076
- return { accessToken: data.access_token, refreshToken: data.refresh_token };
56077
- }
56078
- async function fetchUserTeams(supabaseJwt) {
56079
- const kadoaApiUrl = process.env.KADOA_PUBLIC_API_URI || "https://api.kadoa.com";
56080
- const userRes = await fetch(`${kadoaApiUrl}/v4/user`, {
56081
- headers: { Authorization: `Bearer ${supabaseJwt}` }
56082
- });
56083
- if (!userRes.ok) {
56084
- const body = await userRes.text();
56085
- throw new Error(`Kadoa /v4/user failed (${userRes.status}): ${body}`);
56086
- }
56087
- const userData = await userRes.json();
56088
- if (!userData.teams?.length) {
56089
- throw new Error("User has no teams");
56090
- }
56091
- return userData.teams.map((t) => ({
56092
- id: t.id,
56093
- name: t.name,
56094
- memberRole: t.memberRole
56095
- }));
56096
- }
56097
- async function setActiveTeamAndRefresh(jwt2, refreshToken, teamId) {
56098
- const kadoaApiUrl = process.env.KADOA_PUBLIC_API_URI || "https://api.kadoa.com";
56099
- const supabaseUrl = process.env.SUPABASE_URL;
56100
- if (!supabaseUrl)
56101
- throw new Error("SUPABASE_URL is not configured");
56102
- const setRes = await fetch(`${kadoaApiUrl}/v5/auth/active-team`, {
56103
- method: "POST",
56104
- headers: {
56105
- "Content-Type": "application/json",
56106
- Authorization: `Bearer ${jwt2}`
56107
- },
56108
- body: JSON.stringify({ teamId })
56109
- });
56110
- if (!setRes.ok) {
56111
- const body = await setRes.text();
56112
- throw new Error(`POST /v5/auth/active-team failed (${setRes.status}): ${body}`);
56113
- }
56114
- const refreshRes = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=refresh_token`, {
56115
- method: "POST",
56116
- headers: {
56117
- "Content-Type": "application/json",
56118
- apikey: process.env.SUPABASE_ANON_KEY
56119
- },
56120
- body: JSON.stringify({ refresh_token: refreshToken })
56121
- });
56122
- if (!refreshRes.ok) {
56123
- const body = await refreshRes.text();
56124
- throw new Error(`Supabase token refresh failed (${refreshRes.status}): ${body}`);
56125
- }
56126
- const data = await refreshRes.json();
56127
- return { jwt: data.access_token, refreshToken: data.refresh_token };
56128
- }
56129
56048
 
56130
56049
  class KadoaOAuthProvider {
56131
56050
  store;
@@ -56151,151 +56070,23 @@ class KadoaOAuthProvider {
56151
56070
  };
56152
56071
  }
56153
56072
  async authorize(client, params, res) {
56154
- const supabaseUrl = process.env.SUPABASE_URL;
56155
56073
  const serverUrl = process.env.MCP_SERVER_URL;
56156
- if (!supabaseUrl || !serverUrl) {
56157
- throw new Error("SUPABASE_URL and MCP_SERVER_URL must be configured");
56158
- }
56074
+ if (!serverUrl)
56075
+ throw new Error("MCP_SERVER_URL must be configured");
56159
56076
  const state = randomToken();
56160
56077
  const { verifier, challenge } = generatePKCE();
56161
56078
  await this.store.set("pending_auths", state, {
56162
56079
  client,
56163
56080
  params,
56164
- supabaseCodeVerifier: verifier
56081
+ mcpVerifier: verifier
56165
56082
  }, 600);
56166
- res.type("html").send(renderLoginPage(state));
56167
- }
56168
- async handleGoogleLogin(req, res) {
56169
- const { state } = req.body;
56170
- const pending = await this.store.get("pending_auths", state);
56171
- if (!pending) {
56172
- res.status(400).send("Unknown or expired state parameter");
56173
- return;
56174
- }
56175
- const supabaseUrl = process.env.SUPABASE_URL;
56176
- const serverUrl = process.env.MCP_SERVER_URL;
56177
- if (!supabaseUrl || !serverUrl) {
56178
- res.status(500).send("Server misconfigured");
56179
- return;
56180
- }
56181
- const redirectTo = `${serverUrl}/auth/callback?mcp_state=${state}`;
56182
- const authUrl = new URL(`${supabaseUrl}/auth/v1/authorize`);
56183
- authUrl.searchParams.set("provider", "google");
56184
- authUrl.searchParams.set("redirect_to", redirectTo);
56185
- authUrl.searchParams.set("code_challenge", pending.supabaseCodeVerifier ? createHash2("sha256").update(pending.supabaseCodeVerifier).digest("base64url") : "");
56083
+ const authUrl = new URL(`${kadoaAuthUrl()}/login`);
56084
+ authUrl.searchParams.set("callback_url", `${serverUrl}/auth/callback`);
56085
+ authUrl.searchParams.set("state", state);
56086
+ authUrl.searchParams.set("code_challenge", challenge);
56186
56087
  authUrl.searchParams.set("code_challenge_method", "S256");
56187
56088
  res.redirect(authUrl.toString());
56188
56089
  }
56189
- async handleEmailPasswordLogin(req, res) {
56190
- const { state, email: email3, password } = req.body;
56191
- if (!state || !email3 || !password) {
56192
- res.status(400).send("Missing required fields");
56193
- return;
56194
- }
56195
- const pending = await this.store.get("pending_auths", state);
56196
- if (!pending) {
56197
- res.status(400).type("html").send(renderLoginPage(state, "Session expired — please try again"));
56198
- return;
56199
- }
56200
- const supabaseUrl = process.env.SUPABASE_URL;
56201
- if (!supabaseUrl) {
56202
- res.status(500).send("Server misconfigured");
56203
- return;
56204
- }
56205
- try {
56206
- const tokenRes = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=password`, {
56207
- method: "POST",
56208
- headers: {
56209
- "Content-Type": "application/json",
56210
- apikey: process.env.SUPABASE_ANON_KEY
56211
- },
56212
- body: JSON.stringify({ email: email3, password })
56213
- });
56214
- if (!tokenRes.ok) {
56215
- const body = await tokenRes.json().catch(() => ({ error_description: "Authentication failed" }));
56216
- const message = body.error_description || body.msg || "Invalid email or password";
56217
- res.type("html").send(renderLoginPage(state, message));
56218
- return;
56219
- }
56220
- const data = await tokenRes.json();
56221
- await this.store.del("pending_auths", state);
56222
- await this.completeAuthWithTokens(pending, res, data.access_token, data.refresh_token);
56223
- } catch (error48) {
56224
- console.error("Email/password login error:", error48);
56225
- res.type("html").send(renderLoginPage(state, "An unexpected error occurred"));
56226
- }
56227
- }
56228
- async handleSSOLogin(req, res) {
56229
- const { state, email: email3 } = req.body;
56230
- if (!state || !email3) {
56231
- res.status(400).send("Missing required fields");
56232
- return;
56233
- }
56234
- const pending = await this.store.get("pending_auths", state);
56235
- if (!pending) {
56236
- res.status(400).type("html").send(renderLoginPage(state, "Session expired — please try again"));
56237
- return;
56238
- }
56239
- const supabaseUrl = process.env.SUPABASE_URL;
56240
- const serverUrl = process.env.MCP_SERVER_URL;
56241
- if (!supabaseUrl || !serverUrl) {
56242
- res.status(500).send("Server misconfigured");
56243
- return;
56244
- }
56245
- const domain2 = email3.includes("@") ? email3.split("@").pop() : email3;
56246
- try {
56247
- const ssoRes = await fetch(`${supabaseUrl}/auth/v1/sso`, {
56248
- method: "POST",
56249
- headers: {
56250
- "Content-Type": "application/json",
56251
- apikey: process.env.SUPABASE_ANON_KEY
56252
- },
56253
- body: JSON.stringify({
56254
- domain: domain2,
56255
- redirect_to: `${serverUrl}/auth/callback?mcp_state=${state}`,
56256
- skip_http_redirect: true,
56257
- code_challenge: createHash2("sha256").update(pending.supabaseCodeVerifier).digest("base64url"),
56258
- code_challenge_method: "s256"
56259
- })
56260
- });
56261
- if (!ssoRes.ok) {
56262
- const body = await ssoRes.json().catch(() => ({}));
56263
- const message = body.error_description || body.msg || body.message || "No SSO provider configured for this domain";
56264
- res.type("html").send(renderLoginPage(state, message));
56265
- return;
56266
- }
56267
- const data = await ssoRes.json();
56268
- if (!data.url) {
56269
- res.type("html").send(renderLoginPage(state, "No SSO provider configured for this domain"));
56270
- return;
56271
- }
56272
- res.redirect(data.url);
56273
- } catch (error48) {
56274
- console.error("SSO login error:", error48);
56275
- res.type("html").send(renderLoginPage(state, "An unexpected error occurred"));
56276
- }
56277
- }
56278
- async completeAuthWithTokens(pending, res, supabaseJwt, supabaseRefreshToken) {
56279
- const teams = await fetchUserTeams(supabaseJwt);
56280
- if (teams.length === 1) {
56281
- const refreshed = await setActiveTeamAndRefresh(supabaseJwt, supabaseRefreshToken, teams[0].id);
56282
- await this.completeAuthFlow(pending, res, {
56283
- jwt: refreshed.jwt,
56284
- refreshToken: refreshed.refreshToken,
56285
- teamId: teams[0].id
56286
- });
56287
- return;
56288
- }
56289
- const selectionToken = randomToken();
56290
- await this.store.set("pending_team_selections", selectionToken, {
56291
- supabaseJwt,
56292
- supabaseRefreshToken,
56293
- teams,
56294
- pending,
56295
- expiresAt: Date.now() + TEAM_SELECTION_TTL
56296
- }, 600);
56297
- res.type("html").send(renderTeamSelectionPage(teams, selectionToken));
56298
- }
56299
56090
  async challengeForAuthorizationCode(_client, authorizationCode) {
56300
56091
  const entry = await this.store.get("auth_codes", authorizationCode);
56301
56092
  if (!entry)
@@ -56420,9 +56211,9 @@ class KadoaOAuthProvider {
56420
56211
  };
56421
56212
  }
56422
56213
  async handleAuthCallback(req, res) {
56423
- const { code, mcp_state: state } = req.query;
56214
+ const { code, state } = req.query;
56424
56215
  if (!code || !state) {
56425
- res.status(400).send("Missing code or mcp_state parameter");
56216
+ res.status(400).send("Missing code or state parameter");
56426
56217
  return;
56427
56218
  }
56428
56219
  const pending = await this.store.get("pending_auths", state);
@@ -56432,10 +56223,28 @@ class KadoaOAuthProvider {
56432
56223
  }
56433
56224
  await this.store.del("pending_auths", state);
56434
56225
  try {
56435
- const supabaseTokens = await exchangeSupabaseCode(code, pending.supabaseCodeVerifier);
56436
- await this.completeAuthWithTokens(pending, res, supabaseTokens.accessToken, supabaseTokens.refreshToken);
56226
+ const tokenRes = await fetch(`${kadoaAuthUrl()}/api/token`, {
56227
+ method: "POST",
56228
+ headers: { "Content-Type": "application/json" },
56229
+ body: JSON.stringify({ code, code_verifier: pending.mcpVerifier })
56230
+ });
56231
+ if (!tokenRes.ok) {
56232
+ const body = await tokenRes.text().catch(() => "");
56233
+ throw new Error(`auth.kadoa.com /api/token failed (${tokenRes.status}): ${body}`);
56234
+ }
56235
+ const data = await tokenRes.json();
56236
+ if (typeof data?.access_token !== "string" || typeof data?.refresh_token !== "string" || typeof data?.team_id !== "string") {
56237
+ throw new Error("auth.kadoa.com /api/token returned malformed response");
56238
+ }
56239
+ const claims = jwtClaims(data.access_token);
56240
+ console.error(`[AUTH] CALLBACK_OK: tokens received (email=${claims.email}, team=${data.team_id})`);
56241
+ await this.completeAuthFlow(pending, res, {
56242
+ jwt: data.access_token,
56243
+ refreshToken: data.refresh_token,
56244
+ teamId: data.team_id
56245
+ });
56437
56246
  } catch (error48) {
56438
- console.error("Auth callback error:", error48);
56247
+ console.error("[AUTH] CALLBACK_FAIL:", error48);
56439
56248
  const redirectUrl = new URL(pending.params.redirectUri);
56440
56249
  redirectUrl.searchParams.set("error", "server_error");
56441
56250
  redirectUrl.searchParams.set("error_description", error48 instanceof Error ? error48.message : "Authentication failed");
@@ -56445,45 +56254,6 @@ class KadoaOAuthProvider {
56445
56254
  res.redirect(redirectUrl.toString());
56446
56255
  }
56447
56256
  }
56448
- async handleTeamSelection(req, res) {
56449
- const { token, teamId } = req.body;
56450
- if (!token || !teamId) {
56451
- res.status(400).send("Missing token or teamId");
56452
- return;
56453
- }
56454
- const entry = await this.store.get("pending_team_selections", token);
56455
- if (!entry) {
56456
- res.status(400).send("Unknown or expired team selection token");
56457
- return;
56458
- }
56459
- if (entry.expiresAt < Date.now()) {
56460
- await this.store.del("pending_team_selections", token);
56461
- res.status(400).send("Team selection expired — please log in again");
56462
- return;
56463
- }
56464
- if (!entry.teams.some((t) => t.id === teamId)) {
56465
- res.status(403).send("Invalid team selection");
56466
- return;
56467
- }
56468
- await this.store.del("pending_team_selections", token);
56469
- try {
56470
- const refreshed = await setActiveTeamAndRefresh(entry.supabaseJwt, entry.supabaseRefreshToken, teamId);
56471
- await this.completeAuthFlow(entry.pending, res, {
56472
- jwt: refreshed.jwt,
56473
- refreshToken: refreshed.refreshToken,
56474
- teamId
56475
- });
56476
- } catch (error48) {
56477
- console.error("Team selection error:", error48);
56478
- const redirectUrl = new URL(entry.pending.params.redirectUri);
56479
- redirectUrl.searchParams.set("error", "server_error");
56480
- redirectUrl.searchParams.set("error_description", error48 instanceof Error ? error48.message : "Failed to set active team");
56481
- if (entry.pending.params.state) {
56482
- redirectUrl.searchParams.set("state", entry.pending.params.state);
56483
- }
56484
- res.redirect(redirectUrl.toString());
56485
- }
56486
- }
56487
56257
  async completeAuthFlow(pending, res, credentials) {
56488
56258
  const mcpCode = randomToken();
56489
56259
  await this.store.set("auth_codes", mcpCode, {
@@ -56503,429 +56273,9 @@ class KadoaOAuthProvider {
56503
56273
  res.redirect(redirectUrl.toString());
56504
56274
  }
56505
56275
  }
56506
- function renderTeamSelectionPage(teams, selectionToken) {
56507
- const teamButtons = teams.map((t) => `
56508
- <button type="submit" name="teamId" value="${t.id}" class="team-btn">
56509
- <span class="team-name">${escapeHtml(t.name)}</span>
56510
- ${t.memberRole ? `<span class="team-role">${escapeHtml(t.memberRole.toLowerCase())}</span>` : ""}
56511
- </button>`).join(`
56512
- `);
56513
- return `<!DOCTYPE html>
56514
- <html lang="en">
56515
- <head>
56516
- <meta charset="utf-8" />
56517
- <meta name="viewport" content="width=device-width, initial-scale=1" />
56518
- <title>Select Team - Kadoa</title>
56519
- <style>
56520
- * { margin: 0; padding: 0; box-sizing: border-box; }
56521
-
56522
- body {
56523
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
56524
- background: oklch(1 0 0);
56525
- color: oklch(0.17 0.02 228);
56526
- min-height: 100vh;
56527
- display: flex;
56528
- align-items: center;
56529
- justify-content: center;
56530
- }
56531
-
56532
- .container {
56533
- width: 100%;
56534
- max-width: 420px;
56535
- padding: 2rem;
56536
- }
56537
-
56538
- .logo {
56539
- text-align: center;
56540
- margin-bottom: 2rem;
56541
- }
56542
-
56543
- h1 {
56544
- font-size: 1.25rem;
56545
- font-weight: 600;
56546
- text-align: center;
56547
- margin-bottom: 0.5rem;
56548
- color: oklch(0.17 0.02 228);
56549
- }
56550
-
56551
- .subtitle {
56552
- text-align: center;
56553
- color: oklch(0.56 0.02 228);
56554
- font-size: 0.875rem;
56555
- margin-bottom: 1.5rem;
56556
- }
56557
-
56558
- .team-btn {
56559
- width: 100%;
56560
- display: flex;
56561
- align-items: center;
56562
- justify-content: space-between;
56563
- padding: 0.875rem 1rem;
56564
- margin-bottom: 0.5rem;
56565
- background: oklch(1 0 0);
56566
- border: 1px solid oklch(0.5 0.02 228 / 0.4);
56567
- border-radius: 0.3rem;
56568
- color: oklch(0.17 0.02 228);
56569
- font-size: 15px;
56570
- cursor: pointer;
56571
- transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
56572
- box-shadow: 0px 1px 1px 0px oklch(0.68 0.01 60.13 / 0.11);
56573
- }
56574
-
56575
- .team-btn:hover {
56576
- background: oklch(0.96 0 286);
56577
- border-color: oklch(0.7 0.18 42);
56578
- }
56579
-
56580
- .team-btn:active {
56581
- background: oklch(0.72 0.23 54 / 0.13);
56582
- }
56583
-
56584
- .team-name { font-weight: 500; }
56585
-
56586
- .team-role {
56587
- font-size: 13px;
56588
- color: oklch(0.56 0.02 228 / 0.67);
56589
- text-transform: capitalize;
56590
- }
56591
- </style>
56592
- </head>
56593
- <body>
56594
- <div class="container">
56595
- <div class="logo">
56596
- <svg width="108" height="32" viewBox="0 0 108 32" fill="none" xmlns="http://www.w3.org/2000/svg">
56597
- <g clip-path="url(#clip0)">
56598
- <path d="M4.5 27V20.0059C4.49955 18.6288 3.38499 17.5105 2.00781 17.5059L-0.00585938 17.5V14.5L2.00781 14.4941C3.38499 14.4895 4.49955 13.3712 4.5 11.9941V5C4.5 2.51472 6.51472 0.5 9 0.5H12V3.5H9C8.17157 3.5 7.5 4.17157 7.5 5V11.9941C7.49977 13.5757 6.82719 14.9966 5.75781 16C6.82719 17.0034 7.49977 18.4243 7.5 20.0059V27C7.5 27.8284 8.17157 28.5 9 28.5H12V31.5H9C6.51472 31.5 4.5 29.4853 4.5 27Z" fill="#FD7412"/>
56599
- <path d="M103.5 27V20.0059C103.5 18.6288 104.615 17.5105 105.992 17.5059L108.006 17.5V14.5L105.992 14.4941C104.615 14.4895 103.5 13.3712 103.5 11.9941V5C103.5 2.51472 101.485 0.5 99 0.5H96V3.5H99C99.8284 3.5 100.5 4.17157 100.5 5V11.9941C100.5 13.5757 101.173 14.9966 102.242 16C101.173 17.0034 100.5 18.4243 100.5 20.0059V27C100.5 27.8284 99.8284 28.5 99 28.5H96V31.5H99C101.485 31.5 103.5 29.4853 103.5 27Z" fill="#FD7412"/>
56600
- <path d="M85.2346 26.308C84.0026 26.308 82.92 26.0093 81.9866 25.412C81.0533 24.8147 80.3253 23.9653 79.8026 22.864C79.28 21.7627 79.0186 20.4373 79.0186 18.888C79.0186 17.3573 79.28 16.0413 79.8026 14.94C80.3253 13.8387 81.0533 12.9987 81.9866 12.42C82.92 11.8227 84.0026 11.524 85.2346 11.524C86.3733 11.524 87.3906 11.804 88.2866 12.364C89.2013 12.9053 89.7986 13.6427 90.0786 14.576H89.7706L90.1066 11.804H94.1666C94.1106 12.42 94.0546 13.0453 93.9986 13.68C93.9613 14.296 93.9426 14.9027 93.9426 15.5V26H89.7426L89.7146 23.34H90.0506C89.752 24.236 89.1546 24.9547 88.2586 25.496C87.3626 26.0373 86.3546 26.308 85.2346 26.308ZM86.5226 23.116C87.4933 23.116 88.2773 22.7707 88.8746 22.08C89.472 21.3893 89.7706 20.3253 89.7706 18.888C89.7706 17.4507 89.472 16.396 88.8746 15.724C88.2773 15.052 87.4933 14.716 86.5226 14.716C85.552 14.716 84.768 15.052 84.1706 15.724C83.5733 16.396 83.2746 17.4507 83.2746 18.888C83.2746 20.3253 83.564 21.3893 84.1426 22.08C84.74 22.7707 85.5333 23.116 86.5226 23.116Z" fill="#18181B"/>
56601
- <path d="M70.1002 26.308C68.5882 26.308 67.2722 26.0093 66.1522 25.412C65.0509 24.796 64.1922 23.9373 63.5762 22.836C62.9789 21.7347 62.6802 20.4187 62.6802 18.888C62.6802 17.376 62.9789 16.0693 63.5762 14.968C64.1922 13.8667 65.0509 13.0173 66.1522 12.42C67.2722 11.8227 68.5882 11.524 70.1002 11.524C71.6122 11.524 72.9282 11.8227 74.0482 12.42C75.1682 13.0173 76.0269 13.8667 76.6242 14.968C77.2402 16.0693 77.5482 17.376 77.5482 18.888C77.5482 20.4187 77.2402 21.7347 76.6242 22.836C76.0269 23.9373 75.1682 24.796 74.0482 25.412C72.9282 26.0093 71.6122 26.308 70.1002 26.308ZM70.1002 23.116C71.0709 23.116 71.8362 22.7707 72.3962 22.08C72.9749 21.3893 73.2642 20.3253 73.2642 18.888C73.2642 17.4507 72.9749 16.396 72.3962 15.724C71.8362 15.052 71.0709 14.716 70.1002 14.716C69.1295 14.716 68.3549 15.052 67.7762 15.724C67.2162 16.396 66.9362 17.4507 66.9362 18.888C66.9362 20.3253 67.2162 21.3893 67.7762 22.08C68.3549 22.7707 69.1295 23.116 70.1002 23.116Z" fill="#18181B"/>
56602
- <path d="M51.8208 26.308C50.5888 26.308 49.4968 26.0093 48.5448 25.412C47.6115 24.8147 46.8741 23.9653 46.3328 22.864C45.8101 21.7627 45.5488 20.4373 45.5488 18.888C45.5488 17.3573 45.8101 16.0413 46.3328 14.94C46.8555 13.8387 47.5928 12.9987 48.5448 12.42C49.4968 11.8227 50.5888 11.524 51.8208 11.524C52.9408 11.524 53.9395 11.7947 54.8168 12.336C55.7128 12.8587 56.3101 13.568 56.6088 14.464H56.2448V5.392H60.4728V26H56.3008V23.228H56.6648C56.3661 24.1613 55.7688 24.908 54.8728 25.468C53.9768 26.028 52.9595 26.308 51.8208 26.308ZM53.0808 23.116C54.0515 23.116 54.8355 22.7707 55.4328 22.08C56.0301 21.3893 56.3288 20.3253 56.3288 18.888C56.3288 17.4507 56.0301 16.396 55.4328 15.724C54.8355 15.052 54.0515 14.716 53.0808 14.716C52.1101 14.716 51.3168 15.052 50.7008 15.724C50.1035 16.396 49.8048 17.4507 49.8048 18.888C49.8048 20.3253 50.1035 21.3893 50.7008 22.08C51.3168 22.7707 52.1101 23.116 53.0808 23.116Z" fill="#18181B"/>
56603
- <path d="M34.6334 26.308C33.4014 26.308 32.3187 26.0093 31.3854 25.412C30.4521 24.8147 29.7241 23.9653 29.2014 22.864C28.6787 21.7627 28.4174 20.4373 28.4174 18.888C28.4174 17.3573 28.6787 16.0413 29.2014 14.94C29.7241 13.8387 30.4521 12.9987 31.3854 12.42C32.3187 11.8227 33.4014 11.524 34.6334 11.524C35.7721 11.524 36.7894 11.804 37.6854 12.364C38.6001 12.9053 39.1974 13.6427 39.4774 14.576H39.1694L39.5054 11.804H43.5654C43.5094 12.42 43.4534 13.0453 43.3974 13.68C43.3601 14.296 43.3414 14.9027 43.3414 15.5V26H39.1414L39.1134 23.34H39.4494C39.1507 24.236 38.5534 24.9547 37.6574 25.496C36.7614 26.0373 35.7534 26.308 34.6334 26.308ZM35.9214 23.116C36.8921 23.116 37.6761 22.7707 38.2734 22.08C38.8707 21.3893 39.1694 20.3253 39.1694 18.888C39.1694 17.4507 38.8707 16.396 38.2734 15.724C37.6761 15.052 36.8921 14.716 35.9214 14.716C34.9507 14.716 34.1667 15.052 33.5694 15.724C32.9721 16.396 32.6734 17.4507 32.6734 18.888C32.6734 20.3253 32.9627 21.3893 33.5414 22.08C34.1387 22.7707 34.9321 23.116 35.9214 23.116Z" fill="#18181B"/>
56604
- <path d="M13.736 26V5.392H17.964V17.712H18.02L23.284 11.804H28.324L21.52 19.364V17.824L28.688 26H23.508L18.02 19.84H17.964V26H13.736Z" fill="#18181B"/>
56605
- </g>
56606
- <defs><clipPath id="clip0"><rect width="108" height="32" fill="white"/></clipPath></defs>
56607
- </svg>
56608
- </div>
56609
- <h1>Select a team</h1>
56610
- <p class="subtitle">Choose which team to connect with this MCP session</p>
56611
- <form method="POST" action="/team-select">
56612
- <input type="hidden" name="token" value="${selectionToken}" />
56613
- ${teamButtons}
56614
- </form>
56615
- </div>
56616
- </body>
56617
- </html>`;
56618
- }
56619
- function renderLoginPage(state, error48) {
56620
- const errorHtml = error48 ? `<div class="error">${escapeHtml(error48)}</div>` : "";
56621
- return `<!DOCTYPE html>
56622
- <html lang="en">
56623
- <head>
56624
- <meta charset="utf-8" />
56625
- <meta name="viewport" content="width=device-width, initial-scale=1" />
56626
- <title>Sign In - Kadoa</title>
56627
- <style>
56628
- * { margin: 0; padding: 0; box-sizing: border-box; }
56629
-
56630
- body {
56631
- font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
56632
- background: hsl(0 0% 98%);
56633
- color: #18181b;
56634
- min-height: 100dvh;
56635
- display: flex;
56636
- align-items: center;
56637
- justify-content: center;
56638
- background-image: radial-gradient(circle, #d4d4d8 1px, transparent 1px);
56639
- background-size: 24px 24px;
56640
- background-position: center top;
56641
- }
56642
-
56643
- .card {
56644
- width: 100%;
56645
- max-width: 460px;
56646
- background: #fff;
56647
- padding: 1rem;
56648
- display: flex;
56649
- flex-direction: column;
56650
- gap: 1rem;
56651
- min-height: 100dvh;
56652
- }
56653
-
56654
- @media (min-width: 768px) {
56655
- .card { padding: 3rem; min-height: auto; border-left: 1px solid #e0e1e5; border-right: 1px solid #e0e1e5; }
56656
- }
56657
-
56658
- .logo { display: grid; place-content: center; }
56659
-
56660
- h1 {
56661
- font-size: 20px;
56662
- font-weight: 600;
56663
- text-align: center;
56664
- color: #18181b;
56665
- }
56666
-
56667
- .spacer { height: 0; }
56668
- @media (min-width: 768px) { .spacer { height: 3rem; } }
56669
-
56670
- .error {
56671
- background: #fef2f2;
56672
- color: #991b1b;
56673
- border: 1px solid #fecaca;
56674
- border-radius: 4px;
56675
- padding: 0.6rem 0.875rem;
56676
- font-size: 15px;
56677
- }
56678
-
56679
- /* Buttons — matching KUI default + primary looks */
56680
- .btn {
56681
- width: 100%;
56682
- padding: 0.6em 1em;
56683
- border-radius: 4px;
56684
- font-size: 16px;
56685
- font-weight: 500;
56686
- cursor: pointer;
56687
- display: flex;
56688
- align-items: center;
56689
- justify-content: center;
56690
- gap: 0.5rem;
56691
- transition: background 0.15s, border-color 0.15s;
56692
- text-decoration: none;
56693
- }
56694
-
56695
- .btn-default {
56696
- background: #fff;
56697
- color: #18181b;
56698
- border: 1px solid #d4d4d8;
56699
- box-shadow: inset 0 -3px 0 0 rgba(0,0,0,0.03), 0 1px 0px 1px rgba(255,255,255,0.5), 0 -1px 0px 1px rgba(0,0,0,0.02);
56700
- }
56701
-
56702
- .btn-default:hover {
56703
- background: rgba(113,113,122,0.1);
56704
- }
56705
-
56706
- .btn-primary {
56707
- background: hsl(212 70% 27%);
56708
- color: #fff;
56709
- border: 1px solid hsl(214 70% 23%);
56710
- box-shadow: inset 0 2px 0 0 rgba(56,189,248,0.2), 0 -1px 0px 1px rgba(0,0,0,0.02);
56711
- }
56712
-
56713
- .btn-primary:hover {
56714
- background: hsl(212 70% 33%);
56715
- }
56716
-
56717
- /* OR divider */
56718
- .line-or {
56719
- display: flex;
56720
- align-items: center;
56721
- gap: 0.5rem;
56722
- font-weight: 500;
56723
- color: rgba(24,24,27,0.6);
56724
- font-size: 14px;
56725
- margin: 0.5rem 0;
56726
- }
56727
-
56728
- .line-or hr {
56729
- flex: 1;
56730
- border: none;
56731
- border-top: 1px solid rgba(113,113,122,0.15);
56732
- }
56733
-
56734
- /* Form inputs — matching KUI input style */
56735
- label {
56736
- display: block;
56737
- font-size: 16px;
56738
- font-weight: 500;
56739
- margin-bottom: 0.25rem;
56740
- color: #18181b;
56741
- }
56742
-
56743
- input[type="email"], input[type="password"] {
56744
- width: 100%;
56745
- padding: 0.35em 0.5em;
56746
- border: 1px solid #d4d4d8;
56747
- border-radius: 4px;
56748
- font-size: 18px;
56749
- font-family: inherit;
56750
- color: #18181b;
56751
- background: #fff;
56752
- outline: none;
56753
- box-shadow: inset 0 3px 0 0 rgba(0,0,0,0.025);
56754
- transition: border-color 0.15s;
56755
- caret-color: hsl(25 98% 53%);
56756
- }
56757
-
56758
- input[type="email"]:hover, input[type="password"]:hover {
56759
- border-color: hsl(31 99% 72%);
56760
- }
56761
-
56762
- input[type="email"]:focus, input[type="password"]:focus {
56763
- border-color: hsl(25 98% 53%);
56764
- box-shadow: inset 0 3px 0 0 rgba(0,0,0,0.025), 0 0 0 2px rgba(249,115,22,0.2);
56765
- }
56766
-
56767
- .field { margin-bottom: 0.75rem; }
56768
-
56769
- hr.separator {
56770
- border: none;
56771
- border-top: 1px solid rgba(113,113,122,0.15);
56772
- margin: 0.5rem 0;
56773
- }
56774
-
56775
- .google-icon { width: 18px; height: 18px; }
56776
- .key-icon { width: 16px; height: 16px; }
56777
-
56778
- /* Tabs for email/SSO — keep simple, same visual weight */
56779
- .tabs {
56780
- display: none;
56781
- }
56782
-
56783
- .tab-content { display: none; }
56784
- .tab-content.active { display: block; }
56785
-
56786
- .tab-switch {
56787
- text-align: center;
56788
- margin-top: 0.25rem;
56789
- }
56790
-
56791
- .tab-switch a {
56792
- font-size: 15px;
56793
- color: #18181b;
56794
- text-decoration: underline;
56795
- text-decoration-color: rgba(251,146,60,0.5);
56796
- text-underline-offset: 2px;
56797
- cursor: pointer;
56798
- }
56799
-
56800
- .tab-switch a:hover {
56801
- background: rgba(251,146,60,0.1);
56802
- border-radius: 2px;
56803
- }
56804
- </style>
56805
- </head>
56806
- <body>
56807
- <div class="card">
56808
- <!-- Logo {k} -->
56809
- <div class="logo">
56810
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
56811
- <path opacity="0.15" d="M25.3196 6.25H14.6804C14.6804 7.49264 13.6596 8.5 12.4005 8.5C11.3808 8.5 10.8312 8.67478 10.5466 8.82497C10.3001 8.95506 10.147 9.11941 10.0189 9.38005C9.85482 9.7141 9.74438 10.1712 9.68281 10.8152C9.62136 11.458 9.61405 12.2133 9.61405 13.125L9.61416 13.3731C9.61532 14.9118 9.61694 17.0733 8.75235 18.8332C8.55109 19.2428 8.30266 19.6357 8 20C8.30266 20.3643 8.55109 20.7572 8.75235 21.1668C9.61694 22.9267 9.61532 25.0882 9.61416 26.6269L9.61405 26.875C9.61405 27.7867 9.62136 28.542 9.68281 29.1848C9.74438 29.8288 9.85482 30.2859 10.0189 30.6199C10.147 30.8806 10.3001 31.0449 10.5466 31.175C10.8312 31.3252 11.3808 31.5 12.4005 31.5C13.6596 31.5 14.6804 32.5074 14.6804 33.75H25.3196C25.3196 32.5074 26.3404 31.5 27.5995 31.5C28.6192 31.5 29.1688 31.3252 29.4534 31.175C29.6999 31.0449 29.853 30.8806 29.9811 30.6199C30.1452 30.2859 30.2556 29.8288 30.3172 29.1848C30.3786 28.542 30.386 27.7867 30.386 26.875L30.3858 26.6269C30.3847 25.0882 30.3831 22.9267 31.2477 21.1668C31.4489 20.7572 31.6973 20.3643 32 20C31.6973 19.6357 31.4489 19.2428 31.2477 18.8332C30.3831 17.0733 30.3847 14.9118 30.3858 13.3731L30.386 13.125C30.386 12.2133 30.3786 11.458 30.3172 10.8152C30.2556 10.1712 30.1452 9.7141 29.9811 9.38005C29.853 9.11941 29.6999 8.95506 29.4534 8.82497C29.1688 8.67478 28.6192 8.5 27.5995 8.5C26.3404 8.5 25.3196 7.49264 25.3196 6.25Z" fill="#fd7412"/>
56812
- <path d="M12.5 6.25C2.5 6.25 12.5 20 2.5 20C12.5 20 2.5 33.75 12.5 33.75" stroke="#fd7412" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56813
- <path d="M16 10V29" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56814
- <path d="M27.5 6.25C37.5 6.25 27.5 20 37.5 20C27.5 20 37.5 33.75 27.5 33.75" stroke="#fd7412" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56815
- <path d="M16 23L25 18" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56816
- <path d="M25 29L16 23" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56817
- </svg>
56818
- </div>
56819
-
56820
- <!-- Heading -->
56821
- <h1>Sign in to Kadoa</h1>
56822
-
56823
- <div class="spacer"></div>
56824
-
56825
- ${errorHtml}
56826
-
56827
- <!-- Continue with Google -->
56828
- <form method="POST" action="/auth/google">
56829
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56830
- <button type="submit" class="btn btn-default">
56831
- <svg class="google-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
56832
- <path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/>
56833
- <path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/>
56834
- <path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/>
56835
- <path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/>
56836
- </svg>
56837
- Continue with Google
56838
- </button>
56839
- </form>
56840
-
56841
- <!-- Continue with SSO -->
56842
- <div id="sso-button-wrapper">
56843
- <form method="POST" action="/auth/sso" id="sso-direct-form" style="display:none">
56844
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56845
- <input type="hidden" name="email" id="sso-email-hidden" />
56846
- </form>
56847
- <button type="button" class="btn btn-default" id="sso-toggle-btn">
56848
- <svg class="key-icon" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
56849
- <path d="M10 1a5 5 0 0 0-4.546 7.066l-4.161 4.16a.5.5 0 0 0-.146.354V14.5a.5.5 0 0 0 .5.5h2a.5.5 0 0 0 .5-.5V14h1a.5.5 0 0 0 .5-.5v-1h1a.5.5 0 0 0 .354-.146l.94-.94A5 5 0 1 0 10 1zm1.5 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z" fill="currentColor"/>
56850
- </svg>
56851
- Continue with SSO
56852
- </button>
56853
- </div>
56854
-
56855
- <!-- OR divider -->
56856
- <div class="line-or">
56857
- <hr />
56858
- OR
56859
- <hr />
56860
- </div>
56861
-
56862
- <!-- Email + Password form -->
56863
- <div class="tab-content active" id="tab-email">
56864
- <form method="POST" action="/auth/login">
56865
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56866
- <div class="field">
56867
- <label for="email">Sign in with email:</label>
56868
- <input type="email" id="email" name="email" required autocomplete="email" />
56869
- </div>
56870
- <div class="field">
56871
- <label for="password">Your password:</label>
56872
- <input type="password" id="password" name="password" required autocomplete="current-password" />
56873
- </div>
56874
- <button type="submit" class="btn btn-primary">Continue</button>
56875
- </form>
56876
- </div>
56877
-
56878
- <!-- SSO form (shown when "Continue with SSO" is clicked) -->
56879
- <div class="tab-content" id="tab-sso">
56880
- <form method="POST" action="/auth/sso">
56881
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56882
- <div class="field">
56883
- <label for="sso-email">Work email:</label>
56884
- <input type="email" id="sso-email" name="email" required autocomplete="email" />
56885
- </div>
56886
- <button type="submit" class="btn btn-primary">Continue with SSO</button>
56887
- </form>
56888
- <div class="tab-switch">
56889
- <a id="back-to-email">Sign in with email instead</a>
56890
- </div>
56891
- </div>
56892
-
56893
- <div style="flex:1"></div>
56894
-
56895
- <script>
56896
- var ssoBtn = document.getElementById('sso-toggle-btn');
56897
- var tabEmail = document.getElementById('tab-email');
56898
- var tabSso = document.getElementById('tab-sso');
56899
- var ssoWrapper = document.getElementById('sso-button-wrapper');
56900
- var lineOr = document.querySelector('.line-or');
56901
- var backLink = document.getElementById('back-to-email');
56902
-
56903
- ssoBtn.addEventListener('click', function() {
56904
- tabEmail.classList.remove('active');
56905
- tabSso.classList.add('active');
56906
- ssoWrapper.style.display = 'none';
56907
- lineOr.style.display = 'none';
56908
- document.getElementById('sso-email').focus();
56909
- });
56910
-
56911
- backLink.addEventListener('click', function() {
56912
- tabSso.classList.remove('active');
56913
- tabEmail.classList.add('active');
56914
- ssoWrapper.style.display = '';
56915
- lineOr.style.display = '';
56916
- });
56917
- </script>
56918
- </div>
56919
- </body>
56920
- </html>`;
56921
- }
56922
- function escapeHtml(str) {
56923
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
56924
- }
56925
- var TEAM_SELECTION_TTL, ACCESS_TOKEN_TTL;
56276
+ var ACCESS_TOKEN_TTL;
56926
56277
  var init_auth2 = __esm(() => {
56927
56278
  init_errors4();
56928
- TEAM_SELECTION_TTL = 10 * 60 * 1000;
56929
56279
  ACCESS_TOKEN_TTL = 7 * 24 * 3600;
56930
56280
  });
56931
56281
 
@@ -57030,7 +56380,6 @@ var exports_http = {};
57030
56380
  __export(exports_http, {
57031
56381
  startHttpServer: () => startHttpServer
57032
56382
  });
57033
- import express8 from "express";
57034
56383
  function jwtClaims2(jwt2) {
57035
56384
  try {
57036
56385
  return JSON.parse(Buffer.from(jwt2.split(".")[1], "base64url").toString());
@@ -57087,18 +56436,6 @@ async function startHttpServer(options) {
57087
56436
  app.get("/auth/callback", (req, res) => {
57088
56437
  provider.handleAuthCallback(req, res);
57089
56438
  });
57090
- app.post("/auth/google", express8.urlencoded({ extended: false }), (req, res) => {
57091
- provider.handleGoogleLogin(req, res);
57092
- });
57093
- app.post("/auth/login", express8.urlencoded({ extended: false }), (req, res) => {
57094
- provider.handleEmailPasswordLogin(req, res);
57095
- });
57096
- app.post("/auth/sso", express8.urlencoded({ extended: false }), (req, res) => {
57097
- provider.handleSSOLogin(req, res);
57098
- });
57099
- app.post("/team-select", express8.urlencoded({ extended: false }), (req, res) => {
57100
- provider.handleTeamSelection(req, res);
57101
- });
57102
56439
  app.get("/health", (_req, res) => {
57103
56440
  res.json({
57104
56441
  status: "ok",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoa/mcp",
3
- "version": "0.5.4-rc.1",
3
+ "version": "0.5.4",
4
4
  "description": "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",