import { auth } from '@/auth'
import { redirect } from 'next/navigation'
import { McpSettingsPanel } from '@/components/mcp/mcp-settings-panel'
import { listMcpKeys, getMcpServerStatus } from '@/app/actions/mcp-keys'
import { useLanguage } from '@/lib/i18n'

export default async function McpSettingsPage() {
  const session = await auth()
  if (!session?.user) redirect('/api/auth/signin')

  const [keys, serverStatus] = await Promise.all([
    listMcpKeys(),
    getMcpServerStatus(),
  ])

  return (
    <div className="space-y-8">
      <h3 className="text-[10px] font-bold uppercase tracking-[0.3em] text-concrete">
        Gérez vos clés API et serveurs MCP connectés.
      </h3>
      <McpSettingsPanel initialKeys={keys} serverStatus={serverStatus} />
    </div>
  )
}
