summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--electron-builder.yml1
-rw-r--r--package.json2
-rw-r--r--src/main/index.ts6
3 files changed, 6 insertions, 3 deletions
diff --git a/electron-builder.yml b/electron-builder.yml
index 991af70..6f74aa6 100644
--- a/electron-builder.yml
+++ b/electron-builder.yml
@@ -25,6 +25,7 @@ files:
- node_modules/binary-extensions/**/*
asarUnpack:
- node_modules/node-pty/**/*
+ - out/mcp/**/*
afterPack: ./scripts/afterPack.js
mac:
icon: resources/icon.icns
diff --git a/package.json b/package.json
index 66f78cd..ce295d7 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"main": "./out/main/index.js",
"scripts": {
"dev": "electron-vite dev",
- "build": "electron-vite build",
+ "build": "electron-vite build && npx esbuild src/mcp/lattex.mjs --bundle --platform=node --format=esm --outfile=out/mcp/lattex.mjs",
"preview": "electron-vite preview",
"postinstall": "electron-builder install-app-deps",
"pack": "electron-builder --dir",
diff --git a/src/main/index.ts b/src/main/index.ts
index b6648bb..4169079 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -752,8 +752,10 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => {
mcpPathDocMap = pathDocMap
writeMcpState()
// Write .mcp.json so Claude Code auto-discovers the MCP server
- const appRoot = app.isPackaged ? join(app.getAppPath(), '..') : join(__dirname, '..', '..')
- const mcpServerPath = join(appRoot, 'src', 'mcp', 'lattex.mjs')
+ // Dev: use source file. Packaged: use bundled file in app.asar.unpacked/out/mcp/
+ const mcpServerPath = app.isPackaged
+ ? join(app.getAppPath() + '.unpacked', 'out', 'mcp', 'lattex.mjs')
+ : join(__dirname, '..', '..', 'src', 'mcp', 'lattex.mjs')
writeFile(join(tmpDir, '.mcp.json'), JSON.stringify({
mcpServers: {
lattex: {