#!/usr/bin/env python3
"""
NHL MCP Server Demo
Demonstrates the capabilities of the NHL MCP Server
"""
import json
from nhl_api_client import NHLAPIClient
def print_section(title):
"""Print a formatted section header."""
print("\n" + "=" * 60)
print(f" {title}")
print("=" * 60)
def demo_nhl_mcp():
"""Demonstrate the NHL MCP Server capabilities."""
client = NHLAPIClient()
print("🏒 NHL MCP Server Demo")
print("This demo shows the capabilities of the NHL MCP Server")
# Demo 1: Current Standings
print_section("Current NHL Standings")
try:
standings = client.get_standings_now()
if 'standings' in standings:
for conference in standings['standings']:
print(f"\n{conference['conferenceName']} Conference:")
for team in conference['teams'][:3]: # Show top 3 teams
print(f" {team['teamName']['default']:20} - {team['wins']}W {team['losses']}L {team['otLosses']}OT ({team['points']} pts)")
except Exception as e:
print(f"Error getting standings: {e}")
# Demo 2: Player Spotlight
print_section("Players in the Spotlight")
try:
spotlight = client.get_player_spotlight()
if isinstance(spotlight, list):
for i, player in enumerate(spotlight[:5]): # Show first 5 players
if isinstance(player, dict) and 'name' in player:
print(f" {i+1}. {player.get('name', {}).get('default', 'Unknown Player')}")
if 'teamAbbrev' in player:
print(f" Team: {player['teamAbbrev']}")
except Exception as e:
print(f"Error getting player spotlight: {e}")
# Demo 3: Today's Scores
print_section("Today's NHL Scores")
try:
scores = client.get_daily_scores_now()
if 'games' in scores:
if scores['games']:
for game in scores['games'][:5]: # Show first 5 games
away_team = game.get('awayTeam', {}).get('abbrev', 'TBD')
home_team = game.get('homeTeam', {}).get('abbrev', 'TBD')
away_score = game.get('awayTeam', {}).get('score', 0)
home_score = game.get('homeTeam', {}).get('score', 0)
game_state = game.get('gameState', 'Unknown')
print(f" {away_team} {away_score} - {home_score} {home_team} ({game_state})")
else:
print(" No games scheduled for today")
except Exception as e:
print(f"Error getting scores: {e}")
# Demo 4: Connor McDavid Stats
print_section("Connor McDavid - Player Info")
try:
player_info = client.get_player_info(8478402) # Connor McDavid's ID
if isinstance(player_info, dict):
name = f"{player_info.get('firstName', {}).get('default', 'Connor')} {player_info.get('lastName', {}).get('default', 'McDavid')}"
team = player_info.get('currentTeamAbbrev', 'EDM')
position = player_info.get('position', 'C')
number = player_info.get('sweaterNumber', 97)
print(f" Name: {name}")
print(f" Team: {team}")
print(f" Position: {position}")
print(f" Number: #{number}")
# Show current season stats if available
if 'featuredStats' in player_info and 'regularSeason' in player_info['featuredStats']:
stats = player_info['featuredStats']['regularSeason']['subSeason']
print(f" Current Season: {stats.get('goals', 0)}G {stats.get('assists', 0)}A {stats.get('points', 0)}P")
except Exception as e:
print(f"Error getting player info: {e}")
# Demo 5: Available Tools Summary
print_section("Available MCP Tools")
tools = [
"Player Information:",
" • get_player_info(player_id)",
" • get_player_game_log(player_id, season, game_type)",
" • get_player_spotlight()",
"",
"Team Information:",
" • get_standings_now()",
" • get_club_stats_now(team)",
" • get_team_roster(team)",
" • get_team_schedule(team)",
"",
"Game Information:",
" • get_daily_scores_now()",
" • get_play_by_play(game_id)",
" • get_game_boxscore(game_id)",
"",
"Statistics:",
" • get_current_skater_stats_leaders()",
" • get_current_goalie_stats_leaders()",
"",
"Schedules & TV:",
" • get_schedule_now()",
" • get_tv_schedule_now()",
"",
"Utilities:",
" • get_team_codes()",
" • get_season_format_help()"
]
for tool in tools:
print(f" {tool}")
print_section("How to Use")
print("""
The NHL MCP Server provides access to comprehensive NHL data through MCP tools.
To run the server:
python nhl_mcp_server.py
To use with MCP clients like Claude Desktop, add to your config:
{
"mcpServers": {
"nhl-api": {
"command": "python",
"args": ["/path/to/nhl_mcp_server.py"]
}
}
}
Example queries you can ask an MCP client:
• "What are the current NHL standings?"
• "Show me Connor McDavid's stats"
• "What games are on today?"
• "Get the roster for the Toronto Maple Leafs"
• "Show me the current goal scoring leaders"
""")
print("\n🏒 NHL MCP Server Demo Complete!")
print("The server is ready for use with MCP clients.")
if __name__ == "__main__":
demo_nhl_mcp()