diff options
| author | haoyuren <13851610112@163.com> | 2026-04-25 19:15:49 -0300 |
|---|---|---|
| committer | haoyuren <13851610112@163.com> | 2026-04-25 19:15:49 -0300 |
| commit | e5e25d0e13b2e054cc7e2ca206b7ea70ee3bf4c2 (patch) | |
| tree | a85f8c1728e77ac035f65a579e8e5fe223e022b6 /src/main/index.ts | |
| parent | 5a7e8f86b1c05330df89731b2d6539fb5b3b7997 (diff) | |
Diffstat (limited to 'src/main/index.ts')
| -rw-r--r-- | src/main/index.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/index.ts b/src/main/index.ts index 0ad1ed1..4d06ebd 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -64,6 +64,26 @@ async function prepareMcpServerPath(tmpDir: string): Promise<string> { return serverPath } +async function clearDisabledLattexMcpServer(tmpDir: string): Promise<void> { + const settingsPath = join(tmpDir, '.claude', 'settings.local.json') + try { + const raw = await readFile(settingsPath, 'utf-8') + const settings = JSON.parse(raw) as Record<string, unknown> + const disabled = settings.disabledMcpjsonServers + if (!Array.isArray(disabled) || !disabled.includes('lattex')) return + + const nextDisabled = disabled.filter((name) => name !== 'lattex') + if (nextDisabled.length > 0) { + settings.disabledMcpjsonServers = nextDisabled + } else { + delete settings.disabledMcpjsonServers + } + await writeFile(settingsPath, JSON.stringify(settings, null, 2)) + } catch { + // No local settings yet, or not JSON. Claude can create it later. + } +} + let commentContextRefreshTimer: ReturnType<typeof setTimeout> | null = null function scheduleCommentContextRefresh(): void { if (commentContextRefreshTimer) clearTimeout(commentContextRefreshTimer) @@ -854,11 +874,13 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => { await writeFile(join(tmpDir, '.mcp.json'), JSON.stringify({ mcpServers: { lattex: { + type: 'stdio', command: 'node', args: [mcpServerPath] } } }, null, 2)) + await clearDisabledLattexMcpServer(tmpDir) } catch (e) { console.log('[mcp] failed to write MCP config:', e) } |
