mcp-crawl4ai-ts
Version:
TypeScript MCP server for Crawl4AI - web crawling and content extraction
256 lines • 6.69 kB
TypeScript
export interface CrawlOptions {
remove_images?: boolean;
bypass_cache?: boolean;
filter_mode?: 'blacklist' | 'whitelist';
filter_list?: string[];
screenshot?: boolean;
wait_for?: string;
timeout?: number;
}
export interface JSExecuteOptions {
js_code: string | string[];
}
export interface JSExecuteEndpointOptions {
url: string;
scripts: string | string[];
}
export interface JSExecuteEndpointResponse {
success: boolean;
js_execution_result: {
success: boolean;
results: unknown[];
};
markdown?: string | CrawlMarkdownResult;
}
export interface ScreenshotEndpointOptions {
url: string;
screenshot_wait_for?: number;
save_to_directory?: string;
}
export interface ScreenshotEndpointResponse {
success: boolean;
screenshot: string;
}
export interface PDFEndpointOptions {
url: string;
}
export interface PDFEndpointResponse {
success: boolean;
pdf: string;
}
export interface HTMLEndpointOptions {
url: string;
}
export interface HTMLEndpointResponse {
html: string;
url: string;
success: boolean;
}
export type FilterType = 'raw' | 'fit' | 'bm25' | 'llm';
export interface MarkdownEndpointOptions {
url: string;
f?: FilterType;
q?: string;
c?: string;
}
export interface MarkdownEndpointResponse {
url: string;
filter: string;
query: string | null;
cache: string;
markdown: string;
success: boolean;
}
export interface LLMEndpointOptions {
url: string;
query: string;
}
export interface LLMEndpointResponse {
answer: string;
}
export interface BatchCrawlOptions extends CrawlOptions {
urls: string[];
max_concurrent?: number;
}
export interface BrowserConfig {
browser_type?: 'chromium' | 'firefox' | 'webkit';
headless?: boolean;
viewport_width?: number;
viewport_height?: number;
user_agent?: string;
proxy_config?: {
server: string;
username?: string;
password?: string;
};
cookies?: Array<{
name: string;
value: string;
domain: string;
path?: string;
}>;
headers?: Record<string, string>;
extra_args?: string[];
}
export interface VirtualScrollConfig {
container_selector: string;
scroll_count?: number;
scroll_by?: string | number;
wait_after_scroll?: number;
}
export interface CrawlerConfig {
word_count_threshold?: number;
excluded_tags?: string[];
excluded_selector?: string;
remove_overlay_elements?: boolean;
only_text?: boolean;
remove_forms?: boolean;
keep_data_attributes?: boolean;
js_code?: string | string[];
js_only?: boolean;
wait_for?: string;
wait_for_timeout?: number;
wait_until?: 'domcontentloaded' | 'networkidle' | 'load';
page_timeout?: number;
wait_for_images?: boolean;
ignore_body_visibility?: boolean;
delay_before_scroll?: number;
scroll_delay?: number;
scan_full_page?: boolean;
virtual_scroll_config?: VirtualScrollConfig;
process_iframes?: boolean;
exclude_external_links?: boolean;
screenshot?: boolean;
screenshot_wait_for?: number;
pdf?: boolean;
capture_mhtml?: boolean;
image_description_min_word_threshold?: number;
image_score_threshold?: number;
exclude_external_images?: boolean;
exclude_social_media_links?: boolean;
exclude_domains?: string[];
simulate_user?: boolean;
override_navigator?: boolean;
magic?: boolean;
session_id?: string;
cache_mode?: 'ENABLED' | 'BYPASS' | 'DISABLED';
timeout?: number;
verbose?: boolean;
log_console?: boolean;
}
export interface AdvancedCrawlConfig {
url?: string;
urls?: string[];
browser_config?: BrowserConfig;
crawler_config?: CrawlerConfig;
priority?: number;
}
export interface SessionInfo {
id: string;
created_at: Date;
last_used: Date;
initial_url?: string;
metadata?: Record<string, unknown>;
}
export interface CrawlEndpointOptions {
urls: string[];
browser_config?: BrowserConfig;
crawler_config?: CrawlerConfig;
}
export interface CrawlMarkdownResult {
raw_markdown: string;
markdown_with_citations: string;
references_markdown: string;
fit_markdown: string;
fit_html: string;
}
export interface CrawlMediaResult {
images: Array<{
src?: string | null;
data?: string;
alt?: string | null;
desc?: string;
score?: number;
type?: string;
group_id?: number;
format?: string | null;
width?: number | null;
}>;
videos: Array<{
src?: string | null;
data?: string;
alt?: string | null;
desc?: string;
score?: number;
type?: string;
group_id?: number;
format?: string | null;
width?: number | null;
}>;
audios: Array<{
src?: string | null;
data?: string;
alt?: string | null;
desc?: string;
score?: number;
type?: string;
group_id?: number;
format?: string | null;
width?: number | null;
}>;
}
interface LinkItem {
href: string;
text: string;
title: string;
base_domain?: string | null;
head_data?: Record<string, unknown> | null;
head_extraction_status?: string | null;
head_extraction_error?: string | null;
intrinsic_score?: number;
contextual_score?: number | null;
total_score?: number | null;
}
export interface CrawlLinksResult {
internal: LinkItem[];
external: LinkItem[];
}
export interface CrawlResultItem {
url: string;
html: string;
cleaned_html: string;
fit_html: string;
success: boolean;
error_message?: string;
status_code: number;
response_headers: Record<string, unknown>;
redirected_url?: string;
session_id: string | null;
metadata: Record<string, unknown>;
links: CrawlLinksResult;
media: CrawlMediaResult;
markdown: CrawlMarkdownResult;
tables: unknown[];
extracted_content: unknown | null;
screenshot: string | null;
pdf: string | null;
mhtml: string | null;
js_execution_result: {
success: boolean;
results: unknown[];
} | null;
downloaded_files: unknown | null;
network_requests: unknown | null;
console_messages: unknown | null;
ssl_certificate: unknown | null;
dispatch_result: unknown | null;
}
export interface CrawlEndpointResponse {
success: boolean;
results: CrawlResultItem[];
server_processing_time_s: number;
server_memory_delta_mb: number;
server_peak_memory_mb: number;
}
export {};
//# sourceMappingURL=types.d.ts.map