mem
MCP server for live process memory introspection and debugging on Linux x86_64. Enables reading/writing process memory, searching patterns, ptrace attach/registers, running commands, and valgrind execution.
README
mem — MCP server for process memory introspection
Live process memory introspection, debugger, and valgrind runner. Linux-only (x86_64). Runs as an MCP stdio server for the pi agent.
Tools
| Tool | What it does |
|---|---|
maps |
Read /proc/<pid>/maps — memory layout of a running process |
mem_read |
Read bytes from a process's address space (process_vm_readv) |
mem_write |
Write bytes into a process's address space (process_vm_writev) |
mem_search |
Search process memory for a hex byte pattern |
run |
Spawn a command as a child of this server (makes it inspectable) |
children |
List supervised child processes |
attach |
ptrace-attach to a process (stops it) |
registers |
Read CPU registers (PTRACE_GETREGS, x86_64) |
detach |
ptrace-detach from a process (resumes it) |
valgrind_run |
Run a command under valgrind |
valgrind_status |
Poll a running valgrind job |
Requirements
- Linux (process_vm_readv/writev, ptrace, /proc)
ptrace_scope= 0 (or useruntool to spawn child processes)- valgrind (optional, for valgrind_run)
ptrace_scope limitation
On Ubuntu (default ptrace_scope=1), process_vm_readv and ptrace only
work on direct child processes of the MCP server. To inspect a program:
- Use
runto spawn it — the server is its parent, all tools work - Or set
ptrace_scope=0:echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - Or use
CAP_SYS_PTRACE
The run tool makes the child fully inspectable without any sysadmin
changes.
Debugging workflow
1. run → spawns the target program, returns PID
2. maps → read its memory layout
3. mem_read → read bytes from any address
4. attach → ptrace-stop the process
5. registers → read CPU registers (rip, rsp, rax, etc.)
6. mem_write → patch a variable or instruction
7. detach → resume execution
8. valgrind_run → check for memory errors
Wiring
pi.mcpServers in package.json declares the server; the hub merges it
into pi's mcp.json when the package is registered (this workspace is a
watched hub workspace, so a new package dir wires itself). The command is
relative to this dir on purpose — hub resolves it. Build first, then restart
pi: pi reads mcp.json at startup.
mem stays wired by default: it is the live-process debugger for Rust/Odin/etc.
binaries (ptrace introspection + valgrind runner). Reach for it when a binary
leaks, crashes in ways rustc can't explain, or grows RSS — pair the valgrind_run
tool with the valgrind skill's prose for the flags and quirks.
Build
cd /home/feb/dev/_pi_extensions/mem
cargo build --release
Safety
mem_writecan crash or corrupt the target process.attachstops the target process. Alwaysdetachwhen done.- valgrind jobs run with a timeout (default 300s).
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.