Gnat, self-hosted analytics as a single Go binary, with a built-in MCP server

2 5 17
calendar_today agoschedule2 min read
— Originally published at dev.to

title: Gnat, self-hosted analytics as a single Go binary, with a built-in MCP server

tags: go, selfhosted, opensource, ai

A few months back I was crawling the web for a side project and came across an analytics platform's data that had exposed users' raw IPs. It wasn't malicious, just careless. But it stuck with me: most people using these tools have no idea their visitors' data is sitting around like that.

That's the moment that pushed me to build Gnat, a self-hosted analytics tool that doesn't cut corners on privacy, but also doesn't force you into a painful setup to get it.

No third party, no phoning home

Gnat runs entirely on infrastructure you control. There's no third party in the loop, no API calling home anywhere, and no data leaving your server. It's also completely free and open source, the whole thing is on GitHub.

One binary, zero bloat

Most self-hosted analytics tools make you choose: either something lightweight with barely any real analysis, or something with real analytical depth that also means Docker, a multi-service stack, and its own ops burden just to keep running.

Gnat is a single Go binary. No CGO, no Docker, no multi-service stack. The dashboard (HTML, CSS, JS) is compiled directly into the executable, so there's nothing else to install alongside it.

tar xzf gnat-vX.Y.Z-linux-amd64.tar.gz
cd gnat-vX.Y.Z-linux-amd64
./gnat

That's the whole install.

Real analytical depth

Despite being one binary, Gnat doesn't skimp on features:

  • Pageviews and custom events via a simple JSON POST (no per-language SDKs needed)
  • Funnels, cohorts, retention curves
  • Auto-discovered path analysis
  • SQLite by default, or Postgres/MySQL if that's how you already run infrastructure
  • CSV, JSON, jsonL, it's your data

Built for the agent era

The part I had the most fun building: Gnat ships with a native MCP server. Claude or any MCP-compatible agent can query your analytics directly, ask what changed, pull a report, whatever you need.

Where it's at

This is early, v0.1.0, and I'm actively building on it. Multi-site support, SSO/team access, and managed hosting are all on the roadmap but not built yet, the README is upfront about what's real today versus what's planned.

Gnat is licensed under AGPLv3, free to self-host and modify for any purpose, including commercially, but if you run a modified version as a service for others, the source has to stay open under the same terms.

Repo: https://github.com/var-raphael/Gnat

Feedback, issues, and contributions are very welcome. I'd love to hear what you think, especially if you've felt the same Docker-and-multi-service fatigue trying to self-host analytics.

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

MCP Is the USB-C of AI. So Why Are You Plugging Everything In?

Ken W. Algerverified - Jun 10

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

The Audit Trail of Things: Using Hashgraph as a Digital Caliper for Provenance

Ken W. Algerverified - Apr 28
chevron_left
397 Points24 Badges
6Posts
6Comments
1Connections
Full-stack generalist. Shipped 7 SaaS products, currently building Quorel because I got tired of scr... Show more

Commenters (This Week)

4 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!