Repository Structure
Core Directories
src/server.ts
Entry point for the MCP server
- Initialize MCP server
- Register all tools, prompts, and resources
- Handle graceful shutdown
- Set up error handling
src/tools/
Accessibility analysis tools
Axe
Axe
axe-core integration
- Tool name:
analyze-with-axe - Analyzes URLs or HTML with axe-core
- Returns WCAG violations and incomplete checks
- Fast execution (~2-3 seconds)
analyzeWithAxeTool: Tool definitiondisposeAxeAdapter: Cleanup function
Pa11y
Pa11y
Pa11y integration
- Tool name:
analyze-with-pa11y - HTML structure and semantic validation
- Uses HTML CodeSniffer rules
- Fast execution (~2 seconds)
analyzeWithPa11yTool: Tool definitiondisposePa11yAdapter: Cleanup function
Lighthouse
Lighthouse
Lighthouse integration
- Tool name:
analyze-with-lighthouse - Provides accessibility score (0-100)
- Detailed audit results
- Slower execution (~5-10 seconds)
analyzeWithLighthouseTool: Tool definitiondisposeLighthouseAdapter: Cleanup function
Contrast
Contrast
Color contrast analysis
- Tool name:
analyze-contrast - WCAG 2.1 and APCA support
- Suggests compliant color fixes
- Very fast (~1-2 seconds)
analyzeContrastTool: Tool definitiondisposeContrastAdapter: Cleanup function
AnalyzeMixed
AnalyzeMixed
Combined multi-tool analysis
- Tool name:
analyze-mixed - Runs axe-core, Pa11y, and Lighthouse in parallel
- Deduplicates common issues
- Returns unified results
analyzeMixedTool: Tool definitiondisposeAnalyzeMixedAdapters: Cleanup function
Base
Base
Shared base utilities
- Common types and interfaces
- Base adapters and normalizers
- Utility functions used by all tools
ToolDefinition: Base tool interfacecreateJsonResponse: Response helperswithToolContext: Tool execution wrapper
Tool Structure
Each tool follows a consistent modular structure:main.ts
Main tool logic
- MCP tool registration
- Request handlers
- Coordinates adapters, normalizers, utils
adapters/
External library wrappers
- Abstract external dependencies
- Handle library initialization
- Manage resources (browsers, etc.)
normalizers/
Data transformation
- Input validation and transformation
- Output standardization
- Enrichment with WCAG context
src/prompts/
MCP prompt templates for common workflows
src/resources/
MCP resources providing reference data
wcag://criteria- All WCAG criteriawcag://criteria/{criterion}- Specific criterion (e.g., 1.1.1)contrast://thresholds/wcag21- WCAG 2.1 thresholdscontrast://thresholds/apca- APCA thresholdslighthouse://audits- Lighthouse audit catalog
src/shared/
Shared utilities across all modules
- data/wcag-criteria.json
- types/common.ts
- utils/wcag-mapper.ts
Naming Conventions
Folders
PascalCase
Tool folders
Axe/Pa11y/AnalyzeMixed/Lighthouse/
lowercase
Subfolders
adapters/normalizers/types/utils/
Files
- kebab-case or toolname.category.ts pattern
- Examples:
main.ts,pa11y.adapter.ts,axe.types.ts - Each subfolder has
index.tsthat re-exports - JSON files:
wcag-criteria.json
Index Files
Module Responsibilities
| Module | Responsibility |
|---|---|
server.ts | MCP server initialization, registration of tools/prompts/resources |
tools/ | Accessibility analysis tools, external library integration |
prompts/ | Prompt templates for common workflows |
resources/ | Read-only reference data (WCAG, thresholds) |
shared/ | Common utilities, types, data used across modules |
tests/ | Test files mirroring src/ structure |
docs/ | User-facing documentation |
scripts/ | Build and automation scripts |
Data Flow
Related
Contributing Overview
Get started with contributing
Creating Tools
Guide for creating new tools