README.md

March 1, 2026 Β· View on GitHub

Agent Copa.ai

An immersive, AI-powered experience to explore the 2026 FIFA World Cup β€” 48 teams, 104 matches, 16 stadiums across 3 host nations πŸ‡ΊπŸ‡ΈπŸ‡²πŸ‡½πŸ‡¨πŸ‡¦

Built with the AG-UI Protocol, the GitHub Copilot SDK, and MCP weather tools.

πŸ“‚ Project documentation & configuration:

FileDescription
/docs/README.mdFull documentation β€” problem β†’ solution, prerequisites, setup, deployment, architecture diagram, RAI notes, GitHub Copilot SDK product feedback
/docs/docs-architecture.pumlPlantUML architecture diagram (AG-UI, Copilot SDK, MCP layers)
/presentations/AgentCopaAI.pptx2-slide presentation deck β€” business value & architecture
AGENTS.mdCustom instructions for the Copa AI agent
mcp.jsonMCP server configuration (Open-Meteo weather)

Copa Welcome Screen

🎬 Demo

https://github.com/user-attachments/assets/5614e39e-7b5d-418f-8788-4aeb0faae347

πŸ“Ί Watch in High Quality on YouTube


🎯 What Can Copa Do?

Copa is a conversational AI sports commentator that turns the FIFA World Cup 2026 into a living, interactive experience. The entire page transforms in real time as you chat β€” colors, data, maps, and cards all react to your conversation.

πŸ—£οΈ Talk to Copa

Try saying…What happens on screen
"Show me France"πŸ‡«πŸ‡· Full-page switch: blue theme, flag, roster, match schedule, stadiums on the SVG map
"Now show Germany"πŸ‡©πŸ‡ͺ Instant switch: black-red-gold theme, new players, new schedule
"Compare Brazil vs Argentina"βš”οΈ Rich side-by-side comparison card rendered inside the chat
"Tell me about MetLife Stadium"🏟️ Stadium card with capacity, location, hosted matches β€” in chat
"Show Group C"🌍 Interactive group view with all 4 teams, click any to navigate
"Show the tournament bracket"πŸ† Full knockout bracket R32 β†’ R16 β†’ QF β†’ SF β†’ Final
"What's the weather in Houston?"🌀️ Live weather data via MCP (open-meteo) β€” real-time, not cached
"City guide for Miami"πŸ™οΈ Fan tips: food, transport, must-see spots near the stadium

πŸ–±οΈ Click & Explore

ActionEffect
Click a team flag on the welcome screenPage transforms with team's national colors and data
Click a player cardModal with Wikipedia photo, bio, position & club
Click a stadium dot on the SVG mapStadium details panel with weather & video buttons
Click 🌀️ Weather on a stadiumPopup with live 5-day forecast from Open-Meteo API
Click ▢️ Video on a stadiumEmbedded YouTube player popup (no redirect)
Click a match rowStadium pin highlights on the map
Click an opponent flag in the scheduleTriggers a compare prompt in Copa's chat
Click 🎲 Simulate on the bracketSimulates full tournament based on FIFA rankings
Navigate Groups / Bracket tabsInteractive tournament views

πŸ—οΈ Architecture Overview

Copa demonstrates a modern AI-native frontend pattern where a chat agent drives the entire UI.

Macro Architecture

Architecture

πŸ“ PlantUML source: docs/architecture.puml

The 4 Layers

LayerWhatWhy
Next.js AppReact 19 frontend with CopilotKit hooksRich UI components that react to agent state
AG-UI ProtocolOpen standard for agent ↔ frontend communication (SSE)Streaming text, tool calls, state sync β€” all over one event stream
GitHub Copilot SDKNode.js agent runtime with custom toolsZero API keys β€” uses gh auth, custom tools, streaming
MCP ServersModel Context Protocol for external data sourcesPlug-and-play: live weather today, any data source tomorrow

πŸ”Œ AG-UI Protocol β€” How It Works

The AG-UI Protocol is an open standard for agent ↔ frontend communication. Copa uses it to stream text, coordinate tool calls, and synchronize state β€” all over Server-Sent Events (SSE).

AG-UI EventCopa Usage
TEXT_MESSAGE_START/CONTENT/ENDCopa's commentary streams word-by-word
TOOL_CALL_START/ARGS/ENDAgent invokes tools β†’ frontend tracks execution
STATE_DELTAAgent pushes state patches β†’ useCoAgent updates React (team, bracket, group)
RUN_STARTED / RUN_FINISHEDLifecycle: loading indicators, error handling
RUN_ERRORGraceful error display in chat

The CopilotSDKAgent class (in copilot-sdk-agent.ts) bridges Copilot SDK events to AG-UI:

Copilot SDK Event              β†’  AG-UI Event
─────────────────────────────────────────────────
assistant.message_delta        β†’  TEXT_MESSAGE_CONTENT
tool.execution_start           β†’  TOOL_CALL_START + TOOL_CALL_ARGS
tool.execution_complete        β†’  TOOL_CALL_END + STATE_DELTA (for UI tools)
session.idle                   β†’  TEXT_MESSAGE_END + RUN_FINISHED
session.error                  β†’  RUN_ERROR

