@carrierllc/mcp 0.2.12 → 0.2.13

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 CHANGED
@@ -6963,11 +6963,36 @@ var PROJECTS_TOOLS = [
6963
6963
  handler: async (env, props2) => {
6964
6964
  const sub = props2.sub;
6965
6965
  const orgId = props2.org_id;
6966
- const tokenKey = orgId ? `org:${orgId}` : `user:${sub}`;
6967
- const record = await env.CARRIER_USERS.get(tokenKey, "json").catch(() => null);
6968
- const hasToken = !!(record && ("esimvault_token_enc" in record && record.esimvault_token_enc || orgId && "esimvault_token_enc" in (record ?? {})));
6966
+ if (!env.CARRIER_USERS) {
6967
+ return {
6968
+ credentials: {
6969
+ esimvault_token: {
6970
+ present: true,
6971
+ encrypted: false,
6972
+ last_updated: null,
6973
+ age_days: null,
6974
+ rotation_recommended: false,
6975
+ source: "env-var (stdio)"
6976
+ },
6977
+ oauth: { active: false, method: props2.auth_method ?? "stdio" }
6978
+ },
6979
+ environment: {
6980
+ org_id: orgId ?? null,
6981
+ reseller_id: props2.reseller_id,
6982
+ reseller_name: props2.reseller_name
6983
+ },
6984
+ recommendations: ["stdio mode \u2014 token managed via ESIMVAULT_API_TOKEN env var, no rotation tracking"]
6985
+ };
6986
+ }
6987
+ const primaryKey = orgId ? `org:${orgId}` : `user:clerk_${sub}`;
6988
+ const legacyKey = orgId ? null : `user:${sub}`;
6989
+ let record = await env.CARRIER_USERS.get(primaryKey, "json").catch(() => null);
6990
+ if (!record && legacyKey) {
6991
+ record = await env.CARRIER_USERS.get(legacyKey, "json").catch(() => null);
6992
+ }
6993
+ const hasToken = !!(record && "esimvault_token_enc" in record && record.esimvault_token_enc);
6969
6994
  const oauthKey = `oauth:grant:${sub}`;
6970
- const oauthGrant = await env.OAUTH_KV.get(oauthKey, "json").catch(() => null);
6995
+ const oauthGrant = env.OAUTH_KV ? await env.OAUTH_KV.get(oauthKey, "json").catch(() => null) : null;
6971
6996
  const updatedAt = record && "updated_at" in record ? record.updated_at : null;
6972
6997
  let tokenAgeDays = null;
6973
6998
  if (updatedAt) {