Build the action list for a server based on its current state.
(state: McpServerState)
| 51 | |
| 52 | /** Build the action list for a server based on its current state. */ |
| 53 | function buildActions(state: McpServerState): string[] { |
| 54 | const actions: string[] = [] |
| 55 | if (state.status === "needs-auth") actions.push("Authenticate") |
| 56 | if (state.disabled || state.status === "disabled") actions.push("Enable") |
| 57 | else actions.push("Disable") |
| 58 | actions.push("Reconnect") |
| 59 | // Delete is last so it's a deliberate choice past the everyday toggles. |
| 60 | // It's always available — disabling and re-enabling a server still leaves |
| 61 | // the config entry, which is the right behaviour when you might want it |
| 62 | // back. Delete is the explicit "I don't want this server here at all" path. |
| 63 | actions.push("Delete") |
| 64 | return actions |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Interactive MCP server manager, opened by the `/mcp` command. |