# I built a discovery layer for AI agents because mine kept getting lost

> Source: <https://dev.to/mkk2026/i-built-a-discovery-layer-for-ai-agents-because-mine-kept-getting-lost-5bjo>
> Published: 2026-07-25 23:54:41+00:00

Everyone's building AI agents right now. Almost nobody's building the boring layer underneath them: how do agents find each other?

I hit this in my own stack. I run a few MCP servers one for search, one for my database, one exposing my product's API. Their addresses lived in a JSON config I edited by hand. When I added a fourth, the file got messy. When one went down, I found out because something downstream broke and I debugged backwards. There was no single source of truth for what agents existed or whether they were alive.

MCP gave agents a common language. There's still no discovery layer. That felt like having HTTP without a service registry.

So I built **agentreg**. It's a self-hosted service registry for agents one Go binary:

agentctl serve &

agentctl register search-agent -c search -e [http://localhost:3000](http://localhost:3000)

agentctl find search # discover by capability, not a hardcoded URL

agentctl list # everything, with live health

It health-checks every registered agent on a heartbeat, so a dead one shows up as `unhealthy`

before it takes something down with it. That single feature has already saved me a debugging session.

A fair question I keep getting: "isn't this just service discovery, like Consul?" Close, but the query is different. Consul answers *where is this service?* a host and port. Agents need *what can this thing do, is it healthy, and can I trust it?* That's capability-first, and it's why the registry is agent-shaped rather

than micro service-shaped.

I'm being upfront about the stage: this is v0.1, I built it solo, and it does discovery + health and nothing more yet. No federation, no auth, no trust verification — though the code has a pluggable verifier seam for exactly that later. It's MIT, self-hosted, no cloud, no account.

Install:

```
brew install mkk2026/tap/agentreg
Repo: https://github.com/mkk2026/agentreg
```

If you run more than a couple of MCP servers, I'd genuinely like to know whether this solves a real annoyance for you or whether I'm a year early. The most useful thing you can tell me is whether you're still running it a week after you try it. That's the only feedback that counts.
