Node.js + TypeScript MCP 서버 구현: - 5개 도구: inspect_page, inspect_site, get_inspection, get_issues, get_history - 듀얼 트랜스포트: stdio (Claude Desktop) + Streamable HTTP (Docker/원격) - i18n 지원 (영어/한국어) - Docker 통합 (port 3100) + Nginx /mcp 프록시 - Smithery 레지스트리 배포 설정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
145 lines
3.8 KiB
TypeScript
145 lines
3.8 KiB
TypeScript
/**
|
|
* REST API client for Web Inspector backend.
|
|
* Uses native fetch (Node 20+) with AbortController timeout.
|
|
*/
|
|
export declare class ApiClient {
|
|
private baseUrl;
|
|
constructor(baseUrl: string);
|
|
startInspection(url: string, accessibilityStandard?: string): Promise<{
|
|
inspection_id: string;
|
|
status: string;
|
|
}>;
|
|
getInspection(inspectionId: string): Promise<InspectionResult>;
|
|
getIssues(inspectionId: string, category?: string, severity?: string): Promise<IssuesResult>;
|
|
getInspections(url?: string, limit?: number): Promise<InspectionsListResult>;
|
|
startSiteInspection(url: string, maxPages?: number, maxDepth?: number, accessibilityStandard?: string): Promise<{
|
|
site_inspection_id: string;
|
|
status: string;
|
|
}>;
|
|
getSiteInspection(siteInspectionId: string): Promise<SiteInspectionResult>;
|
|
getSiteInspections(limit?: number): Promise<SiteInspectionsListResult>;
|
|
private get;
|
|
private post;
|
|
private request;
|
|
}
|
|
export interface Issue {
|
|
code: string;
|
|
category: string;
|
|
severity: "critical" | "major" | "minor" | "info";
|
|
message: string;
|
|
element?: string;
|
|
line?: number;
|
|
suggestion: string;
|
|
wcag_criterion?: string;
|
|
kwcag_criterion?: string;
|
|
kwcag_name?: string;
|
|
kwcag_principle?: string;
|
|
}
|
|
export interface CategoryResult {
|
|
score: number;
|
|
grade: string;
|
|
total_issues: number;
|
|
critical: number;
|
|
major: number;
|
|
minor: number;
|
|
info: number;
|
|
issues: Issue[];
|
|
wcag_level?: string;
|
|
}
|
|
export interface InspectionResult {
|
|
inspection_id: string;
|
|
url: string;
|
|
status: "running" | "completed" | "error";
|
|
created_at: string;
|
|
completed_at?: string;
|
|
duration_seconds?: number;
|
|
overall_score: number;
|
|
grade: string;
|
|
accessibility_standard?: string;
|
|
categories: {
|
|
html_css: CategoryResult;
|
|
accessibility: CategoryResult;
|
|
seo: CategoryResult;
|
|
performance_security: CategoryResult;
|
|
};
|
|
summary: {
|
|
total_issues: number;
|
|
critical: number;
|
|
major: number;
|
|
minor: number;
|
|
info: number;
|
|
};
|
|
}
|
|
export interface IssuesResult {
|
|
inspection_id: string;
|
|
total: number;
|
|
filters: Record<string, string | null>;
|
|
issues: Issue[];
|
|
}
|
|
export interface InspectionsListResult {
|
|
items: Array<{
|
|
inspection_id: string;
|
|
url: string;
|
|
created_at: string;
|
|
overall_score: number;
|
|
grade: string;
|
|
total_issues: number;
|
|
}>;
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
total_pages: number;
|
|
}
|
|
export interface SiteInspectionResult {
|
|
site_inspection_id: string;
|
|
root_url: string;
|
|
domain: string;
|
|
status: "crawling" | "inspecting" | "completed" | "error";
|
|
created_at: string;
|
|
completed_at?: string;
|
|
config: {
|
|
max_pages: number;
|
|
max_depth: number;
|
|
concurrency: number;
|
|
accessibility_standard: string;
|
|
};
|
|
discovered_pages: Array<{
|
|
url: string;
|
|
depth: number;
|
|
parent_url?: string;
|
|
inspection_id?: string;
|
|
status: string;
|
|
title?: string;
|
|
overall_score?: number;
|
|
grade?: string;
|
|
}>;
|
|
aggregate_scores?: {
|
|
overall_score: number;
|
|
grade: string;
|
|
html_css: number;
|
|
accessibility: number;
|
|
seo: number;
|
|
performance_security: number;
|
|
total_issues: number;
|
|
pages_inspected: number;
|
|
pages_total: number;
|
|
};
|
|
}
|
|
export interface SiteInspectionsListResult {
|
|
items: Array<{
|
|
site_inspection_id: string;
|
|
root_url: string;
|
|
domain: string;
|
|
status: string;
|
|
created_at: string;
|
|
pages_total: number;
|
|
pages_inspected: number;
|
|
overall_score?: number;
|
|
grade?: string;
|
|
}>;
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
total_pages: number;
|
|
}
|