create-mcp-use-app 2.0.0-beta.13 → 2.0.0-beta.14
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 +26 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1532,18 +1532,6 @@ function renderLogo() {
|
|
|
1532
1532
|
var packageJson = JSON.parse(
|
|
1533
1533
|
readFileSync2(join3(__dirname, "../package.json"), "utf-8")
|
|
1534
1534
|
);
|
|
1535
|
-
var DEFAULT_MCP_USE_VERSION = "2.0.0-beta.36";
|
|
1536
|
-
function getCurrentPackageVersions(isDevelopment = false, sdkVersion) {
|
|
1537
|
-
if (isDevelopment) {
|
|
1538
|
-
return {
|
|
1539
|
-
"mcp-use": "workspace:*"
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
const requestedSdk = sdkVersion ?? DEFAULT_MCP_USE_VERSION;
|
|
1543
|
-
return {
|
|
1544
|
-
"mcp-use": requestedSdk
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
1535
|
function processTemplateFile(filePath, versions, isDevelopment = false) {
|
|
1548
1536
|
const content = readFileSync2(filePath, "utf-8");
|
|
1549
1537
|
let processedContent = content;
|
|
@@ -1554,7 +1542,7 @@ function processTemplateFile(filePath, versions, isDevelopment = false) {
|
|
|
1554
1542
|
version
|
|
1555
1543
|
);
|
|
1556
1544
|
}
|
|
1557
|
-
const mcpUseVersion = isDevelopment ? "workspace:*" : versions["mcp-use"]
|
|
1545
|
+
const mcpUseVersion = isDevelopment ? "workspace:*" : versions["mcp-use"];
|
|
1558
1546
|
if (isDevelopment) {
|
|
1559
1547
|
processedContent = processedContent.replace(
|
|
1560
1548
|
/"mcp-use": "\^[^"]+"/,
|
|
@@ -2027,11 +2015,35 @@ async function main() {
|
|
|
2027
2015
|
);
|
|
2028
2016
|
process.exit(1);
|
|
2029
2017
|
}
|
|
2018
|
+
}
|
|
2019
|
+
let mcpUseVersion;
|
|
2020
|
+
if (options.dev) {
|
|
2021
|
+
mcpUseVersion = "workspace:*";
|
|
2022
|
+
} else if (options.sdkVersion) {
|
|
2023
|
+
mcpUseVersion = options.sdkVersion;
|
|
2024
|
+
} else {
|
|
2025
|
+
const response = await fetch("https://registry.npmjs.org/mcp-use", {
|
|
2026
|
+
headers: { Accept: "application/vnd.npm.install-v1+json" },
|
|
2027
|
+
signal: AbortSignal.timeout(1e4)
|
|
2028
|
+
});
|
|
2029
|
+
if (!response.ok) {
|
|
2030
|
+
throw new Error(
|
|
2031
|
+
`Failed to resolve the mcp-use beta dist-tag from npm (${response.status})`
|
|
2032
|
+
);
|
|
2033
|
+
}
|
|
2034
|
+
const metadata = await response.json();
|
|
2035
|
+
const betaVersion = metadata["dist-tags"]?.beta;
|
|
2036
|
+
if (!betaVersion) {
|
|
2037
|
+
throw new Error("npm did not return a beta version for mcp-use");
|
|
2038
|
+
}
|
|
2039
|
+
mcpUseVersion = betaVersion;
|
|
2040
|
+
}
|
|
2041
|
+
const versions = { "mcp-use": mcpUseVersion };
|
|
2042
|
+
if (!useCurrentDir) {
|
|
2030
2043
|
mkdirSync(projectPath, { recursive: true });
|
|
2031
2044
|
}
|
|
2032
2045
|
console.log(cyan(`\u{1F680} Creating MCP server "${displayName}"...`));
|
|
2033
2046
|
const validatedTemplate = validateTemplateName(selectedTemplate);
|
|
2034
|
-
const versions = getCurrentPackageVersions(options.dev, options.sdkVersion);
|
|
2035
2047
|
await copyTemplate(projectPath, validatedTemplate, versions, options.dev);
|
|
2036
2048
|
updatePackageJson(projectPath, packageName);
|
|
2037
2049
|
updateIndexTs(projectPath, packageName);
|