Add MCP server (v1 read-only): toggle, per-pane gate, panel UI

This commit is contained in:
megaproxy 2026-05-25 21:31:49 +01:00
parent 6068522ee3
commit 83d8932c98
15 changed files with 1235 additions and 7 deletions

View file

@ -3,8 +3,12 @@
mod commands;
mod creds;
mod hosts;
mod mcp;
mod pty;
use std::sync::Arc;
use crate::mcp::{McpServerHandle, McpState};
use crate::pty::PtyManager;
pub fn run() {
@ -26,10 +30,19 @@ pub fn run() {
Err(e) => tracing::warn!("keyring store init failed: {e}"),
}
// PtyManager and McpState are shared with the MCP server, so register
// them as Arc<T> rather than the plain T. Tauri commands access them
// via `tauri::State<'_, Arc<T>>` and deref / clone as needed.
let ptys: Arc<PtyManager> = Arc::new(PtyManager::new());
let mcp_state: Arc<tokio::sync::RwLock<McpState>> =
Arc::new(tokio::sync::RwLock::new(McpState::default()));
tauri::Builder::default()
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_opener::init())
.manage(PtyManager::new())
.manage(ptys)
.manage(mcp_state)
.manage(McpServerHandle::default())
.invoke_handler(tauri::generate_handler![
commands::list_distros,
commands::spawn_pane,
@ -43,6 +56,10 @@ pub fn run() {
commands::set_host_password,
commands::delete_host_password,
commands::has_host_password,
commands::mcp_start,
commands::mcp_stop,
commands::mcp_status,
commands::mcp_update_state,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");