configure_remote_device
Connect to a remote Frida server to enable dynamic instrumentation of mobile and desktop applications for runtime analysis and reverse engineering.
Instructions
Connect to a remote Frida server and make it available for future requests.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The remote <host>:<port> to add. | |
| alias | No | Optional alias used as device_id when targeting this remote. | |
| set_as_default | No | If true, future requests without device_id will prefer this remote. |
Implementation Reference
- src/frida_mcp/cli.py:241-268 (handler)MCP tool handler for 'configure_remote_device'. Validates parameters with Pydantic Fields (serving as schema) and delegates to register_remote_device helper, handling errors and formatting response.@mcp.tool() def configure_remote_device( address: str = Field(description="The remote <host>:<port> to add."), alias: Optional[str] = Field( default=None, description="Optional alias used as device_id when targeting this remote.", ), set_as_default: bool = Field( default=False, description="If true, future requests without device_id will prefer this remote.", ), ) -> Dict[str, Any]: """Connect to a remote Frida server and make it available for future requests.""" try: info = register_remote_device(address, alias=alias, set_default=set_as_default) except DeviceSelectionError as exc: if exc.reasons: attempts = "; ".join(exc.reasons) raise ValueError(f"{exc}. Attempts: {attempts}") from exc raise ValueError(str(exc)) from exc response: Dict[str, Any] = {"status": "success"} response.update(info) if set_as_default: response["message"] = "Remote device set as default" return response
- Helper function invoked by the tool handler. Uses DeviceSelector to register/connect to the remote Frida device and returns device info.def register_remote_device( address: str, *, alias: Optional[str] = None, set_default: bool = False, ) -> Dict[str, str]: """Register a remote device using the active selector.""" global _selector if _selector is None: _selector = DeviceSelector() device = _selector.register_remote(address, alias=alias, set_default=set_default) normalized = _normalize_remote_identifier(address) resolved_alias = _selector._config.alias_for_address(normalized) return { "id": device.id, "name": device.name, "type": device.type, "address": normalized, "alias": resolved_alias or normalized, "default_remote": _selector._config.default_remote or "", }
- Core DeviceSelector method that performs the remote device registration, alias mapping, default updates, and fetches/connects the device.self, address: str, alias: Optional[str] = None, *, set_default: bool = False ) -> Any: """Register and connect to a remote device, optionally updating defaults.""" normalized = _normalize_remote_identifier(address) label = ( alias.strip() if isinstance(alias, str) and alias.strip() else normalized ) self._config.register_remote_alias(label, normalized) if set_default: self._config.default_remote = normalized # Ensure remote appears in fallback ordering if "remote" not in (self._config.fallback_priority or []): self._config.fallback_priority.append("remote") device = self._get_remote_device(normalized) return device