powerautomate-mcp 0.9.1 → 0.9.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 +56 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3837,6 +3837,7 @@ var DataverseApi = class {
|
|
|
3837
3837
|
*/
|
|
3838
3838
|
static getDataverseUrl(environmentId, region = "crm") {
|
|
3839
3839
|
const regionMap = {
|
|
3840
|
+
// Power Platform region names
|
|
3840
3841
|
unitedstates: "crm",
|
|
3841
3842
|
europe: "crm4",
|
|
3842
3843
|
uk: "crm11",
|
|
@@ -3853,7 +3854,35 @@ var DataverseApi = class {
|
|
|
3853
3854
|
government: "crm9",
|
|
3854
3855
|
gcc: "crm9",
|
|
3855
3856
|
gcchigh: "crm.microsoft.us",
|
|
3856
|
-
dod: "crm.appsplatform.us"
|
|
3857
|
+
dod: "crm.appsplatform.us",
|
|
3858
|
+
// Azure region names (map to same CRM domains)
|
|
3859
|
+
westus: "crm",
|
|
3860
|
+
eastus: "crm",
|
|
3861
|
+
centralus: "crm",
|
|
3862
|
+
westus2: "crm",
|
|
3863
|
+
eastus2: "crm",
|
|
3864
|
+
southcentralus: "crm",
|
|
3865
|
+
northcentralus: "crm",
|
|
3866
|
+
westeurope: "crm4",
|
|
3867
|
+
northeurope: "crm4",
|
|
3868
|
+
uksouth: "crm11",
|
|
3869
|
+
ukwest: "crm11",
|
|
3870
|
+
eastasia: "crm5",
|
|
3871
|
+
southeastasia: "crm5",
|
|
3872
|
+
australiaeast: "crm6",
|
|
3873
|
+
australiasoutheast: "crm6",
|
|
3874
|
+
japaneast: "crm7",
|
|
3875
|
+
japanwest: "crm7",
|
|
3876
|
+
centralindia: "crm8",
|
|
3877
|
+
southindia: "crm8",
|
|
3878
|
+
canadacentral: "crm3",
|
|
3879
|
+
canadaeast: "crm3",
|
|
3880
|
+
brazilsouth: "crm2",
|
|
3881
|
+
francecentral: "crm12",
|
|
3882
|
+
francesouth: "crm12",
|
|
3883
|
+
switzerlandnorth: "crm17",
|
|
3884
|
+
germanywestcentral: "crm16",
|
|
3885
|
+
uaenorth: "crm15"
|
|
3857
3886
|
};
|
|
3858
3887
|
const crmDomain = regionMap[region.toLowerCase()] || region;
|
|
3859
3888
|
return `${environmentId}.${crmDomain}.dynamics.com`;
|
|
@@ -15083,9 +15112,11 @@ async function createMcpServer(serverConfig) {
|
|
|
15083
15112
|
source = "bap";
|
|
15084
15113
|
}
|
|
15085
15114
|
} catch (err) {
|
|
15115
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
15116
|
+
const isAuthError = errMsg.includes("cached credentials") || errMsg.includes("authenticate");
|
|
15086
15117
|
logger.warn(
|
|
15087
|
-
{ err:
|
|
15088
|
-
"BAP admin API did not return a Dataverse instanceUrl \u2014 falling back to region guess (may fail DNS)"
|
|
15118
|
+
{ err: errMsg },
|
|
15119
|
+
isAuthError ? "BAP admin API token not cached \u2014 run --setup again or add dataverseUrl to your environment config" : "BAP admin API did not return a Dataverse instanceUrl \u2014 falling back to region guess (may fail DNS)"
|
|
15089
15120
|
);
|
|
15090
15121
|
}
|
|
15091
15122
|
}
|
|
@@ -15883,15 +15914,29 @@ async function runSetupWizard() {
|
|
|
15883
15914
|
print(` ${icons.check} ${c.green}Signed in${c.reset}`);
|
|
15884
15915
|
}
|
|
15885
15916
|
const additionalResources = [
|
|
15886
|
-
{ url: "https://service.powerapps.com", label: "PowerApps (connections)" },
|
|
15887
|
-
{ url: "https://api.bap.microsoft.com", label: "Admin API (environments)" }
|
|
15917
|
+
{ url: "https://service.powerapps.com", label: "PowerApps (connections)", critical: false },
|
|
15918
|
+
{ url: "https://api.bap.microsoft.com", label: "Admin API (environments/Dataverse)", critical: true }
|
|
15888
15919
|
];
|
|
15889
|
-
for (const { url, label } of additionalResources) {
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15920
|
+
for (const { url, label, critical } of additionalResources) {
|
|
15921
|
+
try {
|
|
15922
|
+
let token = null;
|
|
15923
|
+
if (authProvider.tryGetTokenForResourceSilent) {
|
|
15924
|
+
token = await authProvider.tryGetTokenForResourceSilent(url);
|
|
15925
|
+
}
|
|
15926
|
+
if (token) {
|
|
15927
|
+
print(` ${icons.check} ${c.dim}${label}: authorized${c.reset}`);
|
|
15928
|
+
} else {
|
|
15929
|
+
print(` ${c.dim}Authorizing ${label}...${c.reset}`);
|
|
15930
|
+
await authProvider.getTokenForResource(url);
|
|
15931
|
+
print(` ${icons.check} ${c.dim}${label}: authorized (interactive)${c.reset}`);
|
|
15932
|
+
}
|
|
15933
|
+
} catch (err) {
|
|
15934
|
+
if (critical) {
|
|
15935
|
+
print(` ${c.yellow || ""}${icons.warn} ${label}: not authorized \u2014 Dataverse tools may not work.${c.reset}`);
|
|
15936
|
+
print(` ${c.dim} Add dataverseUrl to your environment config as a workaround.${c.reset}`);
|
|
15937
|
+
} else {
|
|
15938
|
+
print(` ${c.dim}${icons.info || "-"} ${label}: not authorized (non-critical)${c.reset}`);
|
|
15939
|
+
}
|
|
15895
15940
|
}
|
|
15896
15941
|
}
|
|
15897
15942
|
} catch (error) {
|