Skip to main content
Glama

@arizeai/phoenix-mcp

Official
by Arize-ai
ThemeContext.tsx1.45 kB
import React, { createContext, useContext, useEffect, useState } from "react"; type Theme = "light" | "dark"; interface ThemeContextType { theme: Theme; toggleTheme: () => void; } const ThemeContext = createContext<ThemeContextType | undefined>(undefined); export function ThemeProvider({ children }: { children: React.ReactNode }) { const [theme, setTheme] = useState<Theme>(() => { // Check localStorage first, then system preference const saved = localStorage.getItem("theme"); if (saved === "light" || saved === "dark") { return saved; } // Check system preference if (window.matchMedia("(prefers-color-scheme: light)").matches) { return "light"; } return "dark"; }); useEffect(() => { // Apply theme to document if (theme === "dark") { document.documentElement.classList.add("dark"); } else { document.documentElement.classList.remove("dark"); } // Save to localStorage localStorage.setItem("theme", theme); }, [theme]); const toggleTheme = () => { setTheme((prev) => (prev === "light" ? "dark" : "light")); }; return ( <ThemeContext.Provider value={{ theme, toggleTheme }}> {children} </ThemeContext.Provider> ); } export function useTheme() { const context = useContext(ThemeContext); if (context === undefined) { throw new Error("useTheme must be used within a ThemeProvider"); } return context; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Arize-ai/phoenix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server