Skip to main content
Glama
michaelahern

Airthings Consumer MCP Server

by michaelahern

airthings

Retrieve current air quality data and device information from Airthings monitors to assess indoor environmental conditions.

Instructions

Get information about my Airthings air quality monitoring devices and their current sensor readings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'airthings' tool handler is registered using server.tool and defined in src/server.ts. It fetches devices and sensor readings from the Airthings API and formats them as a text response.
    server.tool(
        'airthings',
        'Get information about my Airthings air quality monitoring devices and their current sensor readings.',
        async () => {
            const devices = await client.getDevices();
            const sensors = await client.getSensors(SensorUnits.Imperial);
    
            const lines: string[] = [];
            devices.devices.forEach((d) => {
                lines.push(`${d.name} is an Airthings ${d.type.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, char => char.toUpperCase())}`
                    + ` with serial number ${d.serialNumber} that supports the following air quality sensors: ${d.sensors.join(', ')}.`);
    
                const sensorData = sensors.results.find(r => r.serialNumber === d.serialNumber);
                if (sensorData && sensorData.recorded) {
                    lines.push(`Current air quality sensor readings for ${d.name}:`);
                    sensorData.sensors.forEach((s) => {
                        lines.push(`- ${s.sensorType}: ${s.value}${s.unit}`);
                    });
                }
                else {
                    lines.push(`No current readings are available for ${d.name}.`);
                }
    
                lines.push('');
            });
    
            return {
                content: [{
                    type: 'text',
                    text: lines.join('\n')
                }]
            };
        }
    );
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/michaelahern/airthings-consumer-mcp'

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