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: navigator.modelContext in the page source (inline scripts). if ( false !== strpos( $r['body'], 'navigator.modelContext' ) ) { $evidence[] = Evidence::parse( 'Search inline scripts', 'positive', 'Found `navigator.modelContext` in the page source.' ); return $this->pass( 'WebMCP indicator found: navigator.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 `navigator.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 ( false !== strpos( $sr['body'], 'navigator.modelContext' ) ) { $confirmed = true; $evidence[] = Evidence::parse( 'Search script body', 'positive', 'Script body references `navigator.modelContext`.' ); break; } $evidence[] = Evidence::parse( 'Search script body', 'neutral', 'Script fetched but its body has no `navigator.modelContext` reference.' ); } $message = $confirmed ? 'WebMCP indicator found: a same-origin webmcp script references navigator.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', ) ); } /** * Extract same-origin