apple-hig-mcp
Version:
High-performance MCP server providing instant access to Apple's Human Interface Guidelines via hybrid static/dynamic content delivery
93 lines • 2.34 kB
TypeScript
/**
* HIGDiscoveryService
*
* Dynamically discovers all available Apple Human Interface Guidelines sections
* using Crawlee's PlaywrightCrawler to navigate Apple's SPA-based HIG website.
*
* Replaces the static knownSections array with dynamic discovery capability.
*/
import type { HIGSection, ApplePlatform, HIGCategory } from '../types.js';
import type { HIGCache } from '../cache.js';
export interface DiscoveredLink {
url: string;
title: string;
platform: ApplePlatform;
category: HIGCategory;
depth: number;
}
export interface DiscoveryConfig {
baseUrl: string;
maxDepth: number;
maxPages: number;
respectfulDelay: number;
cacheKey: string;
cacheTTL: number;
}
export declare class HIGDiscoveryService {
private cache;
private config;
private discoveredSections;
private processedUrls;
constructor(cache: HIGCache);
/**
* Discover all HIG sections dynamically from Apple's website
*/
discoverSections(): Promise<HIGSection[]>;
/**
* Handle each page during crawling
*/
private handlePageRequest;
/**
* Extract navigation links from the page
*/
private extractNavigationLinks;
/**
* Extract content area links
*/
private extractContentLinks;
/**
* Process a discovered link and add it to our dataset
*/
private processDiscoveredLink;
/**
* Create HIGSection from current page
*/
private createSectionFromPage;
/**
* Extract page title from various possible sources
*/
private extractPageTitle;
/**
* Validate if URL is a valid HIG URL
*/
private isValidHIGUrl;
/**
* Extract platform from URL and text
*/
private extractPlatform;
/**
* Extract category from URL and text
*/
private extractCategory;
/**
* Clean and normalize title text
*/
private cleanTitle;
/**
* Calculate URL depth for crawling control
*/
private calculateDepth;
/**
* Generate unique ID for section
*/
private generateId;
/**
* Log discovery statistics
*/
private logDiscoveryStats;
/**
* Fallback to known sections if discovery fails
*/
private getFallbackSections;
}
//# sourceMappingURL=hig-discovery.service.d.ts.map