http_get( $this->origin() . '/', 'GET / (homepage HTML)', $evidence ); if ( '' !== $r['error'] && 0 === $r['code'] ) { return $this->unable( 'Could not reach the homepage — ' . $r['error'], $evidence ); } // Indicator 1: modelContext in the page source (inline scripts). if ( $this->mentions_model_context( $r['body'] ) ) { $evidence[] = Evidence::parse( 'Search inline scripts', 'positive', 'Found a `modelContext` registration reference in the page source.' ); return $this->pass( 'WebMCP indicator found: modelContext appears in the page source (detected via static heuristic — registration confirmed only by a browser-based scan)', $evidence, array( 'heuristic' => true, 'indicator' => 'inline', ) ); } $evidence[] = Evidence::parse( 'Search inline scripts', 'neutral', 'No `modelContext` reference in the page source.' ); // Indicator 2: same-origin script src URLs containing "webmcp". $srcs = $this->find_webmcp_script_srcs( $r['body'] ); if ( empty( $srcs ) ) { $evidence[] = Evidence::parse( 'Search script tags', 'neutral', 'No same-origin script src containing "webmcp" found.' ); return $this->fail( 'No WebMCP tool registration detected on page load (static heuristic)', $evidence, array( 'heuristic' => true, 'indicator' => null, ) ); } $evidence[] = Evidence::parse( 'Search script tags', 'positive', count( $srcs ) . ' same-origin script(s) with "webmcp" in the URL: ' . implode( ', ', $srcs ) ); // Fetch up to two of those scripts and search their bodies — still a // static approximation; only a real browser can observe registration. $confirmed = false; foreach ( array_slice( $srcs, 0, 2 ) as $src ) { $sr = $this->http_get( $src, 'GET ' . $src, $evidence ); if ( 200 !== $sr['code'] ) { $evidence[] = Evidence::parse( 'Search script body', 'neutral', 'Script not fetchable (HTTP ' . $sr['code'] . ') — cannot inspect its body statically.' ); continue; } if ( $this->mentions_model_context( $sr['body'] ) ) { $confirmed = true; $evidence[] = Evidence::parse( 'Search script body', 'positive', 'Script body references `modelContext` (registerTool / provideContext).' ); break; } $evidence[] = Evidence::parse( 'Search script body', 'neutral', 'Script fetched but its body has no `modelContext` reference.' ); } $message = $confirmed ? 'WebMCP indicator found: a same-origin webmcp script references modelContext (detected via static heuristic — registration confirmed only by a browser-based scan)' : 'WebMCP indicator found: same-origin webmcp script on the page (detected via static heuristic — registration confirmed only by a browser-based scan)'; return $this->pass( $message, $evidence, array( 'heuristic' => true, 'indicator' => 'script', ) ); } /** * Whether a body references the WebMCP entry point: the current * document.modelContext.registerTool surface or the earlier * navigator.modelContext.provideContext preview. * * @param string $body HTML or JS. * @return bool */ private function mentions_model_context( string $body ): bool { return (bool) preg_match( '/(document|navigator)\s*\.\s*modelContext|[\'"]modelContext[\'"]\s*in\s*document/', $body ); } /** * Extract same-origin