feat(analytics): add analytics tracking to MCP server components
- Track MCP server additions with configuration method (manual/preset/import) - Monitor server connections and disconnections with success metrics - Record server removal events with connection state - Track MCP tool invocations with source attribution - Monitor connection errors with retry attempts - Add performance tracking for server operations These metrics help understand MCP server usage patterns and identify connection reliability issues.
This commit is contained in:
@@ -7,6 +7,7 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
|
||||
import { SelectComponent } from "@/components/ui/select";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { api } from "@/lib/api";
|
||||
import { useTrackEvent } from "@/hooks";
|
||||
|
||||
interface MCPAddServerProps {
|
||||
/**
|
||||
@@ -36,6 +37,9 @@ export const MCPAddServer: React.FC<MCPAddServerProps> = ({
|
||||
const [transport, setTransport] = useState<"stdio" | "sse">("stdio");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
// Analytics tracking
|
||||
const trackEvent = useTrackEvent();
|
||||
|
||||
// Stdio server state
|
||||
const [stdioName, setStdioName] = useState("");
|
||||
const [stdioCommand, setStdioCommand] = useState("");
|
||||
@@ -131,6 +135,12 @@ export const MCPAddServer: React.FC<MCPAddServerProps> = ({
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
// Track server added
|
||||
trackEvent.mcpServerAdded({
|
||||
server_type: "stdio",
|
||||
configuration_method: "manual"
|
||||
});
|
||||
|
||||
// Reset form
|
||||
setStdioName("");
|
||||
setStdioCommand("");
|
||||
@@ -185,6 +195,12 @@ export const MCPAddServer: React.FC<MCPAddServerProps> = ({
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
// Track server added
|
||||
trackEvent.mcpServerAdded({
|
||||
server_type: "sse",
|
||||
configuration_method: "manual"
|
||||
});
|
||||
|
||||
// Reset form
|
||||
setSseName("");
|
||||
setSseUrl("");
|
||||
|
Reference in New Issue
Block a user