Fix MCP form input and add reactive MCP server state

- Fix space key not working in MCP add form by handling evt.name === "space"
  - Add support for multi-character paste sequences via evt.sequence
  - Add MCPServerDisplay type to types/tui.ts for UI display
  - Add mcpServers reactive state to app store with setMcpServers,
    addMcpServer, and updateMcpServerStatus actions
  - Update session.tsx to use store's mcpServers instead of static props
  - Update execute.tsx to update store when server is added/connected
  - Remove duplicate MCPServer interfaces from app.tsx, session.tsx,
    and mcp-select.tsx in favor of shared MCPServerDisplay type
This commit is contained in:
2026-02-02 14:10:19 -05:00
parent 3b277c3925
commit fbd9afa177
6 changed files with 110 additions and 30 deletions

View File

@@ -105,7 +105,20 @@ const defaultHandleMCPAdd = async (data: MCPAddFormData): Promise<void> => {
data.isGlobal,
);
await connectServer(data.name);
// Add to store with "connecting" status
appStore.addMcpServer({
id: data.name,
name: data.name,
status: "disconnected",
description: data.command,
});
try {
await connectServer(data.name);
appStore.updateMcpServerStatus(data.name, "connected");
} catch {
appStore.updateMcpServerStatus(data.name, "error");
}
};
const defaultHandleBrainSetJwtToken = async (jwtToken: string): Promise<void> => {