"use client";
import { Check, Copy } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
API_KEY_PLACEHOLDER,
DEFAULT_SERVER_DIR,
MCP_CLIENTS,
type McpSnippetOptions,
} from "@/lib/mcp/clients";
function CopyButton({ text }: { text: string }) {
const [copied, setCopied] = useState(false);
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(text);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch {
// Clipboard unavailable (permissions/insecure context); nothing to recover.
}
};
return (
);
}
/**
* Per-agent MCP setup instructions as tabs: pick a client, follow its steps,
* copy its exact config. Used on the /mcp-server marketing page and in the
* API playground; `options` fills in real values where the caller has them.
*/
export function AgentSetupTabs({ options }: { options?: Partial }) {
const resolved: McpSnippetOptions = {
baseUrl: options?.baseUrl || "https://api.surfsense.com",
apiKey: options?.apiKey || API_KEY_PLACEHOLDER,
serverDir: options?.serverDir || DEFAULT_SERVER_DIR,
};
return (
{MCP_CLIENTS.map((client) => (
{client.label}
))}
{MCP_CLIENTS.map((client) => {
const config = client.buildConfig(resolved);
return (
{client.steps.map((step) => (
- {step}
))}
);
})}
);
}