Skip to main content
Glama
MCP WCAG Accessibility Tool

MCP WCAG Accessibility Tool

README.md
# MCP WCAG Accessibility Tool ๐Ÿฆพ

A powerful Model Context Protocol (MCP) server for comprehensive WCAG accessibility analysis and code remediation.

## ๐ŸŒŸ Features

- **10 Professional Tools** for accessibility analysis
- **WCAG 2.0, 2.1, 2.2** support
- **Multi-framework** support (HTML, React, Vue, Angular)
- **Live URL auditing** capability
- **ESLint configuration** generator
- **Automatic code refactoring**
- **GitHub WCAG repository** integration
- **10 languages** supported

## ๐Ÿ› ๏ธ Available Tools

1. **analyze_accessibility** - Analyze code for WCAG violations
2. **refactor_for_wcag** - Automatically fix accessibility issues
3. **validate_compliance** - Check WCAG compliance levels (A, AA, AAA)
4. **get_documentation** - Get WCAG documentation for specific rules
5. **annotate_code** - Add inline comments with accessibility issues
6. **accessibility_score** - Calculate detailed accessibility score (0-100)
7. **generate_component** - Generate accessible component templates
8. **eslint_config** - Generate ESLint configuration with a11y rules
9. **live_url_audit** - Audit live websites for accessibility
10. **wcag_github_sync** - Sync with official WCAG GitHub repository

## ๐Ÿ“‹ Prerequisites

- Node.js 18+ (tested with v22.14.0)
- npm or yarn
- Claude Desktop app

## ๐Ÿ”ง Installation

### 1. Clone the repository
```bash
git clone https://github.com/YOUR_USERNAME/mcp-wcag.git
cd mcp-wcag
```

### 2. Install dependencies
```bash
npm install
```

### 3. Build the project
```bash
npm run build
```

### 4. Verify installation
```bash
npm run verify
```

## โš™๏ธ Claude Desktop Configuration

### Windows
Add to `%APPDATA%\Claude\claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "wcag-accessibility": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-wcag\\dist\\index.js"]
    }
  }
}
```

### Mac/Linux
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "wcag-accessibility": {
      "command": "node",
      "args": ["/path/to/mcp-wcag/dist/index.js"]
    }
  }
}
```

## ๐Ÿงช Testing

Run the test suite:
```bash
npm test
```

Test individual tools:
```bash
node test-tools.mjs
```

## ๐Ÿ“– Usage Examples

### Analyze HTML for accessibility
```
Analyze this HTML for WCAG AA compliance:
<html>
  <img src="test.jpg">
  <button></button>
</html>
```

### Generate ESLint configuration
```
Generate an ESLint configuration for React with TypeScript and accessibility rules
```

### Audit a live website
```
Analyze https://example.com for accessibility issues
```

### Generate accessible component
```
Generate an accessible modal component in React
```

## ๐Ÿ—๏ธ Project Structure

```
mcp-wcag/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts           # Main server entry point
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ WCAGAnalyzer.ts
โ”‚   โ”‚   โ”œโ”€โ”€ CodeParser.ts
โ”‚   โ”‚   โ””โ”€โ”€ AccessibilityFixer.ts
โ”‚   โ”œโ”€โ”€ rules/
โ”‚   โ”‚   โ””โ”€โ”€ wcagRules.ts
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ analyzeAccessibility.ts
โ”‚       โ”œโ”€โ”€ refactorForWCAG.ts
โ”‚       โ”œโ”€โ”€ validateCompliance.ts
โ”‚       โ””โ”€โ”€ ... (7 more tools)
โ”œโ”€โ”€ dist/                  # Compiled JavaScript
โ”œโ”€โ”€ wcag-data/            # Local WCAG data cache
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ README.md
```

## ๐Ÿ”„ Development

### Watch mode
```bash
npm run dev
```

### Lint code
```bash
npm run lint
```

### Format code
```bash
npm run format
```

## ๐Ÿ› Troubleshooting

### Common Issues

**Issue**: `require is not defined`
- **Solution**: Project uses ES modules. All imports must use `import` syntax.

**Issue**: Server crashes on startup
- **Solution**: Run `npm run verify` to check installation

**Issue**: Tools not showing in Claude
- **Solution**: Restart Claude Desktop after configuration

## ๐Ÿ“Š WCAG Coverage

- **Automated detection**: ~30-40% of WCAG criteria
- **Success criteria**: 225 total (2.0, 2.1, 2.2)
- **Techniques**: 850+ documented
- **Code examples**: 500+
- **Languages**: 10 (EN, ES, FR, DE, PT, IT, NL, JA, KO, ZH)

## ๐Ÿค Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## ๐Ÿ“ License

MIT License - see [LICENSE](LICENSE) file for details

## ๐Ÿ™ Acknowledgments

- W3C WAI for WCAG specifications
- Deque Systems for axe-core inspiration
- Claude/Anthropic for MCP framework
- WCAG community for guidelines

## ๐Ÿ“ง Contact

- GitHub: [@YOUR_USERNAME](https://github.com/YOUR_USERNAME)
- Project Link: [https://github.com/YOUR_USERNAME/mcp-wcag](https://github.com/YOUR_USERNAME/mcp-wcag)

## ๐Ÿš€ Version History

- **v3.0.1** - Bug fixes for ES modules and error handling
- **v3.0.0** - Added GitHub WCAG sync
- **v2.1.0** - Added ESLint config and live URL audit
- **v2.0.0** - Added scoring, annotation, and component generation
- **v1.0.0** - Initial release with 4 core tools

---

**Made with โค๏ธ for web accessibility**

TDQS

B3.2/5.0

Scored across 10 tools

Disambiguation3/5

Most tools target distinct actions, but analyze_accessibility, validate_compliance, and accessibility_score all inspect code for WCAG-related findings and could be confused depending on whether the agent wants issues, pass/fail validation, or a score. The descriptions help somewhat, but the boundary between analysis, validation, and scoring is not fully crisp.

Naming Consistency3/5

The tools consistently use snake_case, but the naming conventions are mixed: most are verb_noun or verb_prep_noun, while accessibility_score, live_url_audit, wcag_github_sync, and eslint_config are noun-first. The names remain readable, but the pattern is not predictable.

Tool Count5/5

Ten tools is well-scoped for a WCAG accessibility server, covering analysis, refactoring, validation, scoring, documentation, live auditing, sync, component generation, and lint configuration. Each tool appears to occupy a meaningful part of the workflow without excessive surface area.

Completeness4/5

The surface covers the main accessibility lifecycle: analyzing code, auditing live URLs, validating, refactoring, annotating, scoring, generating accessible components, and producing ESLint configuration. Minor gaps remain, such as explicit batch/site-wide auditing or report export, but core workflows are well covered.