@mcptoolshop/a11y-mcp-tools 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +53 -0
- package/CODE_OF_CONDUCT.md +129 -0
- package/CONTRIBUTING.md +136 -0
- package/LICENSE +21 -0
- package/PROV_METHODS_CATALOG.md +104 -0
- package/README.md +168 -0
- package/bin/cli.js +452 -0
- package/bin/server.js +244 -0
- package/fixtures/requests/a11y.diagnose.ok.json +27 -0
- package/fixtures/requests/a11y.evidence.ok.json +25 -0
- package/fixtures/responses/a11y.diagnose.ok.json +139 -0
- package/fixtures/responses/a11y.diagnose.provenance_fail.json +13 -0
- package/fixtures/responses/a11y.evidence.ok.json +88 -0
- package/package.json +48 -0
- package/src/envelope.js +197 -0
- package/src/index.js +9 -0
- package/src/schemas/artifact.js +85 -0
- package/src/schemas/diagnosis.schema.v0.1.json +137 -0
- package/src/schemas/envelope.schema.v0.1.json +108 -0
- package/src/schemas/evidence.bundle.schema.v0.1.json +129 -0
- package/src/schemas/evidence.js +97 -0
- package/src/schemas/index.js +11 -0
- package/src/schemas/provenance.js +140 -0
- package/src/schemas/tools/a11y.diagnose.request.schema.v0.1.json +77 -0
- package/src/schemas/tools/a11y.diagnose.response.schema.v0.1.json +50 -0
- package/src/schemas/tools/a11y.evidence.request.schema.v0.1.json +120 -0
- package/src/schemas/tools/a11y.evidence.response.schema.v0.1.json +50 -0
- package/src/tools/diagnose.js +597 -0
- package/src/tools/evidence.js +481 -0
- package/src/tools/index.js +10 -0
- package/test/contract.test.mjs +154 -0
- package/test/diagnose.test.js +485 -0
- package/test/evidence.test.js +183 -0
- package/test/schema.test.js +327 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [18.x, 20.x, 22.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: npm test
|
|
31
|
+
|
|
32
|
+
- name: Verify CLI works
|
|
33
|
+
run: |
|
|
34
|
+
node bin/cli.js evidence --target fixtures/html/index.html --dom-snapshot --out test-output.json
|
|
35
|
+
test -f test-output.json
|
|
36
|
+
|
|
37
|
+
lint:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Use Node.js
|
|
44
|
+
uses: actions/setup-node@v4
|
|
45
|
+
with:
|
|
46
|
+
node-version: '20.x'
|
|
47
|
+
cache: 'npm'
|
|
48
|
+
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: npm ci
|
|
51
|
+
|
|
52
|
+
- name: Check for syntax errors
|
|
53
|
+
run: node --check bin/cli.js bin/server.js src/index.js
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series
|
|
87
|
+
of actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or
|
|
94
|
+
permanent ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
114
|
+
the community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.0, available at
|
|
120
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
123
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
124
|
+
|
|
125
|
+
[homepage]: https://www.contributor-covenant.org
|
|
126
|
+
|
|
127
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
128
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
129
|
+
https://www.contributor-covenant.org/translations.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Contributing to a11y-mcp-tools
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to a11y-mcp-tools! We appreciate your help in making web accessibility testing more robust and evidence-based.
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Issues
|
|
8
|
+
|
|
9
|
+
If you find a bug or have a suggestion:
|
|
10
|
+
|
|
11
|
+
1. Check if the issue already exists in [GitHub Issues](https://github.com/mcp-tool-shop/a11y-mcp-tools/issues)
|
|
12
|
+
2. If not, create a new issue with:
|
|
13
|
+
- A clear, descriptive title
|
|
14
|
+
- Steps to reproduce (for bugs)
|
|
15
|
+
- Expected vs. actual behavior
|
|
16
|
+
- Your environment (Node version, OS)
|
|
17
|
+
- Sample HTML if relevant
|
|
18
|
+
|
|
19
|
+
### Contributing Code
|
|
20
|
+
|
|
21
|
+
1. **Fork the repository** and create a branch from `main`
|
|
22
|
+
2. **Set up your development environment**
|
|
23
|
+
```bash
|
|
24
|
+
npm install
|
|
25
|
+
```
|
|
26
|
+
3. **Make your changes**
|
|
27
|
+
- Follow the existing code style
|
|
28
|
+
- Add tests for new functionality
|
|
29
|
+
- Ensure all tests pass: `npm test`
|
|
30
|
+
- Update documentation as needed
|
|
31
|
+
4. **Commit your changes**
|
|
32
|
+
- Use clear, descriptive commit messages
|
|
33
|
+
- Reference issue numbers when applicable
|
|
34
|
+
5. **Submit a pull request**
|
|
35
|
+
- Describe what your PR does and why
|
|
36
|
+
- Link to related issues
|
|
37
|
+
|
|
38
|
+
### Development Workflow
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install dependencies
|
|
42
|
+
npm install
|
|
43
|
+
|
|
44
|
+
# Run tests
|
|
45
|
+
npm test
|
|
46
|
+
|
|
47
|
+
# Test CLI locally
|
|
48
|
+
node bin/cli.js evidence --target fixtures/html/example.html --dom-snapshot
|
|
49
|
+
|
|
50
|
+
# Test MCP server locally
|
|
51
|
+
node bin/server.js
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
|
|
56
|
+
All new features should include tests. Tests are located in the `test/` directory and use Node's built-in test runner.
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Example test structure
|
|
60
|
+
import { test } from 'node:test';
|
|
61
|
+
import assert from 'node:assert/strict';
|
|
62
|
+
|
|
63
|
+
test('should detect accessibility issue', () => {
|
|
64
|
+
// Arrange
|
|
65
|
+
const html = '<img src="test.jpg">';
|
|
66
|
+
|
|
67
|
+
// Act
|
|
68
|
+
const result = diagnose({ html });
|
|
69
|
+
|
|
70
|
+
// Assert
|
|
71
|
+
assert.equal(result.findings.length, 1);
|
|
72
|
+
assert.equal(result.findings[0].rule, 'alt');
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Adding New WCAG Rules
|
|
77
|
+
|
|
78
|
+
1. Add rule implementation in `src/rules/`
|
|
79
|
+
2. Add test cases in `test/*.test.js`
|
|
80
|
+
3. Update README.md with rule documentation
|
|
81
|
+
4. Add method ID to PROV_METHODS_CATALOG.md
|
|
82
|
+
5. Update schemas if needed
|
|
83
|
+
|
|
84
|
+
### Code Style
|
|
85
|
+
|
|
86
|
+
- Use ES modules (`import`/`export`)
|
|
87
|
+
- Prefer `const` over `let`
|
|
88
|
+
- Use descriptive variable names
|
|
89
|
+
- Add JSDoc comments for public APIs
|
|
90
|
+
- Follow existing patterns for consistency
|
|
91
|
+
|
|
92
|
+
### MCP Envelope Design Principles
|
|
93
|
+
|
|
94
|
+
- **Tamper-evident** - All evidence includes integrity digests
|
|
95
|
+
- **Traceable** - Provenance records for all operations
|
|
96
|
+
- **Deterministic** - Same input produces same output
|
|
97
|
+
- **Evidence-anchored** - Findings reference specific artifact locations
|
|
98
|
+
- **SAFE guidance** - Fix suggestions describe intent, not direct code writes
|
|
99
|
+
|
|
100
|
+
## Project Structure
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
a11y-mcp-tools/
|
|
104
|
+
├── bin/ # CLI and server entry points
|
|
105
|
+
├── src/ # Source code
|
|
106
|
+
│ ├── tools/ # MCP tool implementations
|
|
107
|
+
│ ├── rules/ # WCAG rule checkers
|
|
108
|
+
│ ├── schemas/ # JSON schemas
|
|
109
|
+
│ └── index.js # Main exports
|
|
110
|
+
├── test/ # Test suite
|
|
111
|
+
├── fixtures/ # Test fixtures
|
|
112
|
+
└── package.json # Project configuration
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Schema Validation
|
|
116
|
+
|
|
117
|
+
All requests and responses must validate against JSON schemas in `src/schemas/`:
|
|
118
|
+
- `envelope.schema.v0.1.json` - MCP envelope format
|
|
119
|
+
- `evidence.bundle.schema.v0.1.json` - Evidence bundle
|
|
120
|
+
- `diagnosis.schema.v0.1.json` - Diagnosis output
|
|
121
|
+
|
|
122
|
+
## Exit Codes
|
|
123
|
+
|
|
124
|
+
Maintain CI-native exit codes:
|
|
125
|
+
- `0` - Success (no findings at/above severity threshold)
|
|
126
|
+
- `2` - Findings exist (operation succeeded, but issues found)
|
|
127
|
+
- `3` - Capture/validation failure
|
|
128
|
+
- `4` - Provenance verification failed
|
|
129
|
+
|
|
130
|
+
## Code of Conduct
|
|
131
|
+
|
|
132
|
+
Please note that this project is released with a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to abide by its terms.
|
|
133
|
+
|
|
134
|
+
## Questions?
|
|
135
|
+
|
|
136
|
+
Open an issue or start a discussion. We're here to help!
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mcp-tool-shop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Provenance Method ID Catalog (v0.1)
|
|
2
|
+
|
|
3
|
+
Stable method IDs for provenance tracking in a11y-mcp-tools.
|
|
4
|
+
|
|
5
|
+
These IDs are **locked** and MUST NOT change within a major version.
|
|
6
|
+
See [prov-spec](https://github.com/mcp-tool-shop/prov-spec) for the full specification.
|
|
7
|
+
|
|
8
|
+
## Envelope Methods
|
|
9
|
+
|
|
10
|
+
| Method ID | Description |
|
|
11
|
+
|-----------|-------------|
|
|
12
|
+
| `adapter.wrap.envelope_v0_1` | Wrap request/response in MCP envelope |
|
|
13
|
+
|
|
14
|
+
## Provenance Methods
|
|
15
|
+
|
|
16
|
+
| Method ID | Description |
|
|
17
|
+
|-----------|-------------|
|
|
18
|
+
| `adapter.provenance.record_v0_1` | Create provenance record with inputs/outputs |
|
|
19
|
+
|
|
20
|
+
## Integrity Methods
|
|
21
|
+
|
|
22
|
+
| Method ID | Description |
|
|
23
|
+
|-----------|-------------|
|
|
24
|
+
| `adapter.integrity.sha256_v0_1` | SHA-256 digest for artifact integrity |
|
|
25
|
+
|
|
26
|
+
## Evidence Capture Methods
|
|
27
|
+
|
|
28
|
+
| Method ID | Description |
|
|
29
|
+
|-----------|-------------|
|
|
30
|
+
| `engine.capture.html_canonicalize_v0_1` | Capture HTML with canonicalization (sorted attrs, normalized whitespace) |
|
|
31
|
+
| `engine.capture.dom_snapshot_v0_1` | Extract DOM snapshot as flat node array |
|
|
32
|
+
| `engine.capture.file_v0_1` | Generic file capture (CLI logs, etc.) |
|
|
33
|
+
|
|
34
|
+
## Diagnosis Methods
|
|
35
|
+
|
|
36
|
+
| Method ID | Description |
|
|
37
|
+
|-----------|-------------|
|
|
38
|
+
| `engine.diagnose.wcag_rules_v0_1` | Evaluate WCAG accessibility rules |
|
|
39
|
+
|
|
40
|
+
## Evidence Extraction Methods
|
|
41
|
+
|
|
42
|
+
| Method ID | Description |
|
|
43
|
+
|-----------|-------------|
|
|
44
|
+
| `engine.extract.evidence.json_pointer_v0_1` | Extract evidence anchor via JSON Pointer (RFC 6901) |
|
|
45
|
+
| `engine.extract.evidence.selector_v0_1` | Extract evidence anchor via CSS selector |
|
|
46
|
+
|
|
47
|
+
## Fix Guidance Methods
|
|
48
|
+
|
|
49
|
+
| Method ID | Description |
|
|
50
|
+
|-----------|-------------|
|
|
51
|
+
| `engine.generate.fix_guidance_v0_1` | Generate SAFE-only fix guidance (intent patches) |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Method ID Naming Convention
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
<namespace>.<action>.<target>_v<major>_<minor>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Namespaces:**
|
|
62
|
+
- `adapter.*` - Data transformation, wrapping, integrity
|
|
63
|
+
- `engine.*` - Core processing (capture, diagnose, extract)
|
|
64
|
+
|
|
65
|
+
**Versioning:**
|
|
66
|
+
- Method IDs include version suffix (e.g., `_v0_1`)
|
|
67
|
+
- Breaking changes require new method ID
|
|
68
|
+
- Minor changes (backwards-compatible) use same ID
|
|
69
|
+
|
|
70
|
+
## Usage in Provenance Records
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"provenance": {
|
|
75
|
+
"record_id": "prov:record:abc123",
|
|
76
|
+
"methods": [
|
|
77
|
+
"adapter.wrap.envelope_v0_1",
|
|
78
|
+
"adapter.provenance.record_v0_1",
|
|
79
|
+
"adapter.integrity.sha256_v0_1",
|
|
80
|
+
"engine.capture.html_canonicalize_v0_1",
|
|
81
|
+
"engine.capture.dom_snapshot_v0_1"
|
|
82
|
+
],
|
|
83
|
+
"inputs": ["html/index.html"],
|
|
84
|
+
"outputs": ["artifact:html:index", "artifact:dom:index"],
|
|
85
|
+
"verified": false,
|
|
86
|
+
"created_at": "2026-01-27T04:12:00Z"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Adding New Methods
|
|
92
|
+
|
|
93
|
+
1. Choose appropriate namespace (`adapter.*` or `engine.*`)
|
|
94
|
+
2. Use descriptive action + target naming
|
|
95
|
+
3. Include version suffix
|
|
96
|
+
4. Add to this catalog with description
|
|
97
|
+
5. Update `src/schemas/provenance.js`
|
|
98
|
+
|
|
99
|
+
## Related
|
|
100
|
+
|
|
101
|
+
- [prov-spec](https://github.com/mcp-tool-shop/prov-spec) - Full provenance specification
|
|
102
|
+
- [envelope.schema.v0.1.json](src/schemas/envelope.schema.v0.1.json) - MCP envelope schema
|
|
103
|
+
- [evidence.bundle.schema.v0.1.json](src/schemas/evidence.bundle.schema.v0.1.json) - Bundle schema
|
|
104
|
+
- [diagnosis.schema.v0.1.json](src/schemas/diagnosis.schema.v0.1.json) - Diagnosis schema
|
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# a11y-mcp-tools
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) tools for accessibility evidence capture and diagnosis.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
### `a11y.evidence`
|
|
8
|
+
|
|
9
|
+
Capture tamper-evident evidence bundles from HTML files, CLI logs, or other inputs.
|
|
10
|
+
|
|
11
|
+
**Capabilities:**
|
|
12
|
+
- Canonical HTML normalization
|
|
13
|
+
- DOM snapshot extraction
|
|
14
|
+
- SHA-256 integrity digests
|
|
15
|
+
- prov-spec provenance records
|
|
16
|
+
|
|
17
|
+
### `a11y.diagnose`
|
|
18
|
+
|
|
19
|
+
Run deterministic accessibility checks over evidence bundles.
|
|
20
|
+
|
|
21
|
+
**Capabilities:**
|
|
22
|
+
- WCAG 2.2 AA rule checking
|
|
23
|
+
- Evidence-anchored findings (JSON Pointer, CSS selector, line spans)
|
|
24
|
+
- SAFE-only fix guidance (intent patches, not direct writes)
|
|
25
|
+
- Provenance verification
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g a11y-mcp-tools
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### CLI (Recommended)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Capture evidence from HTML file
|
|
39
|
+
a11y evidence --target index.html --dom-snapshot --out evidence.json
|
|
40
|
+
|
|
41
|
+
# Diagnose captured evidence
|
|
42
|
+
a11y diagnose --bundle evidence.json --fix
|
|
43
|
+
|
|
44
|
+
# With provenance verification
|
|
45
|
+
a11y diagnose --bundle evidence.json --verify-provenance --fix
|
|
46
|
+
|
|
47
|
+
# Output with MCP envelope
|
|
48
|
+
a11y evidence --target page.html --dom-snapshot --envelope
|
|
49
|
+
|
|
50
|
+
# One-liner capture and diagnose
|
|
51
|
+
a11y evidence --target page.html --dom-snapshot | a11y diagnose --fix
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Exit Codes (CI-native):**
|
|
55
|
+
- `0` - Success (no findings at/above `--fail-on`)
|
|
56
|
+
- `2` - Findings exist (tool succeeded, but issues found)
|
|
57
|
+
- `3` - Capture/validation failure (bad input, schema error)
|
|
58
|
+
- `4` - Provenance verification failed (digest mismatch)
|
|
59
|
+
|
|
60
|
+
### As MCP Server
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
a11y-mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### MCP Envelope Format (v0.1)
|
|
67
|
+
|
|
68
|
+
Requests and responses use a standard envelope:
|
|
69
|
+
|
|
70
|
+
**Request:**
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcp": {
|
|
74
|
+
"envelope": "mcp.envelope_v0_1",
|
|
75
|
+
"request_id": "req_01HR9Y6GQ7V8WQ0K8N9K",
|
|
76
|
+
"tool": "a11y.evidence",
|
|
77
|
+
"client": { "name": "a11y-cli", "version": "0.2.0" }
|
|
78
|
+
},
|
|
79
|
+
"input": {
|
|
80
|
+
"targets": [{ "kind": "file", "path": "html/index.html" }],
|
|
81
|
+
"capture": { "html": { "canonicalize": true }, "dom": { "snapshot": true } }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Response:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcp": {
|
|
90
|
+
"envelope": "mcp.envelope_v0_1",
|
|
91
|
+
"request_id": "req_01HR9Y6GQ7V8WQ0K8N9K",
|
|
92
|
+
"tool": "a11y.evidence",
|
|
93
|
+
"ok": true
|
|
94
|
+
},
|
|
95
|
+
"result": {
|
|
96
|
+
"bundle": { ... }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Error:**
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcp": {
|
|
105
|
+
"envelope": "mcp.envelope_v0_1",
|
|
106
|
+
"request_id": "req_01HR9Y6GQ7V8WQ0K8N9K",
|
|
107
|
+
"tool": "a11y.diagnose",
|
|
108
|
+
"ok": false
|
|
109
|
+
},
|
|
110
|
+
"error": {
|
|
111
|
+
"code": "PROVENANCE_VERIFICATION_FAILED",
|
|
112
|
+
"message": "Evidence digest mismatch for artifact:dom:index.",
|
|
113
|
+
"fix": "Re-run a11y.evidence to recapture evidence."
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Schemas
|
|
119
|
+
|
|
120
|
+
JSON Schemas are provided for validation:
|
|
121
|
+
|
|
122
|
+
- [`envelope.schema.v0.1.json`](src/schemas/envelope.schema.v0.1.json) - MCP envelope format
|
|
123
|
+
- [`evidence.bundle.schema.v0.1.json`](src/schemas/evidence.bundle.schema.v0.1.json) - Evidence bundle format
|
|
124
|
+
- [`diagnosis.schema.v0.1.json`](src/schemas/diagnosis.schema.v0.1.json) - Diagnosis output format
|
|
125
|
+
|
|
126
|
+
## Method ID Catalog (v0.1)
|
|
127
|
+
|
|
128
|
+
Stable method IDs for provenance tracking. See [PROV_METHODS_CATALOG.md](PROV_METHODS_CATALOG.md) for full documentation.
|
|
129
|
+
|
|
130
|
+
| Method ID | Description |
|
|
131
|
+
|-----------|-------------|
|
|
132
|
+
| `adapter.wrap.envelope_v0_1` | Wrap in MCP envelope |
|
|
133
|
+
| `adapter.provenance.record_v0_1` | Provenance record creation |
|
|
134
|
+
| `adapter.integrity.sha256_v0_1` | SHA-256 integrity verification |
|
|
135
|
+
| `engine.capture.html_canonicalize_v0_1` | HTML capture with canonicalization |
|
|
136
|
+
| `engine.capture.dom_snapshot_v0_1` | DOM snapshot extraction |
|
|
137
|
+
| `engine.diagnose.wcag_rules_v0_1` | WCAG rule evaluation |
|
|
138
|
+
| `engine.extract.evidence.json_pointer_v0_1` | JSON Pointer evidence extraction |
|
|
139
|
+
| `engine.extract.evidence.selector_v0_1` | CSS selector evidence extraction |
|
|
140
|
+
|
|
141
|
+
## Shared Artifact Model
|
|
142
|
+
|
|
143
|
+
Both tools work with a shared artifact/provenance model:
|
|
144
|
+
|
|
145
|
+
- **Artifacts**: Captured content with digests and metadata
|
|
146
|
+
- **Evidence Anchors**: Pointers back to artifact locations (JSON Pointer, selector, line span)
|
|
147
|
+
- **Provenance**: prov-spec records documenting capture and analysis
|
|
148
|
+
|
|
149
|
+
## WCAG Rules (v0.1)
|
|
150
|
+
|
|
151
|
+
| Rule | Finding ID | WCAG | Description |
|
|
152
|
+
|------|-----------|------|-------------|
|
|
153
|
+
| `lang` | `a11y.lang.missing` | 3.1.1 | Missing lang attribute on html element |
|
|
154
|
+
| `alt` | `a11y.img.missing_alt` | 1.1.1 | Missing alt attribute on img element |
|
|
155
|
+
| `button-name` | `a11y.button.missing_name` | 4.1.2 | Button without accessible name |
|
|
156
|
+
| `link-name` | `a11y.link.missing_name` | 4.1.2 | Link without accessible name |
|
|
157
|
+
| `label` | `a11y.input.missing_label` | 1.3.1 | Form input without label |
|
|
158
|
+
|
|
159
|
+
## Related
|
|
160
|
+
|
|
161
|
+
- [prov-spec](https://github.com/mcp-tool-shop/prov-spec) - Provenance specification
|
|
162
|
+
- [a11y-evidence-engine](https://github.com/mcp-tool-shop/a11y-evidence-engine) - CLI scanner
|
|
163
|
+
- [a11y-assist](https://github.com/mcp-tool-shop/a11y-assist) - Fix advisor
|
|
164
|
+
- [a11y-demo-site](https://github.com/mcp-tool-shop/a11y-demo-site) - Demo with CI workflows
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|