Go Process Inspector
@monsterxx03
Non-Invasive goroutine inspector
概览
What is Go Process Inspector?
Go Process Inspector (gospy) is a tool for inspecting and analyzing running Go processes. It provides detailed goroutine states, memory statistics, and binary information via a CLI, terminal UI, HTTP API, and an MCP (Model Context Protocol) server. It is intended for developers debugging or profiling Go applications on Linux and macOS.
How to use Go Process Inspector?
Install with go install github.com/monsterxx03/gospy@latest. Use sudo gospy top --pid <pid> for interactive TUI, sudo gospy summary --pid <pid> for a summary, or sudo gospy serve --port 8974 to start the HTTP API. To enable the MCP server, run sudo gospy serve --enable-mcp --port 8974. Root privileges are required on both Linux and macOS.
Use cases of Go Process Inspector
- Debugging goroutine leaks by inspecting goroutine states and scheduling info
- Analyzing memory statistics of a running Go application
- Monitoring Go processes via a programmatic HTTP API
- Interactive process inspection with a terminal UI
- Integrating with AI assistants via the MCP server tools
FAQ from Go Process Inspector
What operating systems does Go Process Inspector support?
Linux and macOS (Apple Silicon only).
Does Go Process Inspector require root privileges?
Yes, it requires root (sudo) to read process memory and access Mach APIs on macOS.
What MCP tools are available?
The MCP server exposes tools: goroutines (dump goroutines), gomemstats (dump memory stats), goruntime (dump runtime info), and pgrep (find PID by process name).
What dependencies does Go Process Inspector have?
Go 1.20+ is required to build from source.
How can I get process summary data in a structured format?
Use the --json flag with the summary command: sudo gospy summary --pid <pid> --json.
What transport does the MCP server use?
The MCP server provides an HTTP (streamableHTTP) endpoint at /mcp.