@kadoa/mcp 0.5.0 → 0.5.3-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +39 -685
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50260,6 +50260,8 @@ function deriveStatusLabel(workflow) {
50260
50260
  return "Scheduled";
50261
50261
  case "RUNNING":
50262
50262
  return "Running";
50263
+ case "VALIDATING":
50264
+ return "Validating";
50263
50265
  case "FAILED":
50264
50266
  return "Failed";
50265
50267
  case "PAUSED":
@@ -50771,7 +50773,7 @@ function registerTools(server, ctx) {
50771
50773
  });
50772
50774
  }));
50773
50775
  server.registerTool("fetch_data", {
50774
- description: "Get extracted data from a workflow. Data is only available after the workflow run has completed (displayState is no longer RUNNING). Do NOT poll or sleep-wait for completion.",
50776
+ description: "Get extracted data from a workflow. 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.",
50775
50777
  inputSchema: {
50776
50778
  workflowId: exports_external.string().describe("The workflow ID"),
50777
50779
  limit: exports_external.preprocess(coerceNumber(), exports_external.number()).optional().describe("Maximum number of records to return"),
@@ -51498,7 +51500,7 @@ var package_default;
51498
51500
  var init_package = __esm(() => {
51499
51501
  package_default = {
51500
51502
  name: "@kadoa/mcp",
51501
- version: "0.5.0",
51503
+ version: "0.5.3-rc.1",
51502
51504
  description: "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
51503
51505
  type: "module",
51504
51506
  main: "dist/index.js",
@@ -55540,6 +55542,10 @@ function generatePKCE() {
55540
55542
  const challenge = createHash2("sha256").update(verifier).digest("base64url");
55541
55543
  return { verifier, challenge };
55542
55544
  }
55545
+ function kadoaAuthUrl() {
55546
+ const raw = process.env.KADOA_AUTH_URL || "https://auth.kadoa.com";
55547
+ return raw.replace(/\/+$/, "");
55548
+ }
55543
55549
  function jwtClaims(jwt2) {
55544
55550
  try {
55545
55551
  const payload = JSON.parse(Buffer.from(jwt2.split(".")[1], "base64url").toString());
@@ -55552,76 +55558,6 @@ function jwtClaims(jwt2) {
55552
55558
  return {};
55553
55559
  }
55554
55560
  }
55555
- async function exchangeSupabaseCode(code, codeVerifier) {
55556
- const supabaseUrl = process.env.SUPABASE_URL;
55557
- if (!supabaseUrl)
55558
- throw new Error("SUPABASE_URL is not configured");
55559
- const res = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=pkce`, {
55560
- method: "POST",
55561
- headers: {
55562
- "Content-Type": "application/json",
55563
- apikey: process.env.SUPABASE_ANON_KEY
55564
- },
55565
- body: JSON.stringify({ auth_code: code, code_verifier: codeVerifier })
55566
- });
55567
- if (!res.ok) {
55568
- const body = await res.text();
55569
- throw new Error(`Supabase token exchange failed (${res.status}): ${body}`);
55570
- }
55571
- const data = await res.json();
55572
- return { accessToken: data.access_token, refreshToken: data.refresh_token };
55573
- }
55574
- async function fetchUserTeams(supabaseJwt) {
55575
- const kadoaApiUrl = process.env.KADOA_PUBLIC_API_URI || "https://api.kadoa.com";
55576
- const userRes = await fetch(`${kadoaApiUrl}/v4/user`, {
55577
- headers: { Authorization: `Bearer ${supabaseJwt}` }
55578
- });
55579
- if (!userRes.ok) {
55580
- const body = await userRes.text();
55581
- throw new Error(`Kadoa /v4/user failed (${userRes.status}): ${body}`);
55582
- }
55583
- const userData = await userRes.json();
55584
- if (!userData.teams?.length) {
55585
- throw new Error("User has no teams");
55586
- }
55587
- return userData.teams.map((t) => ({
55588
- id: t.id,
55589
- name: t.name,
55590
- memberRole: t.memberRole
55591
- }));
55592
- }
55593
- async function setActiveTeamAndRefresh(jwt2, refreshToken, teamId) {
55594
- const kadoaApiUrl = process.env.KADOA_PUBLIC_API_URI || "https://api.kadoa.com";
55595
- const supabaseUrl = process.env.SUPABASE_URL;
55596
- if (!supabaseUrl)
55597
- throw new Error("SUPABASE_URL is not configured");
55598
- const setRes = await fetch(`${kadoaApiUrl}/v5/auth/active-team`, {
55599
- method: "POST",
55600
- headers: {
55601
- "Content-Type": "application/json",
55602
- Authorization: `Bearer ${jwt2}`
55603
- },
55604
- body: JSON.stringify({ teamId })
55605
- });
55606
- if (!setRes.ok) {
55607
- const body = await setRes.text();
55608
- throw new Error(`POST /v5/auth/active-team failed (${setRes.status}): ${body}`);
55609
- }
55610
- const refreshRes = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=refresh_token`, {
55611
- method: "POST",
55612
- headers: {
55613
- "Content-Type": "application/json",
55614
- apikey: process.env.SUPABASE_ANON_KEY
55615
- },
55616
- body: JSON.stringify({ refresh_token: refreshToken })
55617
- });
55618
- if (!refreshRes.ok) {
55619
- const body = await refreshRes.text();
55620
- throw new Error(`Supabase token refresh failed (${refreshRes.status}): ${body}`);
55621
- }
55622
- const data = await refreshRes.json();
55623
- return { jwt: data.access_token, refreshToken: data.refresh_token };
55624
- }
55625
55561
 
55626
55562
  class KadoaOAuthProvider {
55627
55563
  store;
@@ -55647,151 +55583,23 @@ class KadoaOAuthProvider {
55647
55583
  };
55648
55584
  }
55649
55585
  async authorize(client, params, res) {
55650
- const supabaseUrl = process.env.SUPABASE_URL;
55651
55586
  const serverUrl = process.env.MCP_SERVER_URL;
55652
- if (!supabaseUrl || !serverUrl) {
55653
- throw new Error("SUPABASE_URL and MCP_SERVER_URL must be configured");
55654
- }
55587
+ if (!serverUrl)
55588
+ throw new Error("MCP_SERVER_URL must be configured");
55655
55589
  const state = randomToken();
55656
55590
  const { verifier, challenge } = generatePKCE();
55657
55591
  await this.store.set("pending_auths", state, {
55658
55592
  client,
55659
55593
  params,
55660
- supabaseCodeVerifier: verifier
55594
+ mcpVerifier: verifier
55661
55595
  }, 600);
55662
- res.type("html").send(renderLoginPage(state));
55663
- }
55664
- async handleGoogleLogin(req, res) {
55665
- const { state } = req.body;
55666
- const pending = await this.store.get("pending_auths", state);
55667
- if (!pending) {
55668
- res.status(400).send("Unknown or expired state parameter");
55669
- return;
55670
- }
55671
- const supabaseUrl = process.env.SUPABASE_URL;
55672
- const serverUrl = process.env.MCP_SERVER_URL;
55673
- if (!supabaseUrl || !serverUrl) {
55674
- res.status(500).send("Server misconfigured");
55675
- return;
55676
- }
55677
- const redirectTo = `${serverUrl}/auth/callback?mcp_state=${state}`;
55678
- const authUrl = new URL(`${supabaseUrl}/auth/v1/authorize`);
55679
- authUrl.searchParams.set("provider", "google");
55680
- authUrl.searchParams.set("redirect_to", redirectTo);
55681
- authUrl.searchParams.set("code_challenge", pending.supabaseCodeVerifier ? createHash2("sha256").update(pending.supabaseCodeVerifier).digest("base64url") : "");
55596
+ const authUrl = new URL(`${kadoaAuthUrl()}/login`);
55597
+ authUrl.searchParams.set("callback_url", `${serverUrl}/auth/callback`);
55598
+ authUrl.searchParams.set("state", state);
55599
+ authUrl.searchParams.set("code_challenge", challenge);
55682
55600
  authUrl.searchParams.set("code_challenge_method", "S256");
55683
55601
  res.redirect(authUrl.toString());
55684
55602
  }
55685
- async handleEmailPasswordLogin(req, res) {
55686
- const { state, email: email3, password } = req.body;
55687
- if (!state || !email3 || !password) {
55688
- res.status(400).send("Missing required fields");
55689
- return;
55690
- }
55691
- const pending = await this.store.get("pending_auths", state);
55692
- if (!pending) {
55693
- res.status(400).type("html").send(renderLoginPage(state, "Session expired — please try again"));
55694
- return;
55695
- }
55696
- const supabaseUrl = process.env.SUPABASE_URL;
55697
- if (!supabaseUrl) {
55698
- res.status(500).send("Server misconfigured");
55699
- return;
55700
- }
55701
- try {
55702
- const tokenRes = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=password`, {
55703
- method: "POST",
55704
- headers: {
55705
- "Content-Type": "application/json",
55706
- apikey: process.env.SUPABASE_ANON_KEY
55707
- },
55708
- body: JSON.stringify({ email: email3, password })
55709
- });
55710
- if (!tokenRes.ok) {
55711
- const body = await tokenRes.json().catch(() => ({ error_description: "Authentication failed" }));
55712
- const message = body.error_description || body.msg || "Invalid email or password";
55713
- res.type("html").send(renderLoginPage(state, message));
55714
- return;
55715
- }
55716
- const data = await tokenRes.json();
55717
- await this.store.del("pending_auths", state);
55718
- await this.completeAuthWithTokens(pending, res, data.access_token, data.refresh_token);
55719
- } catch (error48) {
55720
- console.error("Email/password login error:", error48);
55721
- res.type("html").send(renderLoginPage(state, "An unexpected error occurred"));
55722
- }
55723
- }
55724
- async handleSSOLogin(req, res) {
55725
- const { state, email: email3 } = req.body;
55726
- if (!state || !email3) {
55727
- res.status(400).send("Missing required fields");
55728
- return;
55729
- }
55730
- const pending = await this.store.get("pending_auths", state);
55731
- if (!pending) {
55732
- res.status(400).type("html").send(renderLoginPage(state, "Session expired — please try again"));
55733
- return;
55734
- }
55735
- const supabaseUrl = process.env.SUPABASE_URL;
55736
- const serverUrl = process.env.MCP_SERVER_URL;
55737
- if (!supabaseUrl || !serverUrl) {
55738
- res.status(500).send("Server misconfigured");
55739
- return;
55740
- }
55741
- const domain2 = email3.includes("@") ? email3.split("@").pop() : email3;
55742
- try {
55743
- const ssoRes = await fetch(`${supabaseUrl}/auth/v1/sso`, {
55744
- method: "POST",
55745
- headers: {
55746
- "Content-Type": "application/json",
55747
- apikey: process.env.SUPABASE_ANON_KEY
55748
- },
55749
- body: JSON.stringify({
55750
- domain: domain2,
55751
- redirect_to: `${serverUrl}/auth/callback?mcp_state=${state}`,
55752
- skip_http_redirect: true,
55753
- code_challenge: createHash2("sha256").update(pending.supabaseCodeVerifier).digest("base64url"),
55754
- code_challenge_method: "s256"
55755
- })
55756
- });
55757
- if (!ssoRes.ok) {
55758
- const body = await ssoRes.json().catch(() => ({}));
55759
- const message = body.error_description || body.msg || body.message || "No SSO provider configured for this domain";
55760
- res.type("html").send(renderLoginPage(state, message));
55761
- return;
55762
- }
55763
- const data = await ssoRes.json();
55764
- if (!data.url) {
55765
- res.type("html").send(renderLoginPage(state, "No SSO provider configured for this domain"));
55766
- return;
55767
- }
55768
- res.redirect(data.url);
55769
- } catch (error48) {
55770
- console.error("SSO login error:", error48);
55771
- res.type("html").send(renderLoginPage(state, "An unexpected error occurred"));
55772
- }
55773
- }
55774
- async completeAuthWithTokens(pending, res, supabaseJwt, supabaseRefreshToken) {
55775
- const teams = await fetchUserTeams(supabaseJwt);
55776
- if (teams.length === 1) {
55777
- const refreshed = await setActiveTeamAndRefresh(supabaseJwt, supabaseRefreshToken, teams[0].id);
55778
- await this.completeAuthFlow(pending, res, {
55779
- jwt: refreshed.jwt,
55780
- refreshToken: refreshed.refreshToken,
55781
- teamId: teams[0].id
55782
- });
55783
- return;
55784
- }
55785
- const selectionToken = randomToken();
55786
- await this.store.set("pending_team_selections", selectionToken, {
55787
- supabaseJwt,
55788
- supabaseRefreshToken,
55789
- teams,
55790
- pending,
55791
- expiresAt: Date.now() + TEAM_SELECTION_TTL
55792
- }, 600);
55793
- res.type("html").send(renderTeamSelectionPage(teams, selectionToken));
55794
- }
55795
55603
  async challengeForAuthorizationCode(_client, authorizationCode) {
55796
55604
  const entry = await this.store.get("auth_codes", authorizationCode);
55797
55605
  if (!entry)
@@ -55916,9 +55724,9 @@ class KadoaOAuthProvider {
55916
55724
  };
55917
55725
  }
55918
55726
  async handleAuthCallback(req, res) {
55919
- const { code, mcp_state: state } = req.query;
55727
+ const { code, state } = req.query;
55920
55728
  if (!code || !state) {
55921
- res.status(400).send("Missing code or mcp_state parameter");
55729
+ res.status(400).send("Missing code or state parameter");
55922
55730
  return;
55923
55731
  }
55924
55732
  const pending = await this.store.get("pending_auths", state);
@@ -55928,10 +55736,28 @@ class KadoaOAuthProvider {
55928
55736
  }
55929
55737
  await this.store.del("pending_auths", state);
55930
55738
  try {
55931
- const supabaseTokens = await exchangeSupabaseCode(code, pending.supabaseCodeVerifier);
55932
- await this.completeAuthWithTokens(pending, res, supabaseTokens.accessToken, supabaseTokens.refreshToken);
55739
+ const tokenRes = await fetch(`${kadoaAuthUrl()}/api/token`, {
55740
+ method: "POST",
55741
+ headers: { "Content-Type": "application/json" },
55742
+ body: JSON.stringify({ code, code_verifier: pending.mcpVerifier })
55743
+ });
55744
+ if (!tokenRes.ok) {
55745
+ const body = await tokenRes.text().catch(() => "");
55746
+ throw new Error(`auth.kadoa.com /api/token failed (${tokenRes.status}): ${body}`);
55747
+ }
55748
+ const data = await tokenRes.json();
55749
+ if (typeof data?.access_token !== "string" || typeof data?.refresh_token !== "string" || typeof data?.team_id !== "string") {
55750
+ throw new Error("auth.kadoa.com /api/token returned malformed response");
55751
+ }
55752
+ const claims = jwtClaims(data.access_token);
55753
+ console.error(`[AUTH] CALLBACK_OK: tokens received (email=${claims.email}, team=${data.team_id})`);
55754
+ await this.completeAuthFlow(pending, res, {
55755
+ jwt: data.access_token,
55756
+ refreshToken: data.refresh_token,
55757
+ teamId: data.team_id
55758
+ });
55933
55759
  } catch (error48) {
55934
- console.error("Auth callback error:", error48);
55760
+ console.error("[AUTH] CALLBACK_FAIL:", error48);
55935
55761
  const redirectUrl = new URL(pending.params.redirectUri);
55936
55762
  redirectUrl.searchParams.set("error", "server_error");
55937
55763
  redirectUrl.searchParams.set("error_description", error48 instanceof Error ? error48.message : "Authentication failed");
@@ -55941,45 +55767,6 @@ class KadoaOAuthProvider {
55941
55767
  res.redirect(redirectUrl.toString());
55942
55768
  }
55943
55769
  }
55944
- async handleTeamSelection(req, res) {
55945
- const { token, teamId } = req.body;
55946
- if (!token || !teamId) {
55947
- res.status(400).send("Missing token or teamId");
55948
- return;
55949
- }
55950
- const entry = await this.store.get("pending_team_selections", token);
55951
- if (!entry) {
55952
- res.status(400).send("Unknown or expired team selection token");
55953
- return;
55954
- }
55955
- if (entry.expiresAt < Date.now()) {
55956
- await this.store.del("pending_team_selections", token);
55957
- res.status(400).send("Team selection expired — please log in again");
55958
- return;
55959
- }
55960
- if (!entry.teams.some((t) => t.id === teamId)) {
55961
- res.status(403).send("Invalid team selection");
55962
- return;
55963
- }
55964
- await this.store.del("pending_team_selections", token);
55965
- try {
55966
- const refreshed = await setActiveTeamAndRefresh(entry.supabaseJwt, entry.supabaseRefreshToken, teamId);
55967
- await this.completeAuthFlow(entry.pending, res, {
55968
- jwt: refreshed.jwt,
55969
- refreshToken: refreshed.refreshToken,
55970
- teamId
55971
- });
55972
- } catch (error48) {
55973
- console.error("Team selection error:", error48);
55974
- const redirectUrl = new URL(entry.pending.params.redirectUri);
55975
- redirectUrl.searchParams.set("error", "server_error");
55976
- redirectUrl.searchParams.set("error_description", error48 instanceof Error ? error48.message : "Failed to set active team");
55977
- if (entry.pending.params.state) {
55978
- redirectUrl.searchParams.set("state", entry.pending.params.state);
55979
- }
55980
- res.redirect(redirectUrl.toString());
55981
- }
55982
- }
55983
55770
  async completeAuthFlow(pending, res, credentials) {
55984
55771
  const mcpCode = randomToken();
55985
55772
  await this.store.set("auth_codes", mcpCode, {
@@ -55999,429 +55786,9 @@ class KadoaOAuthProvider {
55999
55786
  res.redirect(redirectUrl.toString());
56000
55787
  }
56001
55788
  }
56002
- function renderTeamSelectionPage(teams, selectionToken) {
56003
- const teamButtons = teams.map((t) => `
56004
- <button type="submit" name="teamId" value="${t.id}" class="team-btn">
56005
- <span class="team-name">${escapeHtml(t.name)}</span>
56006
- ${t.memberRole ? `<span class="team-role">${escapeHtml(t.memberRole.toLowerCase())}</span>` : ""}
56007
- </button>`).join(`
56008
- `);
56009
- return `<!DOCTYPE html>
56010
- <html lang="en">
56011
- <head>
56012
- <meta charset="utf-8" />
56013
- <meta name="viewport" content="width=device-width, initial-scale=1" />
56014
- <title>Select Team - Kadoa</title>
56015
- <style>
56016
- * { margin: 0; padding: 0; box-sizing: border-box; }
56017
-
56018
- body {
56019
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
56020
- background: oklch(1 0 0);
56021
- color: oklch(0.17 0.02 228);
56022
- min-height: 100vh;
56023
- display: flex;
56024
- align-items: center;
56025
- justify-content: center;
56026
- }
56027
-
56028
- .container {
56029
- width: 100%;
56030
- max-width: 420px;
56031
- padding: 2rem;
56032
- }
56033
-
56034
- .logo {
56035
- text-align: center;
56036
- margin-bottom: 2rem;
56037
- }
56038
-
56039
- h1 {
56040
- font-size: 1.25rem;
56041
- font-weight: 600;
56042
- text-align: center;
56043
- margin-bottom: 0.5rem;
56044
- color: oklch(0.17 0.02 228);
56045
- }
56046
-
56047
- .subtitle {
56048
- text-align: center;
56049
- color: oklch(0.56 0.02 228);
56050
- font-size: 0.875rem;
56051
- margin-bottom: 1.5rem;
56052
- }
56053
-
56054
- .team-btn {
56055
- width: 100%;
56056
- display: flex;
56057
- align-items: center;
56058
- justify-content: space-between;
56059
- padding: 0.875rem 1rem;
56060
- margin-bottom: 0.5rem;
56061
- background: oklch(1 0 0);
56062
- border: 1px solid oklch(0.5 0.02 228 / 0.4);
56063
- border-radius: 0.3rem;
56064
- color: oklch(0.17 0.02 228);
56065
- font-size: 15px;
56066
- cursor: pointer;
56067
- transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
56068
- box-shadow: 0px 1px 1px 0px oklch(0.68 0.01 60.13 / 0.11);
56069
- }
56070
-
56071
- .team-btn:hover {
56072
- background: oklch(0.96 0 286);
56073
- border-color: oklch(0.7 0.18 42);
56074
- }
56075
-
56076
- .team-btn:active {
56077
- background: oklch(0.72 0.23 54 / 0.13);
56078
- }
56079
-
56080
- .team-name { font-weight: 500; }
56081
-
56082
- .team-role {
56083
- font-size: 13px;
56084
- color: oklch(0.56 0.02 228 / 0.67);
56085
- text-transform: capitalize;
56086
- }
56087
- </style>
56088
- </head>
56089
- <body>
56090
- <div class="container">
56091
- <div class="logo">
56092
- <svg width="108" height="32" viewBox="0 0 108 32" fill="none" xmlns="http://www.w3.org/2000/svg">
56093
- <g clip-path="url(#clip0)">
56094
- <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"/>
56095
- <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"/>
56096
- <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"/>
56097
- <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"/>
56098
- <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"/>
56099
- <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"/>
56100
- <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"/>
56101
- </g>
56102
- <defs><clipPath id="clip0"><rect width="108" height="32" fill="white"/></clipPath></defs>
56103
- </svg>
56104
- </div>
56105
- <h1>Select a team</h1>
56106
- <p class="subtitle">Choose which team to connect with this MCP session</p>
56107
- <form method="POST" action="/team-select">
56108
- <input type="hidden" name="token" value="${selectionToken}" />
56109
- ${teamButtons}
56110
- </form>
56111
- </div>
56112
- </body>
56113
- </html>`;
56114
- }
56115
- function renderLoginPage(state, error48) {
56116
- const errorHtml = error48 ? `<div class="error">${escapeHtml(error48)}</div>` : "";
56117
- return `<!DOCTYPE html>
56118
- <html lang="en">
56119
- <head>
56120
- <meta charset="utf-8" />
56121
- <meta name="viewport" content="width=device-width, initial-scale=1" />
56122
- <title>Sign In - Kadoa</title>
56123
- <style>
56124
- * { margin: 0; padding: 0; box-sizing: border-box; }
56125
-
56126
- body {
56127
- font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
56128
- background: hsl(0 0% 98%);
56129
- color: #18181b;
56130
- min-height: 100dvh;
56131
- display: flex;
56132
- align-items: center;
56133
- justify-content: center;
56134
- background-image: radial-gradient(circle, #d4d4d8 1px, transparent 1px);
56135
- background-size: 24px 24px;
56136
- background-position: center top;
56137
- }
56138
-
56139
- .card {
56140
- width: 100%;
56141
- max-width: 460px;
56142
- background: #fff;
56143
- padding: 1rem;
56144
- display: flex;
56145
- flex-direction: column;
56146
- gap: 1rem;
56147
- min-height: 100dvh;
56148
- }
56149
-
56150
- @media (min-width: 768px) {
56151
- .card { padding: 3rem; min-height: auto; border-left: 1px solid #e0e1e5; border-right: 1px solid #e0e1e5; }
56152
- }
56153
-
56154
- .logo { display: grid; place-content: center; }
56155
-
56156
- h1 {
56157
- font-size: 20px;
56158
- font-weight: 600;
56159
- text-align: center;
56160
- color: #18181b;
56161
- }
56162
-
56163
- .spacer { height: 0; }
56164
- @media (min-width: 768px) { .spacer { height: 3rem; } }
56165
-
56166
- .error {
56167
- background: #fef2f2;
56168
- color: #991b1b;
56169
- border: 1px solid #fecaca;
56170
- border-radius: 4px;
56171
- padding: 0.6rem 0.875rem;
56172
- font-size: 15px;
56173
- }
56174
-
56175
- /* Buttons — matching KUI default + primary looks */
56176
- .btn {
56177
- width: 100%;
56178
- padding: 0.6em 1em;
56179
- border-radius: 4px;
56180
- font-size: 16px;
56181
- font-weight: 500;
56182
- cursor: pointer;
56183
- display: flex;
56184
- align-items: center;
56185
- justify-content: center;
56186
- gap: 0.5rem;
56187
- transition: background 0.15s, border-color 0.15s;
56188
- text-decoration: none;
56189
- }
56190
-
56191
- .btn-default {
56192
- background: #fff;
56193
- color: #18181b;
56194
- border: 1px solid #d4d4d8;
56195
- 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);
56196
- }
56197
-
56198
- .btn-default:hover {
56199
- background: rgba(113,113,122,0.1);
56200
- }
56201
-
56202
- .btn-primary {
56203
- background: hsl(212 70% 27%);
56204
- color: #fff;
56205
- border: 1px solid hsl(214 70% 23%);
56206
- box-shadow: inset 0 2px 0 0 rgba(56,189,248,0.2), 0 -1px 0px 1px rgba(0,0,0,0.02);
56207
- }
56208
-
56209
- .btn-primary:hover {
56210
- background: hsl(212 70% 33%);
56211
- }
56212
-
56213
- /* OR divider */
56214
- .line-or {
56215
- display: flex;
56216
- align-items: center;
56217
- gap: 0.5rem;
56218
- font-weight: 500;
56219
- color: rgba(24,24,27,0.6);
56220
- font-size: 14px;
56221
- margin: 0.5rem 0;
56222
- }
56223
-
56224
- .line-or hr {
56225
- flex: 1;
56226
- border: none;
56227
- border-top: 1px solid rgba(113,113,122,0.15);
56228
- }
56229
-
56230
- /* Form inputs — matching KUI input style */
56231
- label {
56232
- display: block;
56233
- font-size: 16px;
56234
- font-weight: 500;
56235
- margin-bottom: 0.25rem;
56236
- color: #18181b;
56237
- }
56238
-
56239
- input[type="email"], input[type="password"] {
56240
- width: 100%;
56241
- padding: 0.35em 0.5em;
56242
- border: 1px solid #d4d4d8;
56243
- border-radius: 4px;
56244
- font-size: 18px;
56245
- font-family: inherit;
56246
- color: #18181b;
56247
- background: #fff;
56248
- outline: none;
56249
- box-shadow: inset 0 3px 0 0 rgba(0,0,0,0.025);
56250
- transition: border-color 0.15s;
56251
- caret-color: hsl(25 98% 53%);
56252
- }
56253
-
56254
- input[type="email"]:hover, input[type="password"]:hover {
56255
- border-color: hsl(31 99% 72%);
56256
- }
56257
-
56258
- input[type="email"]:focus, input[type="password"]:focus {
56259
- border-color: hsl(25 98% 53%);
56260
- box-shadow: inset 0 3px 0 0 rgba(0,0,0,0.025), 0 0 0 2px rgba(249,115,22,0.2);
56261
- }
56262
-
56263
- .field { margin-bottom: 0.75rem; }
56264
-
56265
- hr.separator {
56266
- border: none;
56267
- border-top: 1px solid rgba(113,113,122,0.15);
56268
- margin: 0.5rem 0;
56269
- }
56270
-
56271
- .google-icon { width: 18px; height: 18px; }
56272
- .key-icon { width: 16px; height: 16px; }
56273
-
56274
- /* Tabs for email/SSO — keep simple, same visual weight */
56275
- .tabs {
56276
- display: none;
56277
- }
56278
-
56279
- .tab-content { display: none; }
56280
- .tab-content.active { display: block; }
56281
-
56282
- .tab-switch {
56283
- text-align: center;
56284
- margin-top: 0.25rem;
56285
- }
56286
-
56287
- .tab-switch a {
56288
- font-size: 15px;
56289
- color: #18181b;
56290
- text-decoration: underline;
56291
- text-decoration-color: rgba(251,146,60,0.5);
56292
- text-underline-offset: 2px;
56293
- cursor: pointer;
56294
- }
56295
-
56296
- .tab-switch a:hover {
56297
- background: rgba(251,146,60,0.1);
56298
- border-radius: 2px;
56299
- }
56300
- </style>
56301
- </head>
56302
- <body>
56303
- <div class="card">
56304
- <!-- Logo {k} -->
56305
- <div class="logo">
56306
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
56307
- <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"/>
56308
- <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"/>
56309
- <path d="M16 10V29" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56310
- <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"/>
56311
- <path d="M16 23L25 18" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56312
- <path d="M25 29L16 23" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"/>
56313
- </svg>
56314
- </div>
56315
-
56316
- <!-- Heading -->
56317
- <h1>Sign in to Kadoa</h1>
56318
-
56319
- <div class="spacer"></div>
56320
-
56321
- ${errorHtml}
56322
-
56323
- <!-- Continue with Google -->
56324
- <form method="POST" action="/auth/google">
56325
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56326
- <button type="submit" class="btn btn-default">
56327
- <svg class="google-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
56328
- <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"/>
56329
- <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"/>
56330
- <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"/>
56331
- <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"/>
56332
- </svg>
56333
- Continue with Google
56334
- </button>
56335
- </form>
56336
-
56337
- <!-- Continue with SSO -->
56338
- <div id="sso-button-wrapper">
56339
- <form method="POST" action="/auth/sso" id="sso-direct-form" style="display:none">
56340
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56341
- <input type="hidden" name="email" id="sso-email-hidden" />
56342
- </form>
56343
- <button type="button" class="btn btn-default" id="sso-toggle-btn">
56344
- <svg class="key-icon" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
56345
- <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"/>
56346
- </svg>
56347
- Continue with SSO
56348
- </button>
56349
- </div>
56350
-
56351
- <!-- OR divider -->
56352
- <div class="line-or">
56353
- <hr />
56354
- OR
56355
- <hr />
56356
- </div>
56357
-
56358
- <!-- Email + Password form -->
56359
- <div class="tab-content active" id="tab-email">
56360
- <form method="POST" action="/auth/login">
56361
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56362
- <div class="field">
56363
- <label for="email">Sign in with email:</label>
56364
- <input type="email" id="email" name="email" required autocomplete="email" />
56365
- </div>
56366
- <div class="field">
56367
- <label for="password">Your password:</label>
56368
- <input type="password" id="password" name="password" required autocomplete="current-password" />
56369
- </div>
56370
- <button type="submit" class="btn btn-primary">Continue</button>
56371
- </form>
56372
- </div>
56373
-
56374
- <!-- SSO form (shown when "Continue with SSO" is clicked) -->
56375
- <div class="tab-content" id="tab-sso">
56376
- <form method="POST" action="/auth/sso">
56377
- <input type="hidden" name="state" value="${escapeHtml(state)}" />
56378
- <div class="field">
56379
- <label for="sso-email">Work email:</label>
56380
- <input type="email" id="sso-email" name="email" required autocomplete="email" />
56381
- </div>
56382
- <button type="submit" class="btn btn-primary">Continue with SSO</button>
56383
- </form>
56384
- <div class="tab-switch">
56385
- <a id="back-to-email">Sign in with email instead</a>
56386
- </div>
56387
- </div>
56388
-
56389
- <div style="flex:1"></div>
56390
-
56391
- <script>
56392
- var ssoBtn = document.getElementById('sso-toggle-btn');
56393
- var tabEmail = document.getElementById('tab-email');
56394
- var tabSso = document.getElementById('tab-sso');
56395
- var ssoWrapper = document.getElementById('sso-button-wrapper');
56396
- var lineOr = document.querySelector('.line-or');
56397
- var backLink = document.getElementById('back-to-email');
56398
-
56399
- ssoBtn.addEventListener('click', function() {
56400
- tabEmail.classList.remove('active');
56401
- tabSso.classList.add('active');
56402
- ssoWrapper.style.display = 'none';
56403
- lineOr.style.display = 'none';
56404
- document.getElementById('sso-email').focus();
56405
- });
56406
-
56407
- backLink.addEventListener('click', function() {
56408
- tabSso.classList.remove('active');
56409
- tabEmail.classList.add('active');
56410
- ssoWrapper.style.display = '';
56411
- lineOr.style.display = '';
56412
- });
56413
- </script>
56414
- </div>
56415
- </body>
56416
- </html>`;
56417
- }
56418
- function escapeHtml(str) {
56419
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
56420
- }
56421
- var TEAM_SELECTION_TTL, ACCESS_TOKEN_TTL;
55789
+ var ACCESS_TOKEN_TTL;
56422
55790
  var init_auth2 = __esm(() => {
56423
55791
  init_errors4();
56424
- TEAM_SELECTION_TTL = 10 * 60 * 1000;
56425
55792
  ACCESS_TOKEN_TTL = 7 * 24 * 3600;
56426
55793
  });
56427
55794
 
@@ -56526,7 +55893,6 @@ var exports_http = {};
56526
55893
  __export(exports_http, {
56527
55894
  startHttpServer: () => startHttpServer
56528
55895
  });
56529
- import express8 from "express";
56530
55896
  function jwtClaims2(jwt2) {
56531
55897
  try {
56532
55898
  return JSON.parse(Buffer.from(jwt2.split(".")[1], "base64url").toString());
@@ -56583,18 +55949,6 @@ async function startHttpServer(options) {
56583
55949
  app.get("/auth/callback", (req, res) => {
56584
55950
  provider.handleAuthCallback(req, res);
56585
55951
  });
56586
- app.post("/auth/google", express8.urlencoded({ extended: false }), (req, res) => {
56587
- provider.handleGoogleLogin(req, res);
56588
- });
56589
- app.post("/auth/login", express8.urlencoded({ extended: false }), (req, res) => {
56590
- provider.handleEmailPasswordLogin(req, res);
56591
- });
56592
- app.post("/auth/sso", express8.urlencoded({ extended: false }), (req, res) => {
56593
- provider.handleSSOLogin(req, res);
56594
- });
56595
- app.post("/team-select", express8.urlencoded({ extended: false }), (req, res) => {
56596
- provider.handleTeamSelection(req, res);
56597
- });
56598
55952
  app.get("/health", (_req, res) => {
56599
55953
  res.json({
56600
55954
  status: "ok",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoa/mcp",
3
- "version": "0.5.0",
3
+ "version": "0.5.3-rc.1",
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",