MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / showPluginMcpPicker

Function showPluginMcpPicker

apps/kimi-code/src/tui/commands/plugins.ts:220–251  ·  view source on GitHub ↗
(
  host: SlashCommandHost,
  id: string,
  options?: ShowPluginMcpPickerOptions,
)

Source from the content-addressed store, hash-verified

218}
219
220async function showPluginMcpPicker(
221 host: SlashCommandHost,
222 id: string,
223 options?: ShowPluginMcpPickerOptions,
224): Promise<void> {
225 let info: PluginInfo;
226 try {
227 info = await host.requireSession().getPluginInfo(id);
228 } catch (error) {
229 host.showError(`Failed to load plugin MCP servers: ${formatErrorMessage(error)}`);
230 return;
231 }
232
233 host.mountEditorReplacement(
234 new PluginMcpSelectorComponent({
235 info,
236 selectedServer: options?.selectedServer,
237 serverHint: options?.serverHint,
238 onSelect: (selection) => {
239 // Every MCP action re-mounts a picker, so let the handler do the
240 // mounting — pre-restoring the editor here would flash on toggle.
241 void handlePluginMcpSelection(host, selection).catch((error: unknown) => {
242 host.showError(`/plugins mcp failed: ${formatErrorMessage(error)}`);
243 });
244 },
245 onCancel: () => {
246 host.restoreEditor();
247 void showPluginsPicker(host, { selectedId: id });
248 },
249 }),
250 );
251}
252
253async function confirmRemovePlugin(host: SlashCommandHost, id: string): Promise<boolean> {
254 let displayName = id;

Callers 2

handlePluginMcpSelectionFunction · 0.85

Calls 8

formatErrorMessageFunction · 0.90
handlePluginMcpSelectionFunction · 0.85
showPluginsPickerFunction · 0.85
requireSessionMethod · 0.65
showErrorMethod · 0.65
restoreEditorMethod · 0.65
getPluginInfoMethod · 0.45

Tested by

no test coverage detected