GraphMyAnything

Documentation

Build once. Ask forever. graphmyanything-mcp is local metric memory for AI agents: SQLite-backed history with track, forget, query, insight, and chart so agents read stored series without re-fetching every time.

Open source on GitHub. Charts write to disk today; hosted live chart URLs on graphmyanything.com roll out to founding members first.

Quick install

npx -y graphmyanything-mcp@latest

Guides

Five MCP tools

Every tool response includes tokens_estimate (JSON length ÷ 4, approximate). MCP resources usage-guide and chart-guide ship the condensed agent docs without bloating tools/list.

  • track

    Upsert one or many points on (metric, ts). Returns written (new timestamps) and replaced (updated timestamps).

    Example arguments

    {
      "metric": "stripe.mrr.usd",
      "value": 84210,
      "tags": { "plan": "mixed", "source": "n8n" }
    }

    Example response

    {
      "ok": true,
      "metric": "stripe.mrr.usd",
      "written": 1,
      "replaced": 0,
      "tokens_estimate": 20
    }
  • forget

    Delete a single ts, an inclusive from/to range (Unix seconds), or the whole metric with all: true plus confirm: true. metric is always required.

    Example arguments

    {
      "metric": "health.weight.lb",
      "ts": 1731888000
    }

    Example response

    {
      "ok": true,
      "metric": "health.weight.lb",
      "deleted": 1,
      "tokens_estimate": 18
    }
  • query

    Terse stats (s.l, s.mn, s.tr, …) plus optional LTTB pts within token_budget. points: 0 | auto | N; also_chart omits pts for a follow-up chart.

    Example arguments

    {
      "metric": "stripe.mrr.usd",
      "range": "90d",
      "token_budget": 300,
      "also_chart": true,
      "points": "auto"
    }

    Example response

    {
      "m": "stripe.mrr.usd",
      "rg": "90d",
      "s": { "l": 84210, "mn": 80100, "mx": 84210, "mu": 82105, "tr": "up", "pct": 4.2, "n": 90 },
      "tokens_estimate": 52
    }
  • insight

    Plain-English trend, MAD anomalies, naive linear forecast for metric + range.

    Example arguments

    {
      "metric": "health.weight.lb",
      "range": "90d"
    }

    Example response

    {
      "summary": "Metric \"health.weight.lb\" (42 points, 90d). Upward trend…",
      "trend": "Upward trend over 90d: latest 182.4, 2.1% vs start.",
      "anomalies": [],
      "forecast": { "horizon": 3, "next_values": [182.1, 181.9, 181.7], "method": "naive_linear_regression_on_index" },
      "stats": { "latest": 182.4, "count": 42, "trend": "up", "pct_change": 2.1 },
      "tokens_estimate": 120
    }
  • chart

    640×320 SVG on disk. type: line | bar | area; theme: dark | light; labels: none | last | extremes | all.

    Example arguments

    {
      "metric": "geo.plano_tx.population",
      "range": "30y",
      "type": "area",
      "theme": "dark",
      "labels": "extremes"
    }

    Example response

    {
      "path": "/home/you/.graphmyanything/charts/geo.plano_tx.population-….svg",
      "url": null,
      "hosted_url_note": "Hosted live chart URLs are coming soon: graphmyanything.com",
      "tokens_estimate": 48
    }

Token benchmark

Lean query + chart flows use about 284 tokens vs 658 for cold Python-on-disk (~56.8% fewer) in the published benchmark. benchmarks/token-benchmark/results.md