Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions OS_mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ def get_system_overview() -> str:
# CPU info
cpu_count = psutil.cpu_count(logical=False)
cpu_logical = psutil.cpu_count(logical=True)
cpu_freq = psutil.cpu_freq()
try:
cpu_freq = psutil.cpu_freq()
except AttributeError:
cpu_freq = None # psutil.cpu_freq() not available on Apple Silicon
cpu_percent = psutil.cpu_percent(interval=1, percpu=False)

# Memory info
Expand Down Expand Up @@ -1801,7 +1804,10 @@ def diagnose_slow_performance() -> str:
result += "**1️⃣ CPU ANALYSIS:**\n"
cpu_percent = psutil.cpu_percent(interval=2)
cpu_count = psutil.cpu_count()
cpu_freq = psutil.cpu_freq()
try:
cpu_freq = psutil.cpu_freq()
except AttributeError:
cpu_freq = None # psutil.cpu_freq() not available on Apple Silicon

result += f"• Usage: {cpu_percent}%\n"
result += f"• Cores: {cpu_count}\n"
Expand Down Expand Up @@ -1995,7 +2001,10 @@ def get_power_settings() -> str:
result += "• System is running on AC power\n\n"

# CPU frequency (can indicate power mode)
cpu_freq = psutil.cpu_freq()
try:
cpu_freq = psutil.cpu_freq()
except AttributeError:
cpu_freq = None # psutil.cpu_freq() not available on Apple Silicon
if cpu_freq:
result += "**CPU POWER STATE:**\n"
result += f"• Current Frequency: {cpu_freq.current:.0f} MHz\n"
Expand Down