Download packages/app/src/context/global-sync/mcp.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 548 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/global-sync/mcp.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/context/global-sync/mcp.ts
-
curl -L -o mcp.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/global-sync/mcp.ts
548 Bytes
| import type { McpServer } from "@opencode-ai/client/promise" | |
| export async function toggleMcp(input: { | |
| status: McpServer["status"]["status"] | |
| connect: () => Promise<void> | |
| disconnect: () => Promise<void> | |
| authenticate: () => Promise<void> | |
| refresh: () => Promise<void> | |
| }) { | |
| if (input.status === "pending") return | |
| await { | |
| connected: input.disconnect, | |
| needs_auth: input.authenticate, | |
| disabled: input.connect, | |
| failed: input.connect, | |
| needs_client_registration: input.connect, | |
| }[input.status]() | |
| await input.refresh() | |
| } | |