aboutsummaryrefslogtreecommitdiffstats
path: root/spawn.sh
blob: a8763ae36d45b6cb08c9a77d61cb9015a60d2b2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Start the ida-pro-mcp supervisor. IDA_MCP_MAX_WORKERS raises the ceiling on
# concurrently-open binaries (default 4); idle workers self-exit and free slots.
#
# Location-independent: resolves paths relative to this script, not $PWD, so it
# behaves the same whether run by hand or from the systemd unit (see
# systemd/idatui-mcp.service).
set -eu

SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)

IDA_MCP_HOST="${IDA_MCP_HOST:-127.0.0.1}"
IDA_MCP_PORT="${IDA_MCP_PORT:-8745}"
IDA_MCP_TARGET="${IDA_MCP_TARGET:-$SCRIPT_DIR/bin/ls}"

# Ensure idatui's extra server tools (del_type, needed by the struct editor) are
# present in the installed ida-pro-mcp. Idempotent; patches the api_types.py that
# the /usr/bin/python workers import. See server/patch_server.py.
/usr/bin/python "$SCRIPT_DIR/server/patch_server.py" || \
  echo "warn: server patch skipped (del_type may be unavailable)"

cd "$SCRIPT_DIR"
exec env IDA_MCP_MAX_WORKERS="${IDA_MCP_MAX_WORKERS:-8}" \
  uv run idalib-mcp --host "$IDA_MCP_HOST" --port "$IDA_MCP_PORT" "$IDA_MCP_TARGET"