MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / crawlSingleDomain

Method crawlSingleDomain

server/src/crawler.ts:840–908  ·  view source on GitHub ↗
(domain: string)

Source from the content-addressed store, hash-verified

838 // ── Single Domain Crawl ──────────────────────────────────────────
839
840 async crawlSingleDomain(domain: string): Promise<void> {
841 if (this.crawling) {
842 log.warn({ domain }, 'Full crawl in progress, skipping single domain crawl');
843 return;
844 }
845
846 log.info({ domain }, 'Single domain crawl requested');
847
848 try {
849 const validation = await this.adAgentsManager.validateDomain(domain);
850
851 if (!validation.valid || !validation.raw_data?.authorized_agents) {
852 log.warn({ domain }, 'No valid adagents.json for domain');
853 return;
854 }
855
856 await this.cacheAdagentsManifest(domain, validation.raw_data as AdagentsManifest);
857
858 // Record agents and properties
859 for (const authorizedAgent of validation.raw_data.authorized_agents) {
860 if (!authorizedAgent.url) continue;
861
862 await this.federatedIndex.recordAgentFromAdagentsJson(
863 authorizedAgent.url,
864 domain,
865 authorizedAgent.authorized_for,
866 authorizedAgent.property_ids
867 );
868
869 await this.recordPropertiesForAgent(
870 validation.raw_data.properties || [],
871 domain,
872 authorizedAgent.url,
873 authorizedAgent.authorized_for,
874 authorizedAgent.property_ids
875 );
876 }
877
878 // Produce per-domain events
879 if (this.eventsDb) {
880 await this.eventsDb.writeEvent({
881 event_type: 'publisher.adagents_changed',
882 entity_type: 'publisher',
883 entity_id: domain,
884 payload: {
885 publisher_domain: domain,
886 agent_count: validation.raw_data.authorized_agents.length,
887 property_count: validation.raw_data.properties?.length ?? 0,
888 },
889 actor: 'api:crawl-request',
890 });
891 }
892
893 // Scan brand.json for this domain
894 try {
895 await this.scanBrandForDomain(domain);
896 } catch (err) {
897 log.warn({ domain, err: err instanceof Error ? err.message : err }, 'Brand scan during single domain crawl failed');

Callers 2

createRegistryApiRouterFunction · 0.80

Calls 8

cacheAdagentsManifestMethod · 0.95
scanBrandForDomainMethod · 0.95
warnMethod · 0.80
writeEventMethod · 0.80
validateDomainMethod · 0.45

Tested by

no test coverage detected