Skip to content

Commit e56d80d

Browse files
committed
Merge pull request #6929 from janhq/feat/official_jan_browser_mcp
feat: Add official jan browser mcp
1 parent 384eed5 commit e56d80d

File tree

5 files changed

+83
-2
lines changed

5 files changed

+83
-2
lines changed

src-tauri/src/core/mcp/commands.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,30 @@ pub async fn get_mcp_configs<R: Runtime>(app: AppHandle<R>) -> Result<String, St
353353
mutated = true;
354354
}
355355

356+
// Migration: Add Jan Browser MCP if not present
357+
let mcp_servers = config_object
358+
.get_mut("mcpServers")
359+
.and_then(|v| v.as_object_mut())
360+
.ok_or("mcpServers is not an object")?;
361+
362+
if !mcp_servers.contains_key("Jan Browser MCP") {
363+
log::info!("Migrating config: Adding 'Jan Browser MCP' server");
364+
mcp_servers.insert(
365+
"Jan Browser MCP".to_string(),
366+
json!({
367+
"command": "npx",
368+
"args": ["-y", "[email protected]"],
369+
"env": {
370+
"BRIDGE_HOST": "127.0.0.1",
371+
"BRIDGE_PORT": "17389"
372+
},
373+
"active": false,
374+
"official": true
375+
}),
376+
);
377+
mutated = true;
378+
}
379+
356380
// Persist any mutations back to disk
357381
if mutated {
358382
fs::write(

src-tauri/src/core/mcp/constants.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ pub const DEFAULT_MCP_BACKOFF_MULTIPLIER: f64 = 2.0; // Double the delay each ti
66

77
pub const DEFAULT_MCP_CONFIG: &str = r#"{
88
"mcpServers": {
9+
"Jan Browser MCP": {
10+
"command": "npx",
11+
"args": ["-y", "[email protected]"],
12+
"env": {
13+
"BRIDGE_HOST": "127.0.0.1",
14+
"BRIDGE_PORT": "17389"
15+
},
16+
"active": false,
17+
"official": true
18+
},
919
"exa": {
1020
"command": "npx",
1121
"args": ["-y", "exa-mcp-server"],

src-tauri/src/core/setup.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub fn migrate_mcp_servers(
165165
if mcp_version < 1 {
166166
log::info!("Migrating MCP schema version 1");
167167
let result = add_server_config(
168-
app_handle,
168+
app_handle.clone(),
169169
"exa".to_string(),
170170
serde_json::json!({
171171
"command": "npx",
@@ -178,7 +178,27 @@ pub fn migrate_mcp_servers(
178178
log::error!("Failed to add server config: {e}");
179179
}
180180
}
181-
store.set("mcp_version", 1);
181+
if mcp_version < 2 {
182+
log::info!("Migrating MCP schema version 2: Adding Jan Browser MCP");
183+
let result = add_server_config(
184+
app_handle,
185+
"Jan Browser MCP".to_string(),
186+
serde_json::json!({
187+
"command": "npx",
188+
"args": ["-y", "[email protected]"],
189+
"env": {
190+
"BRIDGE_HOST": "127.0.0.1",
191+
"BRIDGE_PORT": "17389"
192+
},
193+
"active": false,
194+
"official": true
195+
}),
196+
);
197+
if let Err(e) = result {
198+
log::error!("Failed to add Jan Browser MCP server config: {e}");
199+
}
200+
}
201+
store.set("mcp_version", 2);
182202
store.save().expect("Failed to save store");
183203
Ok(())
184204
}

web-app/src/hooks/useMCPServers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type MCPServerConfig = {
1111
url?: string
1212
headers?: Record<string, string>
1313
timeout?: number
14+
official?: boolean
1415
}
1516

1617
// Define the structure of all MCP servers

web-app/src/routes/settings/mcp-servers.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,16 @@ function MCPServersDesktop() {
480480
<h1 className="text-main-view-fg text-base capitalize">
481481
{key}
482482
</h1>
483+
{config.official && (
484+
<div className="flex items-center gap-1.5 px-2 py-0.5 text-xs bg-blue-500/10 text-blue-500 rounded">
485+
<img
486+
src="/images/jan-logo.png"
487+
alt="Jan"
488+
className="w-3 h-3 object-contain"
489+
/>
490+
<span>Official</span>
491+
</div>
492+
)}
483493
</div>
484494
}
485495
descriptionOutside={
@@ -512,6 +522,22 @@ function MCPServersDesktop() {
512522
.join(', ')}
513523
</div>
514524
)}
525+
{config.official && (
526+
<div className="mt-2 text-xs text-main-view-fg/60 border-t border-main-view-fg/10 pt-2">
527+
<p className="mb-1">
528+
Requires Jan Browser Extension to be installed
529+
in your Chrome-based browser.
530+
</p>
531+
<a
532+
href="https://github.com/menloresearch/jan-browser-extension"
533+
target="_blank"
534+
rel="noopener noreferrer"
535+
className="text-blue-500 hover:underline"
536+
>
537+
Install Extension →
538+
</a>
539+
</div>
540+
)}
515541
</>
516542
) : (
517543
<>

0 commit comments

Comments
 (0)