MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / handleAdd

Function handleAdd

packages/plugins/mcp/src/react/CodexPluginAdd.tsx:61–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 });
60
61 const handleAdd = async () => {
62 if (plugin === undefined) return;
63 setAdding(true);
64 setError(null);
65 const exit = await doAddServer({
66 payload: {
67 transport: "stdio" as const,
68 name: plugin.name,
69 slug: plugin.slug,
70 description: plugin.summary,
71 command: plugin.command,
72 args: [...plugin.args],
73 ...(plugin.cwd !== undefined ? { cwd: plugin.cwd } : {}),
74 // As STATIC env, not `env`: these are machine-derived paths the
75 // scanner already resolved, so they must not become credentials the
76 // person is asked to type. Sent this way the integration declares no
77 // auth, and its connection is created for them.
78 ...(plugin.env !== undefined ? { staticEnv: { ...plugin.env } } : {}),
79 ...(plugin.appServer !== undefined ? { appServer: { ...plugin.appServer } } : {}),
80 },
81 reactivityKeys: integrationWriteKeys,
82 });
83 if (Exit.isFailure(exit)) {
84 setError(addIntegrationErrorMessage(exit, plugin.slug, "Failed to add plugin"));
85 setAdding(false);
86 return;
87 }
88 props.onComplete(exit.value.slug);
89 };
90
91 // Checked on open rather than on a button, so the card states where you
92 // stand before you commit to anything. It runs the plugin's read-only probe

Callers 1

CodexPluginAddFunction · 0.70

Calls 1

Tested by

no test coverage detected