Let your coding agent see what’s running on your Mac
Agents start dev servers without checking what’s already on port 3000, and can’t tell why the build got slow. An MCP server for system info lets them ask: which ports are taken, how loaded the machine is, what the last session left behind.
Updated
What an agent can’t see on its own
A coding agent sees your files and whatever its shell commands print. It doesn’t know that a next dev from yesterday is still on port 3000, that memory pressure is high because Docker is using 12 GB, or that its own last session left three watchers running. So it starts a second server on 3001, blames the code for a slow test run, or tells you everything is clean.
The Model Context Protocol fixes this by letting an agent call tools on a local server. A system-info server answers questions about the machine rather than the codebase.
The DIY route: allow read-only shell commands
The zero-install option is to let the agent run the commands you’d run. In Claude Code, allow them in .claude/settings.json so it doesn’t ask every time:
{
"permissions": {
"allow": [
"Bash(lsof -nP -iTCP -sTCP:LISTEN)",
"Bash(ps -axo pid,ppid,%cpu,rss,etime,command)",
"Bash(vm_stat)",
"Bash(pmset -g assertions)"
]
}
}
This works, with limits. The output is raw, so the agent spends tokens parsing it and still only learns node and a PID, not which project. There’s no safe kill: once you allow kill, the agent can stop anything you own.
Using Stat Space as the MCP server
Stat Space includes an MCP server in its free tier. The statspace binary inside the app runs it over stdio with --mcp, and it reads from the running app over a local socket, so answers come from data the app already collects.
Claude Code
One line, available in every project:
claude mcp add --scope user statspace -- /Applications/StatSpace.app/Contents/Helpers/statspace --mcp
Check it with claude mcp list, or /mcp inside a session.
Codex
Add to ~/.codex/config.toml:
[mcp_servers.statspace]
command = "/Applications/StatSpace.app/Contents/Helpers/statspace"
args = ["--mcp"]
Cursor, Claude Desktop, Windsurf
Add to ~/.cursor/mcp.json (or claude_desktop_config.json for Claude Desktop):
{
"mcpServers": {
"statspace": {
"command": "/Applications/StatSpace.app/Contents/Helpers/statspace",
"args": ["--mcp"]
}
}
}
statspace mcp-config prints all three snippets with the right path for your install, and Settings › CLI & MCP has them ready to copy. Stat Space has to be running for the tools to answer.
The tools
| Tool | What the agent gets |
|---|---|
list_ports | Every listening port with process, framework, project folder, launcher, uptime, URL and whether it’s exposed to the network |
whats_on_port | Who is on one port |
kill_port | Stops the process on a port; without confirm: true it only reports what would be stopped |
top_apps | Apps by CPU, memory or network, with helpers grouped under their app |
system_load | CPU (total, per core, load average), memory and pressure, swap, network, disk, GPU |
agent_sessions | Running and recently ended agent sessions with child processes, ports and leftovers |
orphans | Dev processes re-parented to launchd, with memory, age and ports |
cleanup_agent_leftovers | Stops what an ended session left behind; also needs confirm: true |
keep_awake | Keeps the Mac awake for a duration, until a time or indefinitely |
sleep_blockers | Apps holding assertions that stop the Mac or display sleeping |
explain_slowness | Plain-English answer to “why is my Mac slow?” (Pro) |
what_is_process | What a cryptic process name is |
Prompts that use it well
Once it’s connected, you can ask in plain language:
- “Before you start the dev server, check whether port 3000 is free. If it’s ours from earlier, reuse it.”
- “The tests got slow. Check system load and top apps before changing any code.”
- “We’re done. List anything this session left running and ask me before stopping it.”
- “Keep the Mac awake for 2 hours while you run the migration.”
You can also put the first and third in your project’s CLAUDE.md or AGENTS.md so the agent does them by default.
From your own terminal
The same data is available to you with the statspace CLI: statspace ports, statspace load, statspace agents, statspace orphans, with --json on any command for scripts. More on the CLI and MCP feature.
Questions
Why not just let the agent run lsof and ps?
It can, and for one-off questions that’s fine. A dedicated server returns structured answers (project, launcher, exposure) in one call instead of several shell commands to parse, and its kill tools ask for confirmation instead of relying on the agent to be careful.
Does an MCP server cost context tokens?
A little. Claude Code defers tool definitions by default, so only tool names enter context until one is used. Run /context to see what each server costs.
Can the agent kill processes through it?
Only through explicit tools such as kill_port, and Stat Space’s versions return what would be stopped unless the call includes confirm: true, so the agent has to ask you first. System processes are always refused.
Know what your Mac is doing, without adding to it.
Free, no account. Pro is $9.99 once for the first 100 buyers.