chore: enhance MCP permission settings (#5178)
* chore: enhance MCP permission settings * chore: bring default mcp servers in * chore: default mcp servers are inactive
This commit is contained in:
parent
307ea39413
commit
de9c59d309
@ -9,9 +9,7 @@ use tokio::{process::Command, sync::Mutex, time::timeout};
|
|||||||
|
|
||||||
use super::{cmd::get_jan_data_folder_path, state::AppState};
|
use super::{cmd::get_jan_data_folder_path, state::AppState};
|
||||||
|
|
||||||
const DEFAULT_MCP_CONFIG: &str = r#"{
|
const DEFAULT_MCP_CONFIG: &str = r#"{"mcpServers":{"browsermcp":{"command":"npx","args":["@browsermcp/mcp"],"env":{},"active":false},"fetch":{"command":"uvx","args":["mcp-server-fetch"],"env":{},"active":false},"filesystem":{"command":"npx","args":["-y","/path/to/other/allowed/dir"],"env":{},"active":false},"playwright":{"command":"npx","args":["@playwright/mcp","--isolated"],"env":{},"active":false},"mindmap":{"command":"uvx","args":["mindmap-mcp-server","--return-type","filePath"],"env":{},"active":false}}}"#;
|
||||||
"mcpServers": {}
|
|
||||||
}"#;
|
|
||||||
|
|
||||||
// Timeout for MCP tool calls (30 seconds)
|
// Timeout for MCP tool calls (30 seconds)
|
||||||
const MCP_TOOL_CALL_TIMEOUT: Duration = Duration::from_secs(30);
|
const MCP_TOOL_CALL_TIMEOUT: Duration = Duration::from_secs(30);
|
||||||
|
|||||||
@ -159,7 +159,7 @@ function MCPServers() {
|
|||||||
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
|
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
|
||||||
<Card
|
<Card
|
||||||
header={
|
header={
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col mb-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-main-view-fg font-medium text-base">
|
<h1 className="text-main-view-fg font-medium text-base">
|
||||||
MCP Servers
|
MCP Servers
|
||||||
@ -197,35 +197,21 @@ function MCPServers() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
>
|
||||||
|
<CardItem
|
||||||
{/* Global MCP Permission Toggle */}
|
title="Allow All MCP Tool Permissions"
|
||||||
<Card
|
description="When enabled, all MCP tool calls will be automatically
|
||||||
header={
|
approved without showing permission dialogs."
|
||||||
<div className="flex items-center justify-between">
|
actions={
|
||||||
<div className="space-y-1">
|
|
||||||
<h1 className="text-main-view-fg font-medium text-base">
|
|
||||||
Allow All MCP Tool Permissions
|
|
||||||
</h1>
|
|
||||||
<p className="text-sm text-main-view-fg/70">
|
|
||||||
When enabled, all MCP tool calls will be automatically
|
|
||||||
approved without showing permission dialogs.
|
|
||||||
<span className="font-semibold text-main-view-fg">
|
|
||||||
{' '}
|
|
||||||
Use with caution
|
|
||||||
</span>{' '}
|
|
||||||
- only enable this if you trust all your MCP servers.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="flex-shrink-0 ml-4">
|
<div className="flex-shrink-0 ml-4">
|
||||||
<Switch
|
<Switch
|
||||||
checked={allowAllMCPPermissions}
|
checked={allowAllMCPPermissions}
|
||||||
onCheckedChange={setAllowAllMCPPermissions}
|
onCheckedChange={setAllowAllMCPPermissions}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
/>
|
||||||
/>
|
</Card>
|
||||||
|
|
||||||
{Object.keys(mcpServers).length === 0 ? (
|
{Object.keys(mcpServers).length === 0 ? (
|
||||||
<div className="py-4 text-center font-medium text-main-view-fg/50">
|
<div className="py-4 text-center font-medium text-main-view-fg/50">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user