Skip to main content
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

POST http://127.0.0.1:5501/attach

Request body

{
  "pre": ["set pagination off"],
  "pid": 31337,
  "after": ["info threads"],
  "where": "/workspace/chal",
  "session_id": "chal-a"
}

Request fields

pid
number
required
Target process id to attach to.
session_id
string
required
Target debug session id. The session must already exist.
where
string
Optional binary path to load before attach. Use a path that resolves under /workspace.
pre
string[]
Optional GDB or pwndbg commands executed before the attach.
after
string[]
Optional GDB or pwndbg commands executed after a successful attach.

Response shape

{
  "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

successful
boolean
required
Whether the overall attach request succeeded.
attach
object
Structured summary of the attach attempt.
result
object
required
Map of pre-commands, optional set-file, and post-commands to their individual command results.

Python helper

pwnomcp.cli.attach() wraps the same API.
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