# Architecture
Source: https://docs.pwno.io/architecture
Project structure and runtime design decisions behind pwno-mcp.
`pwno-mcp` combines a FastMCP server, a session registry, debugger backends, and helper tool families into a single stateful runtime.
## Main runtime surfaces
FastMCP endpoint served at `/mcp` with `/healthz` for simple health checks.
Local process-based MCP mode for clients that cannot use HTTP.
Local FastAPI helper that wraps process-attach workflows on `/attach`.
Keeps separate GDB state, runtime directories, and optional driver metadata per session.
## Tool families
* debugger control in `pwnomcp/tools/debug.py`
* inspection in `pwnomcp/tools/inspect.py`
* process helpers in `pwnomcp/tools/processes.py`
* managed Python helpers in `pwnomcp/tools/python_env.py`
* interactive exploit-driver flows in `pwnomcp/tools/pwncli.py`
* repo acquisition in `pwnomcp/tools/repos.py`
* RetDec integration in `pwnomcp/tools/retdec.py`
## Project structure
## Key design decisions
### Stateful sessions
The runtime keeps debugger state alive across calls instead of treating every request as a stateless shell command.
### GDB/MI-native control
Execution-control tools prefer MI commands because they are structured and more reliable for agents than parsing free-form terminal output.
### Separation of concerns
The router registers tools, while most implementation logic lives in dedicated backend or tool modules.
### Container-oriented runtime
The project assumes containerized execution with a mounted `/workspace` and explicit ptrace capabilities.
# Background Story
Source: https://docs.pwno.io/background-story
How pwno-mcp evolved through several iterations before becoming the current open-source project.
Below is the background story of `pwno-mcp` before it became the current open-source project. Written by [Ruikai](https://ruik.ai).
## Where it came from
This version was a result of literation of redesigning, thinking and researching for around 6 month on this problem of "making a Pwn MCP for LLMs":
1. I first tried writing a `gdb` pluging and executing via gdb python api ([autogdb.io](https://autogdb.io)), integrating MCP backend on a single backend, authorization by rewriting bit low-level implementation of early MCP's SSE (this was around March, see [this post](https://x.com/retr0reg/status/1906206719576883670)): **Didn't work out well**, since first of capturing program stdio was a problem for `gdb` apis (we did tried delimeters but another story regarding timing we will mention later), while stopping multi-thread binary is bit problematic (makes the entire part of actual executing pretty much unusable) although this version was pretty scalable with only one command backend was enough. (autogdb was only solving the problem of connecting from you're debugging (research) machine to agent client for research), it sounds easy but it was mixed with jumping between frontend, auth and specific compatibilization problem.
2. After realizing the scability problem of [autogdb.io](https://autogdb.io), I started this idea of bring even the entire research environment on cloud with scable pre-configured environments. Tons of time learning and making mistakes in k8s specifically gke, pretty much starting learning everything fron thin air. We got a working MVP on around 2 weeks diving into this (back then I still have my AP exams). Anyway backend it's still a major problem of "how to start a environment for everyone, and how to let everyone access their own environment?" We still sticked with the original centralized MCP backend approach, but this time we assign a k8s stream channel for each users, and use these io channels on one hand to natively interact with gdb (with delimiters), *this was still intended to solve the problem of program IO capturing, it's a trick problem*, I then thought about you should also let users see their gdb session on cloud, so I came up with the approach of duplicating a stdio channel back into frontend via k8s's stream and websockets, with around 2 months of development, we got our pwno.io up-and-running, but still tons of problem that spent incredible amount of time that i didnt mentioned, from gke integration to network issues.
3. [pwno.io](https://pwno.io) was working *I can't say well, but at a working level*, there's still asynchroization problems and gke native problems but we managed to solve the most pain-in-the-ass scability, interactive IO problem that we spent around by far 3 months on. This is when I started working on pwnuous our cooperation with GGML, which will need a new thing like the previous version of pwno-mcp but for more stable support. Since for previous version, we're plugged into GDB via direct IO stream, asynchroization problem as I mentioned was another huge pain-in-the-ass, some IO slipped away and it just not stable enough for use. This is when I started thinking rewriting everything, and throw away some part just for usability for LLMs and it's full agentic compatabilization. I was working on my black hat talk back then so thought a little about statefulness, learnt about this wonderful thing that just seem to be born for us [GDB/MI (Debugging with GDB)](https://sourceware.org/gdb/current/onlinedocs/gdb.html/GDB_002fMI.html), I spent few days rewriting the entire thing by reading docs. I definited did spent less time conceptualizing backend architecture for pwno.io for this version of `pwno-mcp` *(around 2 days mainly on gke gateway things)*, it's definite not a very elaborate or sophisticated framework by all mean, but it did came from a shit tons of experience of trial-and-erroring my self while thinking about the question of making something that's can scale *(multi-agent, researcher using it)*, so I will say it's by far the best conceptualizations and work to best serve for the purpose of LLMs using it stabiliy and scability. And I do think it's the best time or the now-or-never time to open-source it, or this project or Pwno will die from lack of feedback loop, despite `pwno-mcp` is a little part of what we're doing.
## Use and licensing
* non-profit: yes, feel free to
* commercial: `oss@pwno.io`
# Claude Code
Source: https://docs.pwno.io/client-setup/claude-code
Connect pwno-mcp to Claude Code over HTTP or stdio.
Claude Code supports both remote HTTP MCP servers and local stdio MCP servers.
HTTP is usually the better default for Claude Code because the server stays running independently of the client process.
Start `pwno-mcp` in HTTP mode if you want Claude Code to connect to a long-running server.
Use stdio if you want Claude Code to spawn Docker directly and keep the MCP definition project-local in `.mcp.json`.
```bash HTTP theme={null}
claude mcp add --transport http --scope project pwno-mcp http://127.0.0.1:5500/mcp
```
```bash stdio theme={null}
claude mcp add --transport stdio --scope project pwno-mcp -- \
docker run --rm -i \
--cap-add=SYS_PTRACE \
--cap-add=SYS_ADMIN \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v "/ABSOLUTE/PATH/TO/YOUR/PROJECT/workspace:/workspace" \
ghcr.io/pwno-io/pwno-mcp:latest \
--stdio
```
After HTTP setup, run `/mcp` in Claude Code to confirm the server is connected.
## Helpful commands
```bash theme={null}
claude mcp list
claude mcp get pwno-mcp
```
After setup, run `/mcp` in Claude Code and confirm that `pwno-mcp` appears as a connected server.
# Claude Desktop
Source: https://docs.pwno.io/client-setup/claude-desktop
Configure pwno-mcp for Claude Desktop over stdio.
Claude Desktop uses a local stdio MCP server definition.
## Config file location
* macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
* Linux: `~/.config/Claude/claude_desktop_config.json`
Use an absolute host path for the workspace mount. Claude Desktop will not expand project-local placeholders such as `${workspaceFolder}` in this config.
```json theme={null}
{
"mcpServers": {
"pwno-mcp": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--cap-add=SYS_PTRACE",
"--cap-add=SYS_ADMIN",
"--security-opt",
"seccomp=unconfined",
"--security-opt",
"apparmor=unconfined",
"-v",
"/ABSOLUTE/PATH/TO/YOUR/PROJECT/workspace:/workspace",
"ghcr.io/pwno-io/pwno-mcp:latest",
"--stdio"
]
}
}
}
```
Restart Claude Desktop after editing the config, then confirm `pwno-mcp` appears in the MCP server list.
# Codex CLI
Source: https://docs.pwno.io/client-setup/codex-cli
Connect pwno-mcp to Codex CLI over HTTP or stdio.
Codex CLI uses `~/.codex/config.toml` for MCP configuration.
```toml HTTP theme={null}
[mcp_servers.pwno-mcp]
url = "http://127.0.0.1:5500/mcp"
```
```toml stdio theme={null}
[mcp_servers.pwno-mcp]
command = "docker"
args = [
"run",
"--rm",
"-i",
"--cap-add=SYS_PTRACE",
"--cap-add=SYS_ADMIN",
"--security-opt",
"seccomp=unconfined",
"--security-opt",
"apparmor=unconfined",
"-v",
"/ABSOLUTE/PATH/TO/YOUR/PROJECT/workspace:/workspace",
"ghcr.io/pwno-io/pwno-mcp:latest",
"--stdio"
]
```
## Check configuration
```bash theme={null}
codex mcp list
```
Once `pwno-mcp` appears in `codex mcp list`, you can start issuing normal agent prompts that reference the server by name.
# Cursor
Source: https://docs.pwno.io/client-setup/cursor
Configure pwno-mcp for Cursor using HTTP or stdio transport.
Cursor MCP configuration can live in either of these files:
* Project: `.cursor/mcp.json`
* Global: `~/.cursor/mcp.json`
If you use project config, keep your target binary under `PROJECT_ROOT/workspace/`.
```json HTTP theme={null}
{
"mcpServers": {
"pwno-mcp": {
"url": "http://127.0.0.1:5500/mcp"
}
}
}
```
```json stdio theme={null}
{
"mcpServers": {
"pwno-mcp": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--cap-add=SYS_PTRACE",
"--cap-add=SYS_ADMIN",
"--security-opt",
"seccomp=unconfined",
"--security-opt",
"apparmor=unconfined",
"-v",
"${workspaceFolder}/workspace:/workspace",
"ghcr.io/pwno-io/pwno-mcp:latest",
"--stdio"
]
}
}
}
```
Open Cursor's MCP panel after saving the config and confirm the server is connected before starting debugger workflows.
# OpenCode
Source: https://docs.pwno.io/client-setup/opencode
Configure pwno-mcp for OpenCode with remote HTTP or local stdio.
OpenCode supports remote HTTP MCP servers and local stdio commands.
## Config locations
* Global: `~/.config/opencode/opencode.json`
* Project-local: `opencode.json`
```json HTTP theme={null}
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"pwno-mcp": {
"type": "remote",
"url": "http://127.0.0.1:5500/mcp",
"enabled": true
}
}
}
```
```json stdio theme={null}
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"pwno-mcp": {
"type": "local",
"command": [
"docker",
"run",
"--rm",
"-i",
"--cap-add=SYS_PTRACE",
"--cap-add=SYS_ADMIN",
"--security-opt",
"seccomp=unconfined",
"--security-opt",
"apparmor=unconfined",
"-v",
"/ABSOLUTE/PATH/TO/YOUR/PROJECT/workspace:/workspace",
"ghcr.io/pwno-io/pwno-mcp:latest",
"--stdio"
],
"enabled": true
}
}
}
```
## Helpful commands
* `opencode mcp add`
* `opencode mcp list`
After setup, run `opencode mcp list` and confirm `pwno-mcp` is enabled before opening your target project.
# Response Shapes
Source: https://docs.pwno.io/concepts/response-shapes
Understand how pwno-mcp tools return structured data, JSON strings, and errors.
Not every `pwno-mcp` tool returns data in exactly the same shape. This matters when you are wiring the server into an agent or building wrappers around it.
## Main response families
| Tool family | Typical shape | Notes |
| ----------------------------------------- | --------------------- | ---------------------------------------------------------- |
| debugger and inspection tools | structured object | usually includes `success` and session-specific fields |
| `pwncli` tools | structured object | includes session-aware I/O or event data |
| process, Python, repo, and RetDec helpers | JSON-formatted string | parse the string if your client does not already coerce it |
| `attach` debugger tool | two-part result | returns the attach result plus a context snapshot list |
| attach sidecar API | structured object | response model has `successful`, `attach`, and `result` |
## Structured object example
Debugger tools such as `set_file`, `run`, `get_context`, and `set_breakpoint` return objects directly.
```json theme={null}
{
"success": true,
"session_id": "chal-a"
}
```
On failure they follow the common error envelope:
```json theme={null}
{
"success": false,
"error": "Debug session 'chal-a' not found",
"type": "RuntimeError"
}
```
## JSON-string helper example
Automation helpers such as `run_command`, `spawn_process`, `execute_python_code`, `fetch_repo`, `get_retdec_status`, and `get_decompiled_code` return JSON strings.
```json theme={null}
"{\n \"success\": true,\n \"returncode\": 0,\n \"stdout\": \"...\"\n}"
```
If you are writing your own integration, do not assume every tool already returns a parsed object. Some helpers intentionally serialize their result with `json.dumps(..., indent=2)`.
## Attach-specific shapes
There are two attach surfaces:
* the MCP `attach` tool returns an attach result plus a list of context snapshots
* the HTTP `/attach` helper API returns a single object with this shape:
```json theme={null}
{
"successful": true,
"attach": {
"success": true,
"pid": 31337,
"session_id": "chal-a"
},
"result": {
"set-file": {
"success": true
}
}
}
```
## Practical advice
* Treat debugger and `pwncli` tools as object-returning tools.
* Treat process, Python, repo, and RetDec tools as string-returning helpers unless your client parses them for you.
* When handling failures, always look for `success`, `error`, and `type` before assuming a result shape.
* When handling attach flows, account for the extra context data or the attach-sidecar wrapper object.
# Sessions
Source: https://docs.pwno.io/concepts/sessions
Understand session_id, runtime directories, and how pwno-mcp keeps debugger state alive.
Every meaningful debugger workflow in `pwno-mcp` is scoped to a `session_id`.
## What a session contains
A debug session bundles together:
* one GDB controller instance
* one `SessionState` record for binary path, pid, state, and breakpoints
* one session-specific `runtime_dir`
* an optional `pwncli` driver PID tied to the same session
The server creates a default session at startup, but most real workflows should still use explicit session names so parallel tasks stay isolated and easy to reason about.
## Lifecycle
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
```
`create_debug_session` returns the existing session when that id already exists.
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
{"tool":"run","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"get_session_info","arguments":{"session_id":"chal-a"}}
{"tool":"list_debug_sessions","arguments":{}}
```
```json theme={null}
{"tool":"close_debug_session","arguments":{"session_id":"chal-a"}}
```
Closing a session also stops any attached `pwncli` driver for that session.
## Why explicit session IDs matter
* They let you keep multiple binaries or exploit strategies active at the same time.
* They prevent one agent thread from clobbering another thread's breakpoints or process state.
* They give every session its own `runtime_dir`, which is where inline `pwncli` scripts are written.
## Multi-session pattern
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
{"tool":"create_debug_session","arguments":{"session_id":"chal-b"}}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal-a","session_id":"chal-a"}}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal-b","session_id":"chal-b"}}
```
Use short, stable names such as `chal-a`, `remote`, `patched`, or `heap-lab` instead of random ids. It makes agent planning and human debugging much easier.
## Related pages
* [Workspace Paths](/concepts/workspace-paths)
* [First Debug Session](/guides/first-debug-session)
* [Debug Sessions Reference](/tool-reference/debug-sessions)
# Transports and Runtime
Source: https://docs.pwno.io/concepts/transports-and-runtime
HTTP, stdio, health checks, attach sidecar behavior, and runtime defaults.
`pwno-mcp` supports two main runtime modes.
* Main MCP endpoint defaults to `http://127.0.0.1:5500/mcp`
* Health endpoint defaults to `http://127.0.0.1:5500/healthz`
* Local attach helper API defaults to `http://127.0.0.1:5501/attach`
* Best when your client wants a `url` or you want the server process to stay alive outside the client
* The client launches `python -m pwnomcp --stdio` or the equivalent Docker command
* No HTTP endpoint is involved
* Best when your client expects a local `command` and `args`
* The attach sidecar is not started in stdio mode
## CLI defaults
| Flag | Default | Purpose |
| --------------- | ----------- | -------------------------------- |
| `--host` | `0.0.0.0` | main HTTP bind host |
| `--port` | `5500` | main HTTP port |
| `--attach-host` | `127.0.0.1` | attach API bind host |
| `--attach-port` | `5501` | attach API port |
| `--http-path` | `/mcp` | HTTP transport path |
| `--stdio` | disabled | switches runtime into stdio mode |
## Example launches
```bash HTTP theme={null}
python -m pwnomcp
```
```bash Custom HTTP theme={null}
python -m pwnomcp --host 0.0.0.0 --port 6600 --http-path /mcp
```
```bash stdio theme={null}
python -m pwnomcp --stdio
```
## Runtime surfaces
* `/mcp` is the main FastMCP transport path in HTTP mode
* `/healthz` returns a simple JSON status payload for health checks
* `/attach` is a helper API for process-attach workflows driven by the local Python helper or external automation
The attach API is separate from the main MCP transport. It exists to make some attach workflows simpler for local helper scripts and integrations.
## Which mode should you use?
* choose HTTP for persistent local servers, remote clients, and easy health checks
* choose stdio for clients that only support local process-based MCP servers
* keep the Docker capability and security flags the same in both modes
# Workspace Paths
Source: https://docs.pwno.io/concepts/workspace-paths
How pwno-mcp resolves file paths, working directories, and runtime artifacts.
`pwno-mcp` is designed around a container-visible workspace rooted at `/workspace`.
## The core rule
Pass file paths that resolve inside `/workspace`.
* `/workspace/chal`
* `/workspace/build/vuln`
* `chal`
* `build/vuln`
* `/tmp/chal`
* `/home/you/chal`
* `/Users/name/project/chal`
* any host path that is not mounted into the container
## Relative path behavior
When a tool accepts a path or `cwd`, relative values are resolved under `/workspace`.
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"chal","session_id":"chal-a"}}
{"tool":"run_command","arguments":{"command":"make","cwd":"build"}}
```
These resolve to `/workspace/chal` and `/workspace/build` inside the server runtime.
## Host path mapping
If your Docker mount is:
```text theme={null}
$PWD/workspace:/workspace
```
then a host file like `./workspace/chal` becomes `/workspace/chal` in tool calls.
Tools cannot see arbitrary host filesystem paths. If a file is not inside the mounted workspace, it is not available to the server.
## Runtime artifacts vs workspace files
Not everything lives in `/workspace`.
* user-visible targets, source files, helper scripts, and cloned repos live in `/workspace`
* server-managed runtime artifacts live under `PWNO_RUNTIME_ROOT`
* session runtime directories are created under that runtime root, not under `/workspace`
By default, `PWNO_RUNTIME_ROOT` falls back to a temp directory similar to `/tmp/pwno`.
## Common path-sensitive tools
* `set_file`, `pwncli`, and `execute_python_script` resolve binary or script paths under `/workspace`
* `run_command`, `spawn_process`, and `execute_python_code` resolve `cwd` under `/workspace`
* `fetch_repo` defaults to cloning into `/workspace/` when `target_dir` is omitted
If a tool says a path was not found, first confirm the host file is inside `./workspace`, then retry with the in-container form like `/workspace/`.
# Contributing
Source: https://docs.pwno.io/contributing
How to contribute code or documentation to pwno-mcp.
Contributions are welcome.
## Before opening a pull request
1. Sync dependencies with `uv sync --locked --extra dev`.
2. Run formatting, type checking, and tests.
3. Keep changes small and focused.
4. Update `README.md` or `docs/` when behavior changes.
## Validation commands
```bash theme={null}
uv run black --check .
uv run mypy pwnomcp --ignore-missing-imports --disable-error-code=import-untyped
uv run pytest -v
```
## Documentation expectations
* keep Mintlify navigation in `docs/docs.json` aligned with new pages
* use the existing product vocabulary: sessions, `/workspace`, HTTP vs stdio, and tool families
* prefer short, workflow-oriented examples over long README-style narrative
# Development
Source: https://docs.pwno.io/development
Local development, verification commands, and docs preview for maintainers.
This page is for working on `pwno-mcp` itself, not for debugging a target binary.
## Local development
Prerequisites on the host are Python 3.12+, GDB with Python support, and a working pwndbg setup.
```bash uv theme={null}
uv sync
uv run python -m pwnomcp
uv run python -m pwnomcp --stdio
```
```bash pip theme={null}
python -m pip install -e ".[dev]"
python -m pwnomcp
python -m pwnomcp --stdio
```
## Verification commands
```bash theme={null}
uv run black --check .
uv run mypy pwnomcp --ignore-missing-imports --disable-error-code=import-untyped
uv run pytest -v
```
## Docs preview
```bash theme={null}
npm --prefix docs run dev
```
## CI snapshot
Current GitHub Actions run these verification steps before build or publish:
* `uv sync --locked --extra dev`
* `uv run black --check .`
* `uv run mypy pwnomcp --ignore-missing-imports --disable-error-code=import-untyped`
* `uv run pytest -v`
# Attach to a Running Process
Source: https://docs.pwno.io/guides/attach-to-running-process
Use the debugger attach tool or the attach sidecar API to join an existing process.
Use attach flows when the target is already running and you want `pwno-mcp` to join that process instead of starting it with `run`.
## Option 1: MCP tool attach
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
```
This helps when symbol loading matters before the attach.
```json theme={null}
{"tool":"attach","arguments":{"pid":31337,"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"get_context","arguments":{"context_type":"backtrace","session_id":"chal-a"}}
```
## Option 2: Attach sidecar API
The local HTTP attach helper is useful for external scripts and wrappers. It is only started in HTTP mode.
```json HTTP request theme={null}
{
"pre": ["set pagination off"],
"pid": 31337,
"after": ["info threads"],
"where": "/workspace/chal",
"session_id": "chal-a"
}
```
```python Python helper theme={null}
from pwnomcp.cli import attach
response = attach(
pid=31337,
session_id="chal-a",
gdbscript=["set pagination off"],
artifact_path="/workspace/chal",
)
print(response.model_dump())
```
Attach flows still require the same ptrace-related Docker capabilities as normal debugger control.
## When to use which path
* use the MCP `attach` tool inside normal agent flows
* use the attach sidecar API when you already have a local helper script or external integration that wants a simple HTTP entrypoint
See [Attach API Reference](/tool-reference/attach-api) for the full request and response contract.
# Build and Helper Processes
Source: https://docs.pwno.io/guides/build-and-helper-processes
Use run_command, spawn_process, Python helpers, and repo fetching without colliding with debugger flows.
`pwno-mcp` includes automation tools for build steps and helper services, but they are intentionally separate from debugger control.
Use for compiles, build scripts, and short-lived helper commands.
Use for long-running helper processes such as local HTTP servers or listeners.
Use for quick Python probes instead of `python -c`.
Use for cloning helper repositories into `/workspace`.
## Example flow
```json theme={null}
{"tool":"run_command","arguments":{"command":"gcc -g vuln.c -o chal","cwd":"/workspace","timeout":30.0}}
```
```json theme={null}
{"tool":"spawn_process","arguments":{"command":"python3 -m http.server 8000","cwd":"/workspace"}}
```
```json theme={null}
{"tool":"get_process","arguments":{"pid":12345}}
{"tool":"kill_process","arguments":{"pid":12345,"signal":15}}
```
## Guardrails
* do not use `run_command` or `spawn_process` to start the target ELF you want to debug
* do not use `python -c` inside `run_command`; use `execute_python_code` instead
* use `pwncli` when you need interactive exploit-driver I/O instead of a generic subprocess
The subprocess backend actively rejects some unsafe usage patterns and returns a `ToolUsageError`-style payload with a recommended tool when you pick the wrong interface.
# First Debug Session
Source: https://docs.pwno.io/guides/first-debug-session
Create a session, load a binary, stop at main, inspect state, and step once.
This is the canonical first-run debugger workflow for `pwno-mcp`.
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
```
```json theme={null}
{"tool":"set_breakpoint","arguments":{"location":"main","session_id":"chal-a"}}
```
```json theme={null}
{"tool":"run","arguments":{"args":"","start":false,"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"get_context","arguments":{"context_type":"all","session_id":"chal-a"}}
{"tool":"get_memory","arguments":{"address":"$rsp","size":64,"format":"hex","session_id":"chal-a"}}
```
```json theme={null}
{"tool":"step_control","arguments":{"command":"n","session_id":"chal-a"}}
```
At this point you should have a stable named session you can continue using for more breakpoints, raw `execute` commands, or an interactive `pwncli` flow.
## Useful follow-ups
* use `finish` to run out of the current function
* use `until` to run until a location or next source line
* use `gdb_interrupt` if the inferior is still running and you need to regain control
See [Debug Sessions Reference](/tool-reference/debug-sessions) for the full command set.
# Guides
Source: https://docs.pwno.io/guides/index
Task-oriented walkthroughs for common pwno-mcp workflows.
Use the guides when you want a working sequence, not just a tool description.
Create a session, load a binary, stop at `main`, and inspect state.
Join an existing PID with either the MCP attach tool or the local attach helper API.
Start a `pwncli` driver, send input, read output, and collect events.
Keep several debugger or exploit flows active without state collisions.
Use helper commands, background services, Python helpers, and repo fetches safely.
## Recommended order
1. Start with [First Debug Session](/guides/first-debug-session).
2. Move to [Attach to a Running Process](/guides/attach-to-running-process) when the target is already alive.
3. Use [Interactive Exploit Loop](/guides/interactive-exploit-loop) when you need session-scoped exploit I/O.
4. Add [Multi-Session Workflows](/guides/multi-session-workflows) and [Build and Helper Processes](/guides/build-and-helper-processes) as your workflow gets more complex.
If you already know the workflow and just need exact tool arguments or return fields, jump to the [Reference](/tool-reference/index) section instead.
# Interactive Exploit Loop
Source: https://docs.pwno.io/guides/interactive-exploit-loop
Start a pwncli driver, send input, read output, collect events, and stop cleanly.
Use the `pwncli` family when you want a session-scoped exploit driver that stays alive while the debugger session remains active.
```json theme={null}
{"tool":"pwncli","arguments":{"session_id":"chal-a","binary_path":"/workspace/chal","file":"from pwn import *\nprint('ready')\n"}}
```
The server writes the script into the session runtime directory and launches it with `uv run`.
The returned object includes:
* `runtime_dir`
* `binary_path`
* `io.current_output`
* `attachment.result`
* `startup.ready`, `startup.reason`, `startup.alive`, `startup.pid`, and `startup.replaced`
```json theme={null}
{"tool":"sendinput","arguments":{"session_id":"chal-a","data":"AAAA\n"}}
```
```json theme={null}
{"tool":"checkoutput","arguments":{"session_id":"chal-a"}}
{"tool":"checkevents","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"pwncli_stop","arguments":{"session_id":"chal-a"}}
```
`sendinput` does not append a newline automatically. If the target expects line input, include `\n` yourself.
## Behavior notes
* a session can only have one active `pwncli` driver at a time
* starting a new driver for the same session replaces the old one
* `checkoutput` clears the buffered output it returns
* `checkevents` returns structured event history plus liveness and exit-code data
For exact fields and examples, see [pwncli Reference](/tool-reference/pwncli).
# Multi-Session Workflows
Source: https://docs.pwno.io/guides/multi-session-workflows
Run multiple debugger or exploit sessions in parallel without state collisions.
`pwno-mcp` is built for concurrent workflows. You can keep more than one binary, attach target, or exploit driver active by assigning stable `session_id` values.
## Example pattern
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"patched"}}
{"tool":"create_debug_session","arguments":{"session_id":"original"}}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal-patched","session_id":"patched"}}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"original"}}
{"tool":"set_breakpoint","arguments":{"location":"main","session_id":"patched"}}
{"tool":"set_breakpoint","arguments":{"location":"main","session_id":"original"}}
```
## Good practices
* use one session per target binary or scenario
* keep session names semantic: `patched`, `remote`, `local`, `heap`, `rop`, `stage2`
* pass `session_id` explicitly on every debugger and `pwncli` call
* use `list_debug_sessions` and `list_pwncli_sessions` to keep track of what is still alive
## Cleanup
When you are done, close idle sessions so GDB processes and driver state are released.
```json theme={null}
{"tool":"close_debug_session","arguments":{"session_id":"patched"}}
{"tool":"close_debug_session","arguments":{"session_id":"original"}}
```
Named sessions are especially useful when several agent subtasks are running in parallel, because each thread can keep its own debugger state without reloading the binary.
# Introduction
Source: https://docs.pwno.io/index
Stateful debugging, exploit I/O, and workspace automation for autonomous pwn workflows over MCP.
`pwno-mcp` runs GDB + pwndbg in an isolated environment and exposes session-aware debugging, exploit-driver I/O, and helper tooling over MCP for agentic clients.
Launch the server with Docker and connect your MCP client.
Pick Claude, Cursor, OpenCode, or Codex CLI and copy a working config.
Follow task-oriented walkthroughs for first-run debugging, attach flows, exploit I/O, and multi-session work.
Jump straight to debugger, automation, and attach API details.
## Why it exists
The project is built for LLM-driven binary research workflows where a stateless shell is not enough. It keeps debugger state alive across calls, supports multiple parallel sessions, and pairs low-level debugging with helper tools for process management, Python execution, repo fetching, and exploit-driver flows.
You can use `pwno-mcp` to participate in CTFs, research, and exploit development workflows.
You can read the background story [here](/background-story).
## Typical workflow
Use the Docker flow in [Quick Start](/quickstart). Most users start with HTTP transport and the default `http://127.0.0.1:5500/mcp` endpoint.
Pick a page under [Client Setup](/client-setup/index) and add the server using either HTTP or stdio.
Start with `create_debug_session`, then `set_file`, `set_breakpoint`, and `run`. The walkthrough in [First Debug Session](/guides/first-debug-session) shows the full sequence.
Move on to [Guides](/guides/index) and the [Reference](/tool-reference/index) section when you need attach flows, exploit I/O, or workspace automation.
Paths passed to tools should normally resolve inside `/workspace`. If you mount `./workspace` from your host into the container, a host file like `./workspace/chal` becomes `/workspace/chal` in tool calls.
## Runtime model
* The default HTTP endpoint is `http://127.0.0.1:5500/mcp`.
* The health endpoint is `http://127.0.0.1:5500/healthz`.
* The local attach helper API runs on `http://127.0.0.1:5501/attach` in HTTP mode by default.
* Most file paths passed to tools should resolve inside `/workspace`.
* Multi-session workflows should pass explicit `session_id` values.
## About
This project is maintained by [Pwno](https://pwno.io), an AI cybersecurity startup founded by [Ruikai](https://ruik.ai) and [Evan Luo](https://evannotfound.com).
# License
Source: https://docs.pwno.io/license
Licensing terms for pwno-mcp.
`pwno-mcp` is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
## Practical meaning
* non-commercial use is allowed
* attribution is required
* derivatives or modified distributions are not allowed
* commercial inquiries should go to `oss@pwno.io`
See the repository `LICENSE` file or the official license text:
```text theme={null}
https://creativecommons.org/licenses/by-nc-nd/4.0/
```
# Configuration
Source: https://docs.pwno.io/operations/configuration
CLI flags, runtime defaults, and environment variables that affect pwno-mcp.
This page covers the main knobs exposed by `pwno-mcp` itself.
## CLI flags
| Flag | Default | Purpose |
| --------------- | ----------- | ----------------------------------------- |
| `--host` | `0.0.0.0` | bind host for the main HTTP server |
| `--port` | `5500` | bind port for the main HTTP server |
| `--attach-host` | `127.0.0.1` | bind host for the attach sidecar API |
| `--attach-port` | `5501` | bind port for the attach sidecar API |
| `--http-path` | `/mcp` | main HTTP transport path |
| `--stdio` | off | run as a stdio MCP server instead of HTTP |
## Environment variables
| Variable | Purpose |
| ------------------- | ----------------------------------------------------------------------------------------------- |
| `PWNO_RUNTIME_ROOT` | override the root directory for session runtime data, process logs, and shared helper artifacts |
| `BINARY_URL` | enables lazy RetDec analysis against an externally reachable binary URL |
## Example launches
```bash Default HTTP theme={null}
python -m pwnomcp
```
```bash Custom ports theme={null}
python -m pwnomcp --host 0.0.0.0 --port 6600 --attach-port 6601 --http-path /mcp
```
```bash stdio theme={null}
python -m pwnomcp --stdio
```
## Operational defaults
* main HTTP endpoint: `http://127.0.0.1:5500/mcp`
* health check: `http://127.0.0.1:5500/healthz`
* attach sidecar: `http://127.0.0.1:5501/attach`
* workspace root inside the runtime: `/workspace`
Use [Docker and Compose](/operations/docker-and-compose) for launch recipes and [Troubleshooting](/troubleshooting) for common misconfigurations.
# Docker and Compose
Source: https://docs.pwno.io/operations/docker-and-compose
Container launch patterns, local image builds, and compose usage for pwno-mcp.
`pwno-mcp` is designed for containerized usage first.
Keep the ptrace-related capabilities and unconfined seccomp/apparmor flags unless you have already proven that your environment supports a stricter configuration.
## Run the published image
```bash HTTP theme={null}
docker run --rm -p 5500:5500 \
--cap-add=SYS_PTRACE \
--cap-add=SYS_ADMIN \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v "$PWD/workspace:/workspace" \
ghcr.io/pwno-io/pwno-mcp:latest
```
```bash stdio theme={null}
docker run --rm -i \
--cap-add=SYS_PTRACE \
--cap-add=SYS_ADMIN \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v "$PWD/workspace:/workspace" \
ghcr.io/pwno-io/pwno-mcp:latest \
--stdio
```
## Build locally
```bash theme={null}
docker build -t pwno-mcp:latest . --platform linux/amd64
```
The published image targets `linux/amd64`. On Apple Silicon, keep the explicit platform flag unless you have built your own compatible variant.
## Docker Compose
```bash theme={null}
docker-compose up -d
docker-compose logs -f
docker-compose exec pwno-mcp bash
```
The repository `docker-compose.yml` exposes port `5500`, mounts `./workspace` to `/workspace`, and applies the required debugger capabilities.
## Published image tags
* `latest`: stable default
* `edge`: tracks the default branch
* `sha-`: pinned commit image
* `X.Y.Z`, `X.Y`, `X`: release tags derived from version tags
# Quick Start
Source: https://docs.pwno.io/quickstart
Run pwno-mcp locally with Docker and connect an MCP client.
This is the fastest path to a working local `pwno-mcp` instance.
`pwno-mcp` needs `SYS_PTRACE`, `SYS_ADMIN`, and unconfined seccomp/apparmor settings so GDB and attach flows work correctly inside Docker.
Put the target binary you want to analyze inside a local `workspace` directory.
```bash theme={null}
mkdir -p ./workspace
cp ./path/to/your/binary ./workspace/chal
chmod +x ./workspace/chal
```
Use HTTP when your client wants a `url`. Use stdio when your client wants a local `command` plus `args`.
Pick one of the launch commands below.
Open [Client Setup](/client-setup/index) and copy the matching config for your MCP client.
```bash HTTP theme={null}
docker run --rm -p 5500:5500 \
--cap-add=SYS_PTRACE \
--cap-add=SYS_ADMIN \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v "$PWD/workspace:/workspace" \
ghcr.io/pwno-io/pwno-mcp:latest
```
```bash stdio theme={null}
docker run --rm -i \
--cap-add=SYS_PTRACE \
--cap-add=SYS_ADMIN \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v "$PWD/workspace:/workspace" \
ghcr.io/pwno-io/pwno-mcp:latest \
--stdio
```
In HTTP mode, connect clients to `http://127.0.0.1:5500/mcp` and use `http://127.0.0.1:5500/healthz` for health checks.
In stdio mode, your client spawns the container as a local MCP server instead of calling an HTTP endpoint.
## Important defaults
* `http_path` defaults to `/mcp`.
* The HTTP health endpoint is `/healthz`.
* The attach helper API defaults to `127.0.0.1:5501` inside the runtime.
* Tool path arguments should use container-visible paths under `/workspace`.
* Relative paths are resolved under `/workspace` by the server.
If you mounted `./workspace` from your host, your first binary path inside tool calls is usually `/workspace/chal`.
## Next steps
Copy a ready-to-use HTTP or stdio config for your MCP client.
Run a short end-to-end validation flow against your local server.
# Attach API
Source: https://docs.pwno.io/tool-reference/attach-api
Reference for the local /attach helper API and the bundled Python client helper.
The attach sidecar API is a local FastAPI service started in HTTP mode. It provides a simple wrapper for process-attach workflows.
The attach sidecar is separate from the main MCP endpoint and is not started in stdio mode.
## Default endpoint
```text theme={null}
POST http://127.0.0.1:5501/attach
```
## Request body
```json theme={null}
{
"pre": ["set pagination off"],
"pid": 31337,
"after": ["info threads"],
"where": "/workspace/chal",
"session_id": "chal-a"
}
```
### Request fields
Target process id to attach to.
Target debug session id. The session must already exist.
Optional binary path to load before attach. Use a path that resolves under `/workspace`.
Optional GDB or pwndbg commands executed before the attach.
Optional GDB or pwndbg commands executed after a successful attach.
## Response shape
```json theme={null}
{
"successful": true,
"attach": {
"command": "attach",
"success": true,
"state": "stopped",
"pid": 31337,
"session_id": "chal-a"
},
"result": {
"set-file": {
"success": true
},
"info threads": {
"success": true
}
}
}
```
### Response fields
Whether the overall attach request succeeded.
Structured summary of the attach attempt.
Command label associated with the attach action.
Whether the attach itself succeeded.
Current debugger or inferior state after the attach.
Attached process id.
Debug session used for the request.
Present when attach setup or attach execution fails.
Map of pre-commands, optional `set-file`, and post-commands to their individual command results.
## Python helper
`pwnomcp.cli.attach()` wraps the same API.
```python theme={null}
from pwnomcp.cli import attach
response = attach(
pid=31337,
session_id="chal-a",
gdbscript=["set pagination off"],
artifact_path="/workspace/chal",
)
print(response.model_dump())
```
## When to use it
* use the MCP `attach` tool for normal in-client workflows
* use `/attach` or `pwnomcp.cli.attach()` when you already have a local Python helper or external integration that wants a small HTTP contract
# Debug Sessions
Source: https://docs.pwno.io/tool-reference/debug-sessions
Session lifecycle, file loading, breakpoints, attach flows, and execution control tools.
Most debugger operations are scoped by `session_id`. Create or pick a session first, then load a binary or attach to a running process.
Except for `create_debug_session` and `list_debug_sessions`, the debugger tool family expects an existing session. Use explicit session names for every serious workflow.
## Session lifecycle tools
| Tool | Use it for | Notes |
| ---------------------- | ------------------------------------------------------ | --------------------------------- |
| `create_debug_session` | create or return a session by id | safe to call repeatedly |
| `list_debug_sessions` | inspect active sessions | returns metadata for all sessions |
| `close_debug_session` | close a session and stop its `pwncli` driver | releases GDB resources |
| `get_session_info` | inspect cached state without issuing a new GDB command | includes `runtime_dir` |
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
{"tool":"list_debug_sessions","arguments":{}}
{"tool":"get_session_info","arguments":{"session_id":"chal-a"}}
```
## Load, attach, and raw command tools
| Tool | Use it for | Notes |
| ---------------- | --------------------------------------------------- | -------------------------------------------- |
| `set_file` | load an executable into GDB | resolve paths under `/workspace` |
| `attach` | attach to an already running PID | returns attach result plus context snapshots |
| `set_breakpoint` | insert a symbol, address, or `file:line` breakpoint | optional condition supported |
| `execute` | run raw GDB or pwndbg commands | best for low-level escape hatches |
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
{"tool":"set_breakpoint","arguments":{"location":"main","condition":"$rax == 0","session_id":"chal-a"}}
{"tool":"execute","arguments":{"command":"info registers","session_id":"chal-a"}}
```
### Common debugger parameters
Debug session to operate on. Required for nearly every debugger tool on this page.
Target binary path. Use a path that resolves under `/workspace`.
Breakpoint or jump target, such as a symbol, `file:line`, or address expression.
Raw GDB or pwndbg command for `execute`, or a stepping verb such as `c`, `n`, `s`, `ni`, or `si` for `step_control`.
Argument string passed to the inferior when using `run`.
Target process id for `attach`.
## Execution control tools
| Tool | Use it for | Notes |
| ---------------------- | ----------------------------------------------------- | ---------------------------------------- |
| `run` | start the loaded inferior | supports `args` and `start` |
| `step_control` | continue or step execution | supports `c`, `n`, `s`, `ni`, `si` |
| `gdb_poll` | drain pending async GDB notifications | useful after async activity |
| `gdb_interrupt` | interrupt a running inferior and wait for stop events | useful when you need control back |
| `finish` | run until the current function returns | wrapper around MI `-exec-finish` |
| `jump` | resume execution at a location | supports symbol, `file:line`, or address |
| `return_from_function` | force the current function to return | wrapper around MI `-exec-return` |
| `until` | run until a location or next source line | optional `locspec` |
```json theme={null}
{"tool":"run","arguments":{"args":"--demo","start":true,"session_id":"chal-a"}}
{"tool":"step_control","arguments":{"command":"ni","session_id":"chal-a"}}
{"tool":"gdb_interrupt","arguments":{"timeout":1.0,"session_id":"chal-a"}}
{"tool":"until","arguments":{"locspec":"main","session_id":"chal-a"}}
```
## Typical flow
```json theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
{"tool":"set_breakpoint","arguments":{"location":"main","session_id":"chal-a"}}
{"tool":"run","arguments":{"session_id":"chal-a"}}
```
```json theme={null}
{"tool":"execute","arguments":{"command":"info registers","session_id":"chal-a"}}
{"tool":"step_control","arguments":{"command":"n","session_id":"chal-a"}}
```
## Common edge cases
Create the session first with `create_debug_session`, then pass the same `session_id` on all later calls.
Load a file with `set_file` before calling `run`, or pass `binary_path` where the tool supports it.
The MCP `attach` tool returns the attach result plus a context snapshot list. If you want a single wrapper object instead, use the attach sidecar API described in [Attach API](/tool-reference/attach-api).
## Common debugger response fields
Whether the tool call succeeded.
Session that the tool actually operated on.
Current debugger or inferior state after the operation, when provided by the backend.
Resolved binary path after `set_file` or other file-sensitive operations.
Session-specific runtime directory returned by `get_session_info`.
Short actionable error message when the call fails.
Exception type returned by the shared error wrapper on failures.
# Reference
Source: https://docs.pwno.io/tool-reference/index
Tool-by-tool reference for debugger control, inspection, exploit I/O, and automation helpers.
Use the reference when you already know what you are trying to do and need the exact tool surface.
## Debugger and inspection
Session lifecycle, file loading, breakpoints, attach flows, and execution control.
Context snapshots and memory reads without changing execution.
Local `/attach` helper API and the bundled Python helper.
## Automation and exploit I/O
Session-scoped exploit-driver startup, I/O, events, and cleanup.
Helper commands and tracked background processes.
Managed Python execution and package management.
Clone helper repos into `/workspace`.
Inspect optional decompilation status and retrieve code when available.
If you need a full end-to-end sequence instead of a tool-by-tool breakdown, use the [Guides](/guides/index) section.
# Inspection
Source: https://docs.pwno.io/tool-reference/inspection
Read current debugger context and inspect memory without changing execution.
These tools read debugger state without changing the inferior's execution.
## `get_context`
`get_context` returns either a broad quick snapshot or one focused view.
Supported `context_type` values:
* `all`
* `regs`
* `stack`
* `disasm`
* `code`
* `backtrace`
```json theme={null}
{"tool":"get_context","arguments":{"context_type":"all","session_id":"chal-a"}}
{"tool":"get_context","arguments":{"context_type":"backtrace","session_id":"chal-a"}}
```
## `get_memory`
`get_memory` accepts a start address expression, byte count, and output format.
```json Hex bytes theme={null}
{"tool":"get_memory","arguments":{"address":"$rsp","size":64,"format":"hex","session_id":"chal-a"}}
```
```json String view theme={null}
{"tool":"get_memory","arguments":{"address":"$rdi","size":64,"format":"string","session_id":"chal-a"}}
```
## Address and format notes
* use expressions like `$rsp`, `$rip`, or `0xdeadbeef`
* use `format: "hex"` for raw bytes
* use `format: "string"` for `x/s`-style string output
* use a named session so repeated reads stay attached to the same debugger state
# Processes
Source: https://docs.pwno.io/tool-reference/processes
Run helper commands and manage tracked background processes.
These tools are for helper services, build steps, and supporting automation. They are not for running the target binary under debugger control.
`run_command` and `spawn_process` intentionally guard against some bad patterns, including using them to run a target ELF from `/workspace` or wrapping `python -c` instead of using the Python tool family.
## Returned shape
All tools on this page return JSON-formatted strings. Parse the payload if your client does not already coerce it into an object.
## `run_command`
Use for short-lived shell commands such as compiles and helper scripts.
```json theme={null}
{"tool":"run_command","arguments":{"command":"gcc -g vuln.c -o chal","cwd":"/workspace","timeout":30.0}}
```
## Background helpers
| Tool | Use it for | Important fields |
| ---------------- | -------------------------------------- | -------------------------------------------------- |
| `spawn_process` | start a long-running helper process | `pid`, `stdout_path`, `stderr_path`, `process_dir` |
| `get_process` | inspect one tracked background process | running status plus live or final output |
| `kill_process` | stop a tracked process | signal defaults to `15` |
| `list_processes` | inspect all tracked helpers | lightweight running-process summary |
```json theme={null}
{"tool":"spawn_process","arguments":{"command":"python3 -m http.server 8000","cwd":"/workspace"}}
{"tool":"get_process","arguments":{"pid":12345}}
{"tool":"kill_process","arguments":{"pid":12345,"signal":15}}
{"tool":"list_processes","arguments":{}}
```
## What gets tracked
* stdout and stderr are written to log files under a server-managed process directory
* `get_process` returns live output for tracked running processes when available
* `kill_process` keeps the entry cached long enough for `get_process` to read outputs afterward
Use [Build and Helper Processes](/guides/build-and-helper-processes) for workflow guidance.
# pwncli Workflows
Source: https://docs.pwno.io/tool-reference/pwncli
Interactive exploit-driver flows tied to a debug session.
Use the `pwncli` family when you want an interactive exploit driver that stays attached to a specific debug session.
## `pwncli`
`pwncli` writes the provided script into the session runtime directory, launches it with `uv run`, and exposes both startup output and any parsed attach result marker.
```json theme={null}
{"tool":"pwncli","arguments":{"session_id":"chal-a","binary_path":"/workspace/chal","file":"from pwn import *\nprint('ready')\n"}}
```
### Important returned fields
* `runtime_dir`: session-specific directory used for the inline script
* `io.current_output`: output collected for this call
* `attachment.result`: parsed attach result marker when present
* `startup.ready`: whether the driver reached a ready state
* `startup.reason`: why the wait finished
* `startup.alive`: whether the driver is still alive
* `startup.pid`: driver process id
* `startup.replaced`: whether an older driver was replaced for this session
## I/O tools
```json theme={null}
{"tool":"sendinput","arguments":{"session_id":"chal-a","data":"AAAA\n"}}
{"tool":"checkoutput","arguments":{"session_id":"chal-a"}}
{"tool":"checkevents","arguments":{"session_id":"chal-a"}}
```
* `sendinput` writes raw bytes to stdin
* `checkoutput` returns buffered output and clears it
* `checkevents` returns structured events plus `alive`, `exit_code`, and `driver_pid`
`sendinput` does not append a newline automatically.
## Session management tools
```json theme={null}
{"tool":"pwncli_stop","arguments":{"session_id":"chal-a"}}
{"tool":"list_pwncli_sessions","arguments":{}}
```
* `pwncli_stop` kills the driver bound to a session
* `list_pwncli_sessions` lists all active drivers
## Behavior notes
* one `pwncli` driver per debug session
* launching a new driver for the same session replaces the old one
* `close_debug_session` also stops the session's active driver
# Python
Source: https://docs.pwno.io/tool-reference/python
Run inline Python, execute scripts, and manage packages in the shared environment.
The server exposes a managed Python environment for quick analysis and scripting.
## Returned shape
All tools on this page return JSON-formatted strings.
## `execute_python_code`
Use this for one-off probes and analysis.
```json theme={null}
{"tool":"execute_python_code","arguments":{"code":"print('hello from inline python')","cwd":"/workspace","timeout":120.0}}
```
Prefer this over `python -c` inside `run_command`. The subprocess backend will steer you back here if you use the wrong interface.
## `execute_python_script`
Use this only when a `.py` file already exists.
```json theme={null}
{"tool":"execute_python_script","arguments":{"script_path":"/workspace/solve.py","args":"--remote","cwd":"/workspace","timeout":300.0}}
```
## Package management
```json theme={null}
{"tool":"install_python_packages","arguments":{"packages":"z3-solver capstone","upgrade":false}}
{"tool":"list_python_packages","arguments":{}}
```
* `install_python_packages` installs additional packages with the shared package manager
* `list_python_packages` lists what is already present in the managed environment
* `cwd` still resolves under `/workspace`
# Repositories
Source: https://docs.pwno.io/tool-reference/repositories
Clone helper repositories into the workspace for analysis or build support.
`fetch_repo` clones a Git repository into `/workspace`.
## Returned shape
`fetch_repo` returns a JSON-formatted string.
## Parameters
* `repo_url`: HTTPS or SSH repository URL
* `version`: optional branch, tag, or commit
* `target_dir`: optional explicit destination inside `/workspace`
* `shallow`: whether to use a shallow clone
```json theme={null}
{"tool":"fetch_repo","arguments":{"repo_url":"https://github.com/pwno-io/pwno-mcp.git","version":"main","target_dir":"/workspace/pwno-mcp","shallow":true}}
```
If you omit `target_dir`, the server derives a directory name from the repository URL and clones into `/workspace/`.
# RetDec
Source: https://docs.pwno.io/tool-reference/retdec
Inspect optional RetDec decompilation status and retrieve decompiled code.
RetDec integration is lazy-initialized and driven by the `BINARY_URL` environment variable.
## Returned shape
Both tools on this page return JSON-formatted strings.
## Available tools
```json theme={null}
{"tool":"get_retdec_status","arguments":{}}
{"tool":"get_decompiled_code","arguments":{}}
```
* `get_retdec_status` reports whether decompilation was skipped, failed, or succeeded
* `get_decompiled_code` returns C output when available, otherwise an unavailable response with details
## Runtime behavior
* if `BINARY_URL` is missing, RetDec initialization is skipped
* decompilation runs lazily on first access, not at import time
* success responses include whether decompiled code is available
RetDec depends on an external service. A missing `BINARY_URL`, HTTP failure, or timeout can all produce a non-success status.
# Troubleshooting
Source: https://docs.pwno.io/troubleshooting
Common pwno-mcp setup and runtime issues.
Start with the symptom that best matches what you are seeing.
Confirm the container publishes `-p 5500:5500` and that the client URL is exactly `http://127.0.0.1:5500/mcp` unless you changed the defaults.
Point health checks at `http://127.0.0.1:5500/healthz`. The attach sidecar is a separate service and is not the health endpoint.
Keep `SYS_PTRACE`, `SYS_ADMIN`, and unconfined seccomp and apparmor settings on the container.
Use container-visible paths such as `/workspace/chal`, and make sure the host file exists inside the mounted `./workspace` directory.
Call `set_file` before `run`, or use `attach` when the process is already running.
Some helper families intentionally return JSON-formatted strings. See [Response Shapes](/concepts/response-shapes).
Confirm `BINARY_URL` is set and points to a URL the external RetDec service can fetch.
## Fast checks
1. Confirm Docker started successfully.
2. Confirm your client points to the right transport.
3. Confirm your binary exists under the mounted `workspace` directory.
4. Confirm your tool calls use `/workspace/...` paths.
5. Confirm you are using the correct `session_id`.
## Preview this Mintlify site locally
```bash theme={null}
npm --prefix docs run dev
```
# Verify Setup
Source: https://docs.pwno.io/verify-setup
Run a fast end-to-end check against a local pwno-mcp instance.
Most users can skip this page, but it is useful when you are validating a new client config or debugging a first-time setup issue.
```text theme={null}
Use pwno-mcp to create a debug session called chal-a, load /workspace/chal, set a breakpoint at main, run the program, show full context, then step once.
```
You should see the session created, the binary loaded, execution stop at `main`, a full context snapshot returned, and one successful step.
If your agent cannot complete the flow, run the sequence below through any MCP inspector or compatible client.
```text Agent prompt theme={null}
Use pwno-mcp to create a debug session called chal-a, load /workspace/chal, set a breakpoint at main, run the program, show full context, then step once.
```
```json Manual tool calls theme={null}
{"tool":"create_debug_session","arguments":{"session_id":"chal-a"}}
{"tool":"set_file","arguments":{"binary_path":"/workspace/chal","session_id":"chal-a"}}
{"tool":"set_breakpoint","arguments":{"location":"main","session_id":"chal-a"}}
{"tool":"run","arguments":{"args":"","start":false,"session_id":"chal-a"}}
{"tool":"get_context","arguments":{"context_type":"all","session_id":"chal-a"}}
{"tool":"step_control","arguments":{"command":"n","session_id":"chal-a"}}
```
If you followed [Quick Start](/quickstart), the host path is `./workspace/chal` and the in-container tool path is `/workspace/chal`.
Common stepping commands are `c`, `n`, `s`, `ni`, and `si`.
If this flow fails, go straight to [Troubleshooting](/troubleshooting) or check the transport, session, and path rules in [Core Concepts](/concepts/transports-and-runtime).