powerautomate-mcp 0.7.2 → 0.7.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.
package/dist/index.js CHANGED
@@ -1041,6 +1041,19 @@ async function createWamAuthProvider(config, silentOnly = false) {
1041
1041
  const result = await acquireToken(SCOPES.FLOW);
1042
1042
  return result.accessToken;
1043
1043
  },
1044
+ async tryGetTokenForResourceSilent(resource) {
1045
+ try {
1046
+ validateHttpsUrl(resource, "Token resource");
1047
+ const url = new URL(resource);
1048
+ if (!isAllowedTokenDomain(url.hostname)) return null;
1049
+ if (!currentAccount) return null;
1050
+ const scopes = [`${resource}/.default`];
1051
+ const result = await pca.acquireTokenSilent({ scopes, account: currentAccount });
1052
+ return result.accessToken;
1053
+ } catch {
1054
+ return null;
1055
+ }
1056
+ },
1044
1057
  async getTokenForResource(resource) {
1045
1058
  validateHttpsUrl(resource, "Token resource");
1046
1059
  const url = new URL(resource);
@@ -14857,6 +14870,26 @@ async function createDeviceCodeAuthProvider(config, silentOnly = false) {
14857
14870
  const result = await acquireToken(scopes);
14858
14871
  return result.accessToken;
14859
14872
  },
14873
+ async tryGetTokenForResourceSilent(resource) {
14874
+ try {
14875
+ validateHttpsUrl(resource, "Token resource");
14876
+ const url = new URL(resource);
14877
+ if (!isAllowedTokenDomain(url.hostname)) {
14878
+ return null;
14879
+ }
14880
+ if (!currentAccount) {
14881
+ return null;
14882
+ }
14883
+ const scopes = [`${resource}/.default`];
14884
+ const result = await pca.acquireTokenSilent({
14885
+ scopes,
14886
+ account: currentAccount
14887
+ });
14888
+ return result.accessToken;
14889
+ } catch {
14890
+ return null;
14891
+ }
14892
+ },
14860
14893
  async logout() {
14861
14894
  if (currentAccount) {
14862
14895
  const cache = pca.getTokenCache();
@@ -14952,18 +14985,21 @@ var REQUIRED_RESOURCE_ACCESS = [
14952
14985
  ]
14953
14986
  },
14954
14987
  {
14955
- resourceAppId: "00000007-0000-0000-c000-000000000000",
14988
+ resourceAppId: "475226c6-020e-4fb2-8a90-7a972cbfc1d4",
14956
14989
  resourceAccess: [
14957
- { id: "78ce3f0f-a1ce-49c2-8cde-64b5c0896db4", type: "Scope" }
14990
+ { id: "a4c50e78-6978-4ce3-b1c0-965c1f9b1128", type: "Scope" }
14958
14991
  ]
14959
14992
  },
14960
14993
  {
14961
- // Business Application Platform (BAP) API — required for environment
14962
- // discovery and Power Platform admin operations
14963
14994
  resourceAppId: "0e0bf3cc-3078-4fd4-9ef3-cb6dc0245b10",
14964
14995
  resourceAccess: [
14965
14996
  { id: "4ae1bf56-f562-4747-b7bc-2fa0874ed46f", type: "Scope" }
14966
- // user_impersonation
14997
+ ]
14998
+ },
14999
+ {
15000
+ resourceAppId: "00000007-0000-0000-c000-000000000000",
15001
+ resourceAccess: [
15002
+ { id: "78ce3f0f-a1ce-49c2-8cde-64b5c0896db4", type: "Scope" }
14967
15003
  ]
14968
15004
  }
14969
15005
  ];
@@ -15266,15 +15302,15 @@ async function runSetupWizard() {
15266
15302
  print(` ${icons.check} ${c.green}Signed in${c.reset}`);
15267
15303
  }
15268
15304
  const additionalResources = [
15269
- "https://api.bap.microsoft.com",
15270
- "https://service.powerapps.com"
15305
+ { url: "https://service.powerapps.com", label: "PowerApps (connections)" },
15306
+ { url: "https://api.bap.microsoft.com", label: "Admin API (environments)" }
15271
15307
  ];
15272
- for (const resource of additionalResources) {
15273
- try {
15274
- await authProvider.getTokenForResource(resource);
15275
- print(` ${icons.check} ${c.dim}Authorized ${resource.replace("https://", "")}${c.reset}`);
15276
- } catch {
15277
- print(` ${c.dim}${icons.warn} Could not authorize ${resource.replace("https://", "")} (admin tools may be limited)${c.reset}`);
15308
+ for (const { url, label } of additionalResources) {
15309
+ const token = authProvider.tryGetTokenForResourceSilent ? await authProvider.tryGetTokenForResourceSilent(url) : null;
15310
+ if (token) {
15311
+ print(` ${icons.check} ${c.dim}${label}: authorized${c.reset}`);
15312
+ } else {
15313
+ print(` ${c.dim}${icons.info || "-"} ${label}: will be authorized via admin consent (Step 3)${c.reset}`);
15278
15314
  }
15279
15315
  }
15280
15316
  } catch (error) {