Skip to main content
Glama
bilhasry-deriv

Web Accessibility MCP Server

check_accessibility

Analyze web pages for accessibility compliance by scanning URLs with axe-core to identify WCAG guideline violations and improve user experience.

Instructions

Check web accessibility of a given URL using axe-core

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to analyze
waitForSelectorNoOptional CSS selector to wait for before analysis
userAgentNoOptional user agent string to use for the request

Implementation Reference

  • The core handler function for the 'check_accessibility' tool. It validates input, launches a headless Puppeteer browser, navigates to the URL, waits for load, injects axe-core library, runs the accessibility audit, extracts violations with details (impact, description, help, nodes), and returns structured JSON results or error.
    private async handleAccessibilityCheck(request: any) {
      if (!request.params.arguments || typeof request.params.arguments.url !== 'string') {
        throw new McpError(
          ErrorCode.InvalidParams,
          'URL parameter is required'
        );
      }
    
      const args: AnalyzeUrlArgs = {
        url: request.params.arguments.url,
        waitForSelector: typeof request.params.arguments.waitForSelector === 'string' 
          ? request.params.arguments.waitForSelector 
          : undefined,
        userAgent: typeof request.params.arguments.userAgent === 'string'
          ? request.params.arguments.userAgent
          : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
      };
      
      try {
        const browser = await puppeteer.launch({
          headless: true,
          args: [
            '--no-sandbox',
            '--disable-setuid-sandbox',
            '--disable-dev-shm-usage',
            '--disable-accelerated-2d-canvas',
            '--disable-gpu',
            '--window-size=1920,1080',
            '--dns-prefetch-disable'
          ]
        });
        
        const page = await browser.newPage();
        await page.setViewport({ width: 1920, height: 1080 });
        await page.setUserAgent(args.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
        
        console.error(`[Debug] Navigating to ${args.url}`);
        const urlToUse = args.url.replace(/^(https?:\/\/)?(www\.)?/, 'https://www.');
        console.error(`[Debug] Modified URL: ${urlToUse}`);
        const response = await page.goto(urlToUse, { 
          waitUntil: 'domcontentloaded',
          timeout: 30000
        });
        
        console.error(`[Debug] Page loaded with status: ${response?.status()}`);
        
        await page.waitForSelector('body', { timeout: 30000 });
        await new Promise(resolve => setTimeout(resolve, 5000));
    
        await page.evaluate(axe.source);
        const results = await page.evaluate(() => {
          return new Promise((resolve) => {
            // @ts-ignore
            window.axe.run((err: any, results: any) => {
              if (err) {
                resolve({ error: err });
              }
              resolve(results);
            });
          });
        }) as {
          violations: Array<{
            impact: string;
            description: string;
            help: string;
            helpUrl: string;
            nodes: Array<{
              html: string;
              failureSummary: string;
            }>;
          }>;
          passes: unknown[];
          inapplicable: unknown[];
          incomplete: unknown[];
        };
    
        await browser.close();
    
        if ('error' in results) {
          throw new Error(String(results.error));
        }
    
        const violations = results.violations.map(violation => ({
          impact: violation.impact,
          description: violation.description,
          help: violation.help,
          helpUrl: violation.helpUrl,
          nodes: violation.nodes.map((node: any) => ({
            html: node.html,
            failureSummary: node.failureSummary,
          })),
        }));
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                url: args.url,
                timestamp: new Date().toISOString(),
                violations,
                passes: results.passes.length,
                inapplicable: results.inapplicable.length,
                incomplete: results.incomplete.length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error analyzing URL: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the check_accessibility tool, specifying required 'url' and optional parameters for waitForSelector and userAgent.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'URL to analyze',
        },
        waitForSelector: {
          type: 'string',
          description: 'Optional CSS selector to wait for before analysis',
        },
        userAgent: {
          type: 'string',
          description: 'Optional user agent string to use for the request',
        },
      },
      required: ['url'],
    },
  • src/index.ts:108-130 (registration)
    Registration of the check_accessibility tool in the ListTools response, including name, description, and schema.
    {
      name: 'check_accessibility',
      description: 'Check web accessibility of a given URL using axe-core',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to analyze',
          },
          waitForSelector: {
            type: 'string',
            description: 'Optional CSS selector to wait for before analysis',
          },
          userAgent: {
            type: 'string',
            description: 'Optional user agent string to use for the request',
          },
        },
        required: ['url'],
      },
    },
    {
  • src/index.ts:161-162 (registration)
    Dispatch/registration in the CallToolRequestSchema handler that routes calls to check_accessibility to the handleAccessibilityCheck method.
    if (request.params.name === 'check_accessibility') {
      return this.handleAccessibilityCheck(request);
  • TypeScript interface defining the arguments for URL analysis used in the handler.
    interface AnalyzeUrlArgs {
      url: string;
      waitForSelector?: string;
      userAgent?: string;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves: it doesn't mention whether this is a read-only analysis, what the output format might be, potential rate limits, authentication requirements, or error conditions. For a tool that performs web analysis, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a tool with a clear, focused function and is front-loaded with the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there are no annotations and no output schema, the description should provide more complete context for this accessibility checking tool. It doesn't explain what kind of results to expect, what accessibility standards are checked, whether the analysis is comprehensive or limited, or how the tool handles dynamic content. For a tool with 3 parameters and no structured output documentation, this is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so all parameters are documented in the schema itself. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Check') and resource ('web accessibility of a given URL'), and mentions the technology used ('axe-core'). However, it doesn't explicitly differentiate from its sibling tool 'simulate_colorblind', which appears to be a related but distinct accessibility function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its sibling 'simulate_colorblind' or other alternatives. It doesn't mention prerequisites, typical use cases, or exclusions, leaving the agent with no contextual usage information beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bilhasry-deriv/mcp-web-a11y'

If you have feedback or need assistance with the MCP directory API, please join our Discord server