Data Flow β€” "Show me France"

Sequence Diagram

πŸ“ PlantUML source: docs/sequence.puml


🧠 GitHub Copilot SDK β€” Zero-Key AI

The GitHub Copilot SDK (@github/copilot-sdk) runs the LLM β€” no OpenAI/Azure API keys required.

BenefitDetail
Zero API keysUses your gh auth token β€” if you have Copilot, you're ready
Zero PythonEverything runs in the Next.js Node.js process
Custom toolsDefine tools with JSON Schema; the model calls them automatically
StreamingReal-time token-by-token streaming translated to AG-UI events
MCP supportNative mcpServers in session config β€” plug any MCP server

Copa's 6 Custom Tools

All defined in src/lib/copilot-sdk-agent.ts:

ToolTypeWhat it does
update_team_infoServer β†’ STATE_DELTALoads a team β†’ pushes state patch β†’ page transforms
get_stadium_infoServer + Generative UIReturns stadium details β†’ renders rich card in chat
compare_teamsServer + Generative UIHead-to-head comparison β†’ renders comparison grid in chat
get_group_standingsServer β†’ STATE_DELTAReturns group data β†’ switches to GroupView
show_tournament_bracketServer β†’ STATE_DELTAActivates bracket view β†’ switches to TournamentBracket
get_city_guideServerFan travel guide for a host city

MCP Server β€” Live Weather

Copa connects to the open-meteo MCP server for real-time weather data at any World Cup venue. No API key, no configuration β€” it just works.

// In copilot-sdk-agent.ts β€” session config
mcpServers: {
  weather: {
    type: "sse",
    url: "https://mcp.open-meteo.com/sse",
    tools: ["*"],  // All weather tools available
  },
},

πŸ’‘ Extensible: Add any MCP-compatible server (news, sports stats, transit) by adding an entry to mcpServers.


πŸ› οΈ CopilotKit β€” Features Used

CopilotKit provides the React integration layer between the AG-UI event stream and the UI components.

FeatureHook / ComponentHow Copa Uses It
Co-Agent StateuseCoAgent<AgentState>Bidirectional state: teamInfo, matches, tournamentView, selectedStadium
Generative UIuseCopilotAction with renderRich stadium cards and comparison grids rendered inside the chat
Copilot ReadableuseCopilotReadableProvides current team context so the agent knows what the user sees
Chat SuggestionsuseCopilotChatSuggestionsDynamic follow-up prompts based on current state
Chat ManagementuseCopilotChatClicking an opponent flag auto-sends a compare prompt
Sidebar / PopupCopilotSidebar / CopilotPopupDesktop: persistent sidebar Β· Mobile: floating chat bubble
CSS ThemingCopilotKitCSSProperties--copilot-kit-primary-color adapts to each team's national colors

✨ Key Features

FeatureDescription
πŸ—£οΈ Copa AgentPassionate WC2026 commentator with 6 custom tools + MCP weather
🏳️ 48 national teamsFull profiles: real flag images, key players, honors, FIFA ranking, national colors
πŸ“… 104 matchesComplete schedule: group stage (72) β†’ R32 (16) β†’ R16 (8) β†’ QF β†’ SF β†’ Final
πŸ—ΊοΈ Interactive SVG map16 stadiums across USA / Canada / Mexico with clickable pins
🌍 12 groupsResponsive group view (Aβ†’L) with inter-team navigation
πŸ† Tournament bracketVisual tree R32 β†’ Final with 🎲 Simulate button (FIFA ranking-based)
🎨 Dynamic themeEntire UI changes colors based on the selected team's national colors
πŸ’¬ Generative UIRich cards rendered inside the chat (stadiums, comparisons)
🌀️ Live weatherReal-time weather via MCP + inline popup with 5-day forecast (Open-Meteo API)
πŸ“Έ Player photosClick any player β†’ Wikipedia photo, bio & club info in a modal
▢️ Stadium videosEmbedded YouTube player popup on each stadium (no redirect)
πŸ’‘ Smart suggestionsAI-driven follow-up questions based on current context
πŸ“± Mobile-firstMobile tabs + CopilotPopup / Desktop sidebar
⏱️ Live countdownReal-time countdown to June 11, 2026
🎟️ Playoff teams13 teams pending qualification shown with "Qualification Pending" message

πŸš€ Quick Start

Prerequisites

ToolVersionInstall
Node.js20+ (v24 LTS recommended)nodejs.org
GitHub CLIlatestwinget install GitHub.cli
GitHub CopilotActive subscriptiongithub.com/features/copilot

1. Clone & install

git clone https://github.com/fredgis/foot-agui-sample.git
cd foot-agui-sample
npm install

2. Authenticate with GitHub

gh auth login

The Copilot SDK uses your GitHub auth token β€” no API keys needed.

3. Run

