mcp server
macnet
macOS menu bar app: ping, network diagnosis (router / DNS / provider), history and read-only MCP access for AI agents
Set up
Runs on your computer. Pick your agent and operating system.
This project does not publish an install method we can turn into a config. Follow the README instead.
README
synced Oct 26, 2026MacNet
A small macOS menu bar app that tells you whether your internet works, how fast it answers, and — when it does not — where the problem is: your Wi‑Fi/router, DNS, or your provider.
Features
- Ping in the menu bar — a dot from green to red plus milliseconds (or just the dot, or colored numbers).
- Diagnosis — every check pings the target and your router and times a DNS lookup, then tells you: All good, Local network problem, DNS problem, Internet provider problem, Slow local network or No network.
- Addresses at a glance — local IP, external IP, router IP and DNS servers, each with a copy button.
- Adaptive interval — every 5 s by default: 2.5 s while the link is unstable, stretching to 25 s while it is stable; slower on battery and on metered or Low Data networks. Uses well under 1% CPU.
- History, kept forever — every minute is logged to a local SQLite database. Browse by day, week, month, year or all time, search outages (
provider,2026-10-14,>5m), and export CSV. - Outage journal — confirmed drops with their cause, uptime per day and downtime by cause.
- Network tools — Wi‑Fi signal and link rate, VPN detection, public IP, and an on-demand speed test (Apple's
networkQuality). - Notifications when the internet drops and comes back (debounced, no spam on flapping).
- Pause for 15 minutes, an hour, or until resumed.
- Agent access (MCP) — optional, read-only access for AI agents such as Claude Code. See below.
| Home | History |
|---|---|
| Network | Settings |
|---|---|
Requirements
- macOS 14 Sonoma or later
- Xcode 16 or later (Swift 6). Command Line Tools alone are not enough to run the tests.
Build and run
git clone https://github.com/SergKlein/macnet.git
cd macnet
scripts/bundle.sh
open build/MacNet.app
scripts/bundle.sh builds a release binary, wraps it into build/MacNet.app and signs it ad hoc. Move the app to /Applications if you want Launch at login.
Run the tests:
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test
Permissions macOS will ask for
| Permission | Why |
|---|---|
| Local Network | To ping your router. Without it macOS blocks LAN access and the router shows as unreachable. |
| Notifications | Optional, for "Internet connection lost / restored". |
| Location | Optional, only to show your Wi‑Fi network name (macOS hides it otherwise). Your location is never stored or sent. |
Privacy
MacNet talks to the network only to do its job:
- ICMP ping to your target (default
1.1.1.1) and your router; http://captive.apple.com/hotspot-detect.htmlevery ~10 s to tell "no internet" from "target not responding";- a DNS lookup of a random
*.apple.comname to time your resolver; https://1.1.1.1/cdn-cgi/tracefor your external IP — only when you open the menu (at most every 5 minutes) or press Refresh;- Apple's
networkQuality— only when you press Run speed test.
History stays on your Mac in ~/Library/Application Support/MacNet/macnet.sqlite. Nothing is uploaded.
Agent access (MCP)
MacNet can expose its state to AI agents over MCP (Streamable HTTP with SSE). It is off by default and read-only.
-
Open Settings… → Agent access and switch it on.
-
Press Copy Claude Code command and run it, for example:
claude mcp add --transport http macnet http://127.0.0.1:7341/mcp --header "Authorization: Bearer <token>"
Tools: get_status (including exactly what the menu bar shows), get_history, get_stats, list_targets, get_events, get_diagnosis, get_outages, get_network_details, get_history_stats, wait_for_state, wait_for_event. Resources macnet://status, macnet://history and macnet://events support subscriptions.
wait_for_state and wait_for_event let an agent verify behavior, e.g. "turn Wi‑Fi off and wait until MacNet reports offline".
Security: the server binds to 127.0.0.1 only, requires the bearer token, rejects non-loopback Origin headers, caps connections and request sizes, and never changes settings or runs a lookup or speed test on an agent's behalf.
Smoke test from a terminal:
scripts/mcp-smoke.sh <token>
Architecture
Swift Package with four modules:
| Module | Contents |
|---|---|
MacNetCore | Domain logic (state, diagnosis, jitter, outages, history roll-ups), ports (protocols for every I/O), the MonitorCoordinator actor, view models and the MCP protocol layer. Imports only Foundation and Observation. |
MacNetServer | Loopback MCP HTTP server on Network.framework. |
MacNetStorage | SQLite storage (system libsqlite3). |
MacNet | The app: adapters (/sbin/ping, NWPathMonitor, CoreWLAN, SystemConfiguration, UserNotifications, SMAppService), SwiftUI views and the composition root. |
No third-party dependencies. Swift 6 strict concurrency, zero warnings, swift format lint --strict clean.
License
Apache License 2.0 © 2026 Sergii Brul