What is MCP?
The Model Context Protocol (MCP) is an open protocol that enables AI assistants to connect to external data sources and tools. It provides a standardized way for AI models to:- Access external tools - Execute functions and retrieve results
- Read resources - Access reference data and documentation
- Use prompts - Leverage pre-defined prompt templates
- Maintain context - Share information across interactions
How AccessibilityHub Implements MCP
AccessibilityHub implements three core MCP primitives:Tools
5 accessibility analysis tools for testing web pages
Resources
WCAG criteria reference data and contrast thresholds
Prompts
8 pre-built prompt templates for common workflows
MCP Architecture
MCP Tools
Tools are the primary way to execute accessibility analyses. AccessibilityHub provides 5 tools:Tool Registration
Tools are registered when the server starts (fromsrc/server.ts:47-62):
Available Tools
analyze-with-axe
analyze-with-axe
Purpose: Full accessibility analysis using axe-coreBest for: Comprehensive WCAG 2.0/2.1 compliance checkingInput Schema:
urlorhtml(required)options.wcagLevel(“A”, “AA”, “AAA”)options.includeIncomplete(boolean)options.browser(viewport, waitForSelector, etc.)
analyze-with-pa11y
analyze-with-pa11y
Purpose: Alternative WCAG testing engineBest for: Cross-validation with axe-coreInput Schema: Similar to analyze-with-axeReturns: Issues in standardized format, can be combined with axe-core results
analyze-with-lighthouse
analyze-with-lighthouse
Purpose: Google Lighthouse accessibility scoringBest for: Accessibility score (0-100) and score improvement trackingInput Schema:
url(required, no HTML support)options.wcagLeveloptions.browser
analyze-contrast
analyze-contrast
Purpose: Dedicated color contrast analysisBest for: WCAG 2.1 and APCA contrast validation with color fix suggestionsInput Schema:
urlorhtmloptions.wcagLevel(“AA”, “AAA”)options.contrastAlgorithm(“WCAG21”, “APCA”)options.selector(scope to specific section)options.suggestFixes(boolean)
analyze-mixed
analyze-mixed
Purpose: Run multiple tools in parallelBest for: Maximum coverage with intelligent deduplicationInput Schema:
urlorhtmltoolsarray (default: [“axe-core”, “pa11y”])options.deduplicateResults(boolean)options.wcagLeveloptions.browser
Tool Input Validation
All tools use Zod schemas for input validation. Example fromsrc/tools/Axe/types/input.type.ts:
MCP Resources
Resources provide read-only reference data that complements the analysis tools.Resource Registration
Fromsrc/server.ts:82-91:
Available Resources
- WCAG Criteria
- Contrast Thresholds
- Lighthouse Audits
URI Patterns:
wcag://criteria- All WCAG 2.1 criteriawcag://criteria/{id}- Specific criterion (e.g.,1.4.3)wcag://criteria/level/{level}- Filter by A, AA, or AAAwcag://criteria/principle/{principle}- Filter by POUR principle
src/shared/data/wcag-criteria.jsonResponse Format:MCP Prompts
Prompts are pre-defined templates for common workflows. They combine tool calls with structured guidance.Prompt Registration
Fromsrc/server.ts:64-80:
Available Prompts
| Prompt | Purpose | Arguments |
|---|---|---|
full-accessibility-audit | Comprehensive audit with all tools | url, wcagLevel |
lighthouse-audit | Score-focused analysis | url, wcagLevel |
quick-accessibility-check | Fast critical issue check | url |
contrast-check | Detailed contrast review | url, algorithm, wcagLevel |
pre-deploy-check | Deployment gate analysis | url, threshold |
quick-wins-report | High-impact, low-effort fixes | url |
lighthouse-score-improvement | Score improvement plan | url, targetScore |
explain-wcag-criterion | Educational WCAG deep dive | criterion |
Prompt Usage
Users can invoke prompts naturally:- Recognizes the prompt invocation
- Extracts arguments
- Calls appropriate tools (e.g.,
analyze-mixed,analyze-with-lighthouse) - Formats results according to prompt template
- Returns structured output (executive summary, issues by principle, remediation plan)
Communication Protocol
MCP uses JSON-RPC 2.0 over stdio for communication between client and server.Lifecycle
Server Initialization
When the MCP client starts, it spawns the AccessibilityHub server process using the configured command (
npx -y accessibility-hub).Capability Exchange
Client and server exchange capability information:
- Available tools
- Available resources
- Available prompts
- Protocol version
Error Handling
Fromsrc/tools/Base/index.ts, all tools use standardized error responses:
Server Implementation Details
Entry Point
The server is initialized insrc/server.ts:93-129:
Resource Management
AccessibilityHub uses singleton adapters for browser instances to improve performance:- Browser instances are reused across multiple analyses
- Resources are properly cleaned up on shutdown
- Performance is optimized for sequential analyses
Benefits of MCP Architecture
Standardization
One protocol works with all MCP-compatible clients (Claude Desktop, Cursor, Windsurf, etc.)
Discoverability
Clients can discover available tools, resources, and prompts automatically
Type Safety
Input validation via Zod schemas ensures correct tool usage
Composability
Tools can be combined (like analyze-mixed) for powerful workflows
Extensibility
New tools and resources can be added without changing the protocol
Context Sharing
Resources provide shared context across multiple tool invocations
Next Steps
Accessibility Testing Concepts
Learn about the testing tools and methodologies
Enriched Context
Understand the enriched human context feature
Creating Tools
Guide for creating new MCP tools
Project Structure
Detailed project structure explanation