MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / McpSettings

Function McpSettings

packages/app-core/src/components/SettingsModal.tsx:5302–5461  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5300
5301
5302function McpSettings(): JSX.Element {
5303 const [statuses, setStatuses] = useState<McpClientStatus[] | null>(null)
5304 const [runtime, setRuntime] = useState<McpServerRuntime | null>(null)
5305 const [busyId, setBusyId] = useState<McpClientId | null>(null)
5306 const [error, setError] = useState<string | null>(null)
5307 const [showCommand, setShowCommand] = useState(false)
5308
5309 const refresh = useCallback(async (): Promise<void> => {
5310 try {
5311 const [s, r] = await Promise.all([
5312 window.zen.mcpGetStatuses(),
5313 window.zen.mcpGetRuntime()
5314 ])
5315 setStatuses(s)
5316 setRuntime(r)
5317 setError(null)
5318 } catch (err) {
5319 setError((err as Error).message)
5320 }
5321 }, [])
5322
5323 useEffect(() => {
5324 void refresh()
5325 }, [refresh])
5326
5327 const onInstall = async (id: McpClientId): Promise<void> => {
5328 setBusyId(id)
5329 try {
5330 await window.zen.mcpInstall(id)
5331 await refresh()
5332 } catch (err) {
5333 setError((err as Error).message)
5334 } finally {
5335 setBusyId(null)
5336 }
5337 }
5338
5339 const onUninstall = async (id: McpClientId): Promise<void> => {
5340 setBusyId(id)
5341 try {
5342 await window.zen.mcpUninstall(id)
5343 await refresh()
5344 } catch (err) {
5345 setError((err as Error).message)
5346 } finally {
5347 setBusyId(null)
5348 }
5349 }
5350
5351 const copy = (text: string): void => {
5352 window.zen.clipboardWriteText(text)
5353 }
5354
5355 const commandPreview = runtime
5356 ? `${runtime.command} ${runtime.args.map((a) => (a.includes(' ') ? `"${a}"` : a)).join(' ')}`
5357 : '—'
5358 const entryMissing = runtime !== null && runtime.entryPath == null
5359

Callers

nothing calls this directly

Calls 7

statusChipClassFunction · 0.85
onInstallFunction · 0.85
onUninstallFunction · 0.85
mcpGetStatusesMethod · 0.80
mcpGetRuntimeMethod · 0.80
refreshFunction · 0.70
copyFunction · 0.70

Tested by

no test coverage detected