Skip to content

Commit c3f67ab

Browse files
committed
fix(interactive-server): 🐛 fix path resolution for CJS/ESM, improve test stability
1 parent 5e2866f commit c3f67ab

File tree

6 files changed

+256
-76
lines changed

6 files changed

+256
-76
lines changed
2.37 MB
Binary file not shown.

mcp/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudbase/cloudbase-mcp",
3-
"version": "1.8.18",
3+
"version": "1.8.19",
44
"description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
55
"main": "./dist/index.cjs",
66
"module": "./dist/index.js",

mcp/src/interactive-server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ async function openUrl(url: string, options?: any) {
1818
}
1919

2020
const getFilename = (): string => {
21+
// 优先使用 CJS 的 __filename
22+
if (typeof __filename !== 'undefined') {
23+
return __filename;
24+
}
25+
// ESM 环境下动态获取
2126
if (typeof import.meta !== 'undefined' && import.meta.url) {
2227
return fileURLToPath(import.meta.url);
2328
}
29+
// 兼容 globalThis.__filename
2430
if (typeof (globalThis as any).__filename === 'string') {
2531
return (globalThis as any).__filename;
2632
}

0 commit comments

Comments
 (0)