Skip to contents

Starts an MCP session in the current process, optionally binding to a specific session ID and working directory. Designed for non-interactive contexts where the agent needs to provision an R session on demand.

Usage

mcp_session(
  session_id = NULL,
  timeout_seconds = 900,
  working_dir = NULL,
  daemon = FALSE
)

Arguments

session_id

Optional integer session/socket identifier to bind.

timeout_seconds

Session timeout before auto-cleanup (default: 900 seconds).

working_dir

Optional path to set as the working directory before launch.

daemon

Logical. If TRUE, return immediately after starting session (for processx spawning). If FALSE, block in event loop until session stops (for interactive use). Default FALSE.

Value

The mcprSession instance (invisibly).

Details

Launch Headless MCP Session