Skip to main content

airq-mcp-timeseries

PyPI Python License Tests Publish to PyPI pre-commit enabled

Shared time-series domain layer and Plotly renderer for air-Q MCP providers.

This project is not an MCP server. It is the shared package that consolidates time-series querying, normalization, resampling, summarization and plotting so that mcp-airq and mcp-airq-cloud can reuse the same business logic.

Features

  • shared query, series, summary and plotting data models
  • source-agnostic TimeSeriesProvider protocol
  • metric normalization and query validation
  • resampling and peak-preserving downsampling
  • renderer-independent plot model
  • Plotly rendering for HTML plus matplotlib-based PNG, SVG and WebP exports
  • CSV and Excel export for processed time-series data
  • async high-level orchestration with plot_history(), summarize_history() and export_history()

Installation

pip install airq-mcp-timeseries

This package now includes Pillow as a runtime dependency so WebP rendering works out of the box.

For development:

uv sync --frozen --extra dev
uv run pre-commit install

Usage

from datetime import datetime, timedelta

from airq_mcp_timeseries import HistoryQuery, PlotRequest, Selector, export_history, plot_history

request = PlotRequest(
    selector=Selector(devices=["Living Room", "Office"]),
    metric="co2",
    start=datetime.now().astimezone() - timedelta(hours=6),
    end=datetime.now().astimezone(),
)

result = await plot_history(provider, request)

# PlotRequest defaults to PNG for token-efficient binary artifact responses.

export = await export_history(
    provider,
    HistoryQuery(
        selector=request.selector,
        metric=request.metric,
        start=request.start,
        end=request.end,
    ),
    output_format="csv",
)

One PlotRequest renders one metric across all selected devices into a single plot artifact. One export_history() call likewise produces a single CSV/XLSX file containing rows for all selected devices.

provider must implement the shared TimeSeriesProvider protocol.

Development

Run the full local validation stack:

uv run pre-commit run --all-files
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv run pytest --exitfirst -n auto

Release Process

  1. Update version in pyproject.toml.
  2. Commit the change and create a matching Git tag such as v0.1.2.
  3. Publish a GitHub Release from that tag.

The publish workflow validates that the release tag matches pyproject.toml, builds the package and publishes it to PyPI.

License

Apache License 2.0. See LICENSE.

Metadata

Release files for airq-mcp-timeseries 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airq-mcp-timeseries 0.1.7
File Size Uploaded
airq_mcp_timeseries-0.1.7.tar.gz 97.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for airq-mcp-timeseries 0.1.7
File Interpreter ABI Platform
airq_mcp_timeseries-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 127.4 kB

Release files / airq_mcp_timeseries-0.1.7.tar.gz

Download URL airq_mcp_timeseries-0.1.7.tar.gz
Size 97.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60edcdee3f2e5b69fd82324de493b7cc514554339475ac21b907d52f8345a6f3
BLAKE2b-256 checksum
How to use checksums
3bab5729ebb019e064f05d9aa0cfbc4fd6e4d21e59b2cece6d7c2e371a488cbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release files / airq_mcp_timeseries-0.1.7-py3-none-any.whl

Download URL airq_mcp_timeseries-0.1.7-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e0621987b513e411e216d361e682fd865ec4dddea39cb42ed90a37f4b35a9f1
BLAKE2b-256 checksum
How to use checksums
f2cc1bcf402924cae8e790b11c1d9376ca085701ce4209970052042cd6c9da05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page