powerautomate-mcp 0.7.0 → 0.7.2
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 +44 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -259,7 +259,7 @@ function createChildLogger(bindings) {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
// src/utils/constants.ts
|
|
262
|
-
var POWER_PLATFORM_API_BASE = "https://api.
|
|
262
|
+
var POWER_PLATFORM_API_BASE = "https://api.bap.microsoft.com";
|
|
263
263
|
var FLOW_API_BASE = "https://api.flow.microsoft.com";
|
|
264
264
|
var POWERAPPS_API_BASE = "https://api.powerapps.com";
|
|
265
265
|
var POWER_PLATFORM_API_VERSION = "2022-03-01-preview";
|
|
@@ -283,7 +283,9 @@ var ALLOWED_TOKEN_DOMAINS = [
|
|
|
283
283
|
"sharepoint.com",
|
|
284
284
|
"office.com",
|
|
285
285
|
"azure.com",
|
|
286
|
-
"windows.net"
|
|
286
|
+
"windows.net",
|
|
287
|
+
"powerplatform.com",
|
|
288
|
+
"powerapps.com"
|
|
287
289
|
];
|
|
288
290
|
function isAllowedTokenDomain(hostname) {
|
|
289
291
|
const lower = hostname.toLowerCase().replace(/\.+$/, "");
|
|
@@ -1004,6 +1006,11 @@ async function createWamAuthProvider(config, silentOnly = false) {
|
|
|
1004
1006
|
"No cached credentials available. Run 'powerautomate-mcp --setup' first to authenticate."
|
|
1005
1007
|
);
|
|
1006
1008
|
}
|
|
1009
|
+
if (currentAccount) {
|
|
1010
|
+
throw new AuthenticationError(
|
|
1011
|
+
`Silent token acquisition failed for scopes: ${mutableScopes.join(", ")}. Resource may not be registered in the app registration. Re-run --setup to update permissions.`
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1007
1014
|
try {
|
|
1008
1015
|
const result = await pca.acquireTokenInteractive({
|
|
1009
1016
|
scopes: mutableScopes,
|
|
@@ -1974,7 +1981,7 @@ var ConnectorMetadataApi = class {
|
|
|
1974
1981
|
var RESOURCES = {
|
|
1975
1982
|
FLOW_SERVICE: "https://service.flow.microsoft.com",
|
|
1976
1983
|
POWERAPPS_SERVICE: "https://service.powerapps.com",
|
|
1977
|
-
POWER_PLATFORM: "https://api.
|
|
1984
|
+
POWER_PLATFORM: "https://api.bap.microsoft.com",
|
|
1978
1985
|
GRAPH: "https://graph.microsoft.com"
|
|
1979
1986
|
};
|
|
1980
1987
|
|
|
@@ -2749,7 +2756,14 @@ var PowerPlatformAdminApi = class {
|
|
|
2749
2756
|
};
|
|
2750
2757
|
}
|
|
2751
2758
|
buildUrl(path, queryParams) {
|
|
2752
|
-
|
|
2759
|
+
let resolvedPath = path;
|
|
2760
|
+
if (path.startsWith("/providers/") && !path.includes("/scopes/admin/")) {
|
|
2761
|
+
resolvedPath = path.replace(
|
|
2762
|
+
"/providers/Microsoft.BusinessAppPlatform/",
|
|
2763
|
+
"/providers/Microsoft.BusinessAppPlatform/scopes/admin/"
|
|
2764
|
+
);
|
|
2765
|
+
}
|
|
2766
|
+
const base = `${POWER_PLATFORM_API_BASE}${resolvedPath}`;
|
|
2753
2767
|
const params = new URLSearchParams();
|
|
2754
2768
|
params.set("api-version", POWER_PLATFORM_API_VERSION);
|
|
2755
2769
|
if (queryParams) {
|
|
@@ -14791,6 +14805,11 @@ async function createDeviceCodeAuthProvider(config, silentOnly = false) {
|
|
|
14791
14805
|
"No cached credentials available. Run 'powerautomate-mcp --setup' first to authenticate."
|
|
14792
14806
|
);
|
|
14793
14807
|
}
|
|
14808
|
+
if (currentAccount) {
|
|
14809
|
+
throw new AuthenticationError(
|
|
14810
|
+
`Silent token acquisition failed for scopes: ${mutableScopes.join(", ")}. Resource may not be registered in the app registration. Re-run --setup to update permissions.`
|
|
14811
|
+
);
|
|
14812
|
+
}
|
|
14794
14813
|
try {
|
|
14795
14814
|
logger.info("Starting device code authentication flow");
|
|
14796
14815
|
const deviceCodeRequest = {
|
|
@@ -14937,6 +14956,15 @@ var REQUIRED_RESOURCE_ACCESS = [
|
|
|
14937
14956
|
resourceAccess: [
|
|
14938
14957
|
{ id: "78ce3f0f-a1ce-49c2-8cde-64b5c0896db4", type: "Scope" }
|
|
14939
14958
|
]
|
|
14959
|
+
},
|
|
14960
|
+
{
|
|
14961
|
+
// Business Application Platform (BAP) API — required for environment
|
|
14962
|
+
// discovery and Power Platform admin operations
|
|
14963
|
+
resourceAppId: "0e0bf3cc-3078-4fd4-9ef3-cb6dc0245b10",
|
|
14964
|
+
resourceAccess: [
|
|
14965
|
+
{ id: "4ae1bf56-f562-4747-b7bc-2fa0874ed46f", type: "Scope" }
|
|
14966
|
+
// user_impersonation
|
|
14967
|
+
]
|
|
14940
14968
|
}
|
|
14941
14969
|
];
|
|
14942
14970
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -15237,6 +15265,18 @@ async function runSetupWizard() {
|
|
|
15237
15265
|
} else {
|
|
15238
15266
|
print(` ${icons.check} ${c.green}Signed in${c.reset}`);
|
|
15239
15267
|
}
|
|
15268
|
+
const additionalResources = [
|
|
15269
|
+
"https://api.bap.microsoft.com",
|
|
15270
|
+
"https://service.powerapps.com"
|
|
15271
|
+
];
|
|
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}`);
|
|
15278
|
+
}
|
|
15279
|
+
}
|
|
15240
15280
|
} catch (error) {
|
|
15241
15281
|
const message = error instanceof Error ? error.message : String(error);
|
|
15242
15282
|
print(` ${icons.cross} ${c.red}Sign-in failed:${c.reset} ${message}`);
|