close_browser
Closes the Camoufox browser instance to free up system resources after reverse engineering tasks.
Instructions
Close the Camoufox browser and release all resources.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The MCP tool handler for close_browser. Decorated with @mcp.tool(), it delegates to browser_manager.close().
@mcp.tool() async def close_browser() -> dict: """Close the Camoufox browser and release all resources.""" try: return await browser_manager.close() except Exception as e: return {"error": str(e)} - The BrowserManager.close() method that releases all browser resources, closes the AsyncCamoufox context, clears all stored state (contexts, pages, scripts, traces, network data, route handlers).
async def close(self) -> dict: """Close the browser and clean up all resources.""" if self._cm is not None: try: await self._cm.__aexit__(None, None, None) except Exception: pass self.browser = None self.contexts.clear() self.pages.clear() self.active_page_name = None self._cm = None self._console_logs.clear() self._network_requests.clear() self._request_id_counter = 0 self._capturing = False self._capture_body = False self._init_scripts.clear() self._persistent_scripts.clear() self._persistent_traces.clear() self._nav_responses.clear() self._route_handlers.clear() return {"status": "closed"} - src/camoufox_reverse_mcp/server.py:1-26 (registration)The server module where mcp is instantiated, browser_manager is created, and the navigation module (containing close_browser) is imported. The @mcp.tool() decorator on close_browser registers it.
from mcp.server.fastmcp import FastMCP from .browser import BrowserManager mcp = FastMCP( "camoufox-reverse-mcp", instructions="Anti-detection browser MCP server for JavaScript reverse engineering. " "Uses Camoufox (C++ engine-level fingerprint spoofing) to bypass bot detection " "while performing JS analysis, debugging, hooking, network interception, " "and JSVMP bytecode analysis." ) browser_manager = BrowserManager() # v1.0.0: pure JS reverse-engineering toolkit (session/assertions removed) from .tools import navigation # noqa: E402, F401 — browser control + page interaction from .tools import script_analysis # noqa: E402, F401 — scripts() + search_code() from .tools import debugging # noqa: E402, F401 — evaluate_js from .tools import hooking # noqa: E402, F401 — hook_function + inject_hook_preset + remove_hooks from .tools import network # noqa: E402, F401 — network_capture + list/get requests from .tools import storage # noqa: E402, F401 — cookies() + get_storage + export/import state from .tools import jsvmp # noqa: E402, F401 — hook_jsvmp_interpreter + compare_env from .tools import instrumentation # noqa: E402, F401 — instrumentation(action=...) from .tools import environment # noqa: E402, F401 — check_environment from .tools import verification # noqa: E402, F401 — verify_signer_offline from .tools import trace # noqa: E402, F401 — trace_property_access + list/query