@mcp-use/cli 3.5.2-canary.2 → 3.5.2-canary.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/commands/deploy.d.ts.map +1 -1
- package/dist/index.cjs +45 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -36
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +16 -18
- package/dist/utils/api.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAgGzB;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAA;CAAE,GAC1D,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAiC/C;AA0CD,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAA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AAG,IAAI,GAAG,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAynBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2xBzE"}
|
package/dist/index.cjs
CHANGED
|
@@ -1570,37 +1570,51 @@ var McpUseAPI = class _McpUseAPI {
|
|
|
1570
1570
|
}))
|
|
1571
1571
|
};
|
|
1572
1572
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1573
|
+
/**
|
|
1574
|
+
* Returns true if the GitHub App can access `${owner}/${repo}` via any of the
|
|
1575
|
+
* organization's installations.
|
|
1576
|
+
*
|
|
1577
|
+
* An organization can have multiple GitHub installations (e.g. a personal
|
|
1578
|
+
* account and one or more GitHub orgs), so we check across all of them.
|
|
1579
|
+
*
|
|
1580
|
+
* Each check is a single authoritative backend call (`repos.get` with the
|
|
1581
|
+
* installation token) rather than listing repos. The old listing approach
|
|
1582
|
+
* only returned the first page — so a repo on a later page was wrongly
|
|
1583
|
+
* reported inaccessible — and fully paginating it hung on very large orgs.
|
|
1584
|
+
* We try the installation whose account matches the repo owner first to
|
|
1585
|
+
* minimize GitHub calls.
|
|
1586
|
+
*/
|
|
1587
|
+
async checkGitHubRepoAccess(owner, repo) {
|
|
1588
|
+
const status = await this.getGitHubConnectionStatus();
|
|
1589
|
+
const installations = status.installations ?? [];
|
|
1590
|
+
if (installations.length === 0) return false;
|
|
1591
|
+
const ownerLower = owner.toLowerCase();
|
|
1592
|
+
const ordered = [...installations].sort((a, b) => {
|
|
1593
|
+
const aMatch = a.account_login.toLowerCase() === ownerLower ? 0 : 1;
|
|
1594
|
+
const bMatch = b.account_login.toLowerCase() === ownerLower ? 0 : 1;
|
|
1595
|
+
return aMatch - bMatch;
|
|
1596
|
+
});
|
|
1597
|
+
for (const installation of ordered) {
|
|
1598
|
+
const hasAccess = await this.installationCanAccessRepo(
|
|
1599
|
+
installation.installation_id,
|
|
1600
|
+
owner,
|
|
1601
|
+
repo
|
|
1602
|
+
);
|
|
1603
|
+
if (hasAccess) return true;
|
|
1604
|
+
}
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
async installationCanAccessRepo(installationId, owner, repo) {
|
|
1608
|
+
try {
|
|
1609
|
+
const resp = await this.request(
|
|
1610
|
+
`/github/installations/${installationId}/repos/${encodeURIComponent(
|
|
1611
|
+
owner
|
|
1612
|
+
)}/${encodeURIComponent(repo)}/access`
|
|
1613
|
+
);
|
|
1614
|
+
return resp.hasAccess;
|
|
1615
|
+
} catch {
|
|
1616
|
+
return false;
|
|
1578
1617
|
}
|
|
1579
|
-
const inst = installResp.installations[0];
|
|
1580
|
-
const repoLists = await Promise.all(
|
|
1581
|
-
installResp.installations.map(async (installation) => {
|
|
1582
|
-
try {
|
|
1583
|
-
const reposResp = await this.request(`/github/installations/${installation.installationId}/repos`);
|
|
1584
|
-
return reposResp.repos;
|
|
1585
|
-
} catch {
|
|
1586
|
-
return [];
|
|
1587
|
-
}
|
|
1588
|
-
})
|
|
1589
|
-
);
|
|
1590
|
-
return {
|
|
1591
|
-
user: {
|
|
1592
|
-
login: inst.account?.login ?? "",
|
|
1593
|
-
id: 0,
|
|
1594
|
-
avatar_url: inst.account?.avatar_url ?? ""
|
|
1595
|
-
},
|
|
1596
|
-
repos: repoLists.flat().map((r) => ({
|
|
1597
|
-
id: r.id,
|
|
1598
|
-
name: r.name,
|
|
1599
|
-
full_name: r.fullName,
|
|
1600
|
-
private: r.private,
|
|
1601
|
-
owner: { login: r.fullName.split("/")[0] ?? "" }
|
|
1602
|
-
}))
|
|
1603
|
-
};
|
|
1604
1618
|
}
|
|
1605
1619
|
async getGitHubAppName() {
|
|
1606
1620
|
if (process.env.MCP_GITHUB_APP_NAME) return process.env.MCP_GITHUB_APP_NAME;
|
|
@@ -5251,12 +5265,7 @@ async function getGitHubConnectionStatusWith401Retry(api, options, orgIdToRestor
|
|
|
5251
5265
|
throw new Error("Unreachable");
|
|
5252
5266
|
}
|
|
5253
5267
|
async function checkRepoAccess(api, owner, repo) {
|
|
5254
|
-
|
|
5255
|
-
const resp = await api.getGitHubRepos(true);
|
|
5256
|
-
return resp.repos.some((r) => r.full_name === `${owner}/${repo}`);
|
|
5257
|
-
} catch {
|
|
5258
|
-
return false;
|
|
5259
|
-
}
|
|
5268
|
+
return api.checkGitHubRepoAccess(owner, repo);
|
|
5260
5269
|
}
|
|
5261
5270
|
async function promptGitHubInstallation(api, reason, repoName, opts) {
|
|
5262
5271
|
const yes = !!opts?.yes;
|