Sandbox
@monsterxx03/gospy

Go process inspector with CLI, TUI, and MCP server

gospy inspects running Go processes and shows goroutines, memory stats, runtime info, and binary data. It works as an interactive terminal UI, an HTTP API, and an MCP server for agent tools.

96 stars5 forksGoUpdated 1y ago
Who it's for

Builders who need to inspect a running Go process from the terminal or through an MCP client.

What it delivers

You can debug a live Go process without attaching a full profiler or reworking the app.

What it does

Goroutine inspection

Lists goroutines with status and scheduling details for a selected process.

Memory statistics

Reads memory stats from the target Go process.

Runtime and binary info

Shows runtime version info and can use binary paths for process summaries.

Terminal UI

Provides an interactive `top` view with refresh, pause, quit, and search controls.

HTTP API

Serves `/goroutines`, `/memstats`, and `/runtime` endpoints for programmatic access.

MCP server

Exposes `goroutines`, `gomemstats`, `goruntime`, and `pgrep` tools over `/mcp`.

How to get it

  1. 1Run
    go install github.com/monsterxx03/gospy@latest
  2. 2The MCP server provides an http (streamableHTTP) endpoint. To enable
    >>> sudo gospy serve --enable-mcp --port 8974
    
    Starting API server on port 8974
    Endpoints:
      GET /runtime?pid=<PID>     - Get runtime info
      GET /goroutines?pid=<PID> - Get goroutines list
      GET /memstats?pid=<PID>   - Get memory stats
      GET /mcp   - MCP http endpoint

README

Go Process Inspector

Go Report Card License Install MCP Server

A tool for inspecting and analyzing running Go processes, including goroutine states, memory statistics, and binary information.

Features

  • View detailed goroutine information (status, scheduling info)
  • Analyze process memory statistics
  • Cross-platform support (Linux and macOS)
  • Terminal UI for interactive inspection
  • HTTP API for programmatic access
  • mcp server

Installation

go install github.com/monsterxx03/gospy@latest

Usage

CLI Interface

# Interactive terminal UI
sudo gospy top --pid <pid>

# HTTP API server
sudo gospy serve --port 8974

# Get process summary
sudo gospy summary --pid <pid>

# Get process summary in JSON format
sudo gospy summary --pid <pid> --json

Summary Command Options

  • --pid/-p - Target process ID (required)
  • --bin/-b - Path to binary file (optional)
  • --json/-j - Output results in JSON format

API Endpoints

  • GET /goroutines?pid=<pid> - List all goroutines
  • GET /memstats?pid=<pid> - Get memory statistics
  • GET /runtime?pid=<pid> - Get runtime version info

MCP Server

The MCP server provides an http (streamableHTTP) endpoint. To enable:

>>> sudo gospy serve --enable-mcp --port 8974

Starting API server on port 8974
Endpoints:
  GET /runtime?pid=<PID>     - Get runtime info
  GET /goroutines?pid=<PID> - Get goroutines list
  GET /memstats?pid=<PID>   - Get memory stats
  GET /mcp   - MCP http endpoint

Available MCP tools:

  • goroutines - Dump goroutines for a go process
  • gomemstats - Dump memory stats for a go process
  • goruntime - Dump runtime info for a go process
  • pgrep - Find pid from process name

Config in cursor

Terminal UI Controls

  • q - Quit
  • r - Refresh data
  • s - Suspend/Resume top view
  • / - Search/filter goroutines

Terminal UI Screenshot

Terminal UI Screenshot

Building from Source

git clone https://github.com/monsterxx03/gospy.git
cd gospy
make

Requirements

  • Go 1.20+
  • Linux or macOS (Apple Silicon only)
  • Root privileges (required for memory access)

Root Privileges

gospy requires root privileges to:

  • Read process memory (/proc//mem on Linux)
  • Access Mach APIs on macOS

Run with sudo:

sudo gospy top --pid <pid>

For development/debugging, you may want to:

  1. Build the binary first: make
  2. Run with sudo: sudo ./gospy [command]

Credits

Version 0.7.0 was completely rewritten from scratch with aider, which wrote >90% of the code. Additional assistance from:

  • DeepSeek (R1 + V3 models) - AI coding assistant

Total AI compute cost: ~$2 USD

License

MIT - See LICENSE file for details.

Files in the repo

Repository payload13 top-level entries
  • .github
  • pkg
  • screenshots
  • test_server
  • .aider.conf.yml
  • .gitignore
  • docker-compose.yml
  • go.mod
  • go.sum
  • LICENSE
  • main.go
  • Makefile
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k