Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9134113
app: Add langchain/mcp-adapters 1.0.0
illume Nov 4, 2025
a0031bd
app: main: MCPClient: Add stub MCPClient class and hook it up to main
illume Nov 4, 2025
a9e144f
app: MCPToolStateStore: Add MCPToolStateStore for tool state, stats, …
illume Nov 4, 2025
19e1469
app: MCPToolStateStore: Add parseServerNameToolName to get separate c…
illume Nov 4, 2025
6716f9a
app: MCPToolStateStore: Add summarizeMcpToolStateChanges and tests
illume Nov 4, 2025
b6a9136
app: MCPToolStateStore: Add initConfigFromClientTools
illume Nov 6, 2025
c8b8d90
app: MCPToolStateStore: Add validateToolArgs
illume Nov 6, 2025
391805e
app: MCPToolStateStore: Add showToolsConfigConfirmationDialog
illume Nov 6, 2025
a18a416
app: settings: runCmd: Extract loadSettings saveSettings into own module
illume Nov 5, 2025
aff8d2f
app: MCPSettings: Add functions for load/save of mcp settings
illume Nov 5, 2025
d19fc21
app: MCPSettings: Add expandEnvAndResolvePaths to process env
illume Nov 5, 2025
419b924
app: MCPSettings: Add makeMcpServersFromSettings
illume Nov 6, 2025
520b645
app: MCPSettings: Add settingsChanges for human-readable changes
illume Nov 6, 2025
4235eef
app: MCPSettings: Add showSettingsChangeDialog
illume Nov 6, 2025
4492d2f
app: MCPSettings: Add hasClusterDependentServers
illume Nov 6, 2025
4220bb3
app: MCPClient: Add showConfirmationDialog
illume Nov 6, 2025
ef62231
app: main: MCPClient: Use MultiServerMCPClient from langchain/mcp-ada…
illume Nov 6, 2025
a218819
app: MCPClient: Add mcpExecuteTool
illume Nov 7, 2025
071a72e
app: MCPClient: MCPSettings: Add setupIpcHandlers and ipc methods
illume Nov 7, 2025
24c7fcf
app: preload: Add mcp APIs to be exposed to frontend/
illume Nov 7, 2025
e26cd08
app: Fix test, use vite
ashu8912 Mar 20, 2026
5006c01
app:tsc fixes
ashu8912 Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion app/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import url from 'url';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import i18n from './i18next.config';
import MCPClient from './mcp/MCPClient';
import {
addToPath,
ArtifactHubHeadlampPkg,
Expand All @@ -59,6 +60,9 @@ if (process.env.HEADLAMP_RUN_SCRIPT) {
runScript();
}

// Enabled by default, set HEADLAMP_MCP_ENABLE=false to disable MCP features
const ENABLE_MCP = process.env.HEADLAMP_MCP_ENABLE !== 'false';

dotenv.config({ path: path.join(process.resourcesPath, '.env') });

const isDev = !!process.env.ELECTRON_DEV;
Expand Down Expand Up @@ -140,6 +144,7 @@ const shouldCheckForUpdates = process.env.HEADLAMP_CHECK_FOR_UPDATES !== 'false'

// make it global so that it doesn't get garbage collected
let mainWindow: BrowserWindow | null;
let mcpClient: MCPClient | null = null;

/**
* `Action` is an interface for an action to be performed by the plugin manager.
Expand Down Expand Up @@ -1717,6 +1722,14 @@ function startElectron() {
if (userPluginBinDirs.length > 0) {
addToPath(userPluginBinDirs, 'userPluginBinDirs plugin');
}

if (ENABLE_MCP) {
const configPath = path.join(app.getPath('userData'), 'mcp-tools-config.json');
const settingsPath = path.join(app.getPath('userData'), 'mcp-tools-settings.json');
mcpClient = new MCPClient(configPath, settingsPath);
await mcpClient.initialize();
mcpClient.setMainWindow(mainWindow);
}
}

if (disableGPU) {
Expand Down Expand Up @@ -1747,12 +1760,21 @@ function startElectron() {

app.once('window-all-closed', app.quit);

app.once('before-quit', () => {
app.once('before-quit', async () => {
saveZoomFactor(cachedZoom);
i18n.off('languageChanged');
if (mainWindow) {
mainWindow.removeAllListeners('close');
}

if (mcpClient) {
try {
await mcpClient.cleanup();
mcpClient = null;
} catch (err) {
console.error('Failed to clean up mcpClient:', err);
}
}
});
}

Expand Down
Loading
Loading