Skip to main content
Glama
rahulkr
by rahulkr

clear_proxy

Remove HTTP proxy configurations from Android devices to restore direct network connections for development and testing workflows.

Instructions

Clear HTTP proxy settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_serialNo

Implementation Reference

  • The clear_proxy tool handler. Decorated with @mcp.tool() for automatic registration in the MCP server. Executes an ADB command to clear the global HTTP proxy setting by setting it to ":0".
    @mcp.tool()
    def clear_proxy(device_serial: str | None = None) -> str:
        """Clear HTTP proxy settings"""
        return run_adb(["shell", "settings", "put", "global", "http_proxy", ":0"], device_serial)
  • Core utility function used by clear_proxy (and all other tools) to execute ADB commands safely, handling device targeting, timeouts, and error capture.
    def run_adb(args: list[str], device_serial: str | None = None, timeout: int = 30) -> str:
        """Run an ADB command and return output"""
        cmd = ["adb"]
        if device_serial:
            cmd.extend(["-s", device_serial])
        cmd.extend(args)
        
        try:
            result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
            if result.returncode != 0 and result.stderr:
                return f"Error: {result.stderr}"
            return result.stdout
        except subprocess.TimeoutExpired:
            return "Error: Command timed out"
        except Exception as e:
            return f"Error: {str(e)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rahulkr/r_adb_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server