npm run dev

Open http://localhost:3000 and start chatting with Copa! ⚽

4. Try it

  • 🏳️ Click a team flag β†’ the page transforms with national colors
  • πŸ’¬ Type: "Show me France" β†’ blue theme, roster, schedule
  • βš”οΈ Try: "Compare Brazil vs Argentina" β†’ rich comparison card in chat
  • 🏟️ Ask: "Tell me about MetLife Stadium" β†’ stadium card in chat
  • 🌀️ Ask: "What's the weather in New York?" β†’ live weather from MCP
  • 🌍 Navigate Groups and Bracket views

πŸ“ Project Structure

foot-agui-sample/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ page.tsx                    # Main page β€” all CopilotKit hooks + components
β”‚   β”‚   β”œβ”€β”€ globals.css                 # Dark theme, animations, CopilotKit styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx                  # CopilotKit Provider + metadata
β”‚   β”‚   └── api/copilotkit/route.ts     # CopilotRuntime β†’ CopilotSDKAgent
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ team-card.tsx               # Team profile (players w/ Wikipedia photos, honors)
β”‚   β”‚   β”œβ”€β”€ match-schedule.tsx          # 104 matches with phase/group filters
β”‚   β”‚   β”œβ”€β”€ venue-map.tsx               # SVG map β€” weather popup + YouTube video popup
β”‚   β”‚   β”œβ”€β”€ group-view.tsx              # 12 groups (Aβ†’L) responsive grid
β”‚   β”‚   └── tournament-bracket.tsx      # Bracket R32 β†’ Final + 🎲 Simulate
β”‚   └── lib/
β”‚       β”œβ”€β”€ types.ts                    # Types: TeamInfo, MatchInfo, AgentState
β”‚       β”œβ”€β”€ worldcup-data.ts            # 48 teams, 16 stadiums, 12 groups, 104 matches
β”‚       β”œβ”€β”€ flags.ts                    # FIFA code β†’ ISO β†’ flagcdn.com images
β”‚       └── copilot-sdk-agent.ts        # CopilotSDKAgent β€” AG-UI ↔ Copilot SDK bridge
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ README.md                       # Detailed docs: problem/solution, setup, RAI notes
β”‚   β”œβ”€β”€ docs-architecture.puml          # PlantUML β€” full architecture (AG-UI, SDK, MCP)
β”‚   β”œβ”€β”€ architecture.puml               # PlantUML β€” macro architecture diagram
β”‚   └── sequence.puml                   # PlantUML β€” data flow sequence diagram
β”œβ”€β”€ AGENTS.md                           # Custom agent instructions for Copa
β”œβ”€β”€ mcp.json                            # MCP server configuration (Open-Meteo weather)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy.ps1                      # One-click Azure deploy (idempotent, PowerShell 7+)
β”‚   └── deploy-config.env.example       # Azure config template
β”œβ”€β”€ package.json
└── README.md

πŸ› οΈ Available Scripts

CommandDescription
npm run devStart dev server (Next.js Turbopack) on :3000
npm run buildProduction build
npm run lintESLint check

☁️ Azure Deployment

Copa deploys as a single Azure Static Web App β€” no backend containers needed.

One-click deploy (idempotent)

Copy-Item scripts\deploy-config.env.example scripts\deploy-config.env
# Edit with your Azure subscription details

pwsh scripts\deploy.ps1

The script is re-entrant: safe to run multiple times (4 idempotent steps).

To tear down:

az group delete --name rg-worldcup2026 --yes --no-wait

πŸ”§ Tech Stack

LayerTechnologyVersion
FrontendNext.js + React + TailwindCSS16 + 19 + 4
Chat UICopilotKit (Sidebar + Popup)1.50
ProtocolAG-UI (SSE events)0.0.46
AI AgentGitHub Copilot SDK0.1.29
LLMGitHub Copilot (via gh auth)β€”
WeatherOpen-Meteo MCP Server + APIβ€”
DeploymentAzure Static Web Appsβ€”
Flagsflagcdn.com (CDN)β€”
Player PhotosWikipedia REST APIβ€”

πŸ“Š Project Stats

MetricValue
Lines of code~7,500 (TypeScript + CSS)
React components7
AI tools6 custom + MCP weather
WC2026 data48 teams Β· 104 matches Β· 16 stadiums Β· 12 groups

πŸ“‹ See docs/README.md for detailed architecture documentation and Responsible AI (RAI) notes.

πŸ“‹ See AGENTS.md for custom agent instructions and mcp.json for MCP server configuration.

πŸ€– This project was developed collaboratively with GitHub Copilot Agent β€” from planning through architecture, implementation, debugging, and documentation.


πŸ“„ License

MIT β€” see LICENSE


⚽ Built for the 2026 FIFA World Cup πŸ‡ΊπŸ‡ΈπŸ‡²πŸ‡½πŸ‡¨πŸ‡¦ Powered by AG-UI Protocol Β· GitHub Copilot SDK Β· CopilotKit Β· MCP