Skip to content

feat: mDNS Discovery (F05)#71

Merged
leocamello merged 8 commits intomainfrom
feature/f05-mdns-discovery
Feb 7, 2026
Merged

feat: mDNS Discovery (F05)#71
leocamello merged 8 commits intomainfrom
feature/f05-mdns-discovery

Conversation

@leocamello
Copy link
Owner

Summary

Implements automatic discovery of LLM backends on local networks using mDNS/Bonjour. Zero-configuration for Ollama instances on the same network.

Changes

New Files

  • src/discovery/mod.rs - Main discovery engine (~450 lines)
  • src/discovery/events.rs - ServiceFound/ServiceRemoved event types
  • src/discovery/parser.rs - TXT record parsing utilities

Modified Files

  • src/registry/mod.rs - Added has_backend_url(), set_mdns_instance(), find_by_mdns_instance()
  • src/cli/serve.rs - Integrated MdnsDiscovery startup
  • src/lib.rs - Added pub mod discovery
  • Cargo.toml - Added mdns-sd = "0.11"
  • docs/FEATURES.md - Updated F05 status to Complete

Specification & Documentation

  • specs/005-mdns-discovery/spec.md - Feature specification
  • specs/005-mdns-discovery/plan.md - Implementation plan
  • specs/005-mdns-discovery/tasks.md - 12 tasks with acceptance criteria
  • specs/005-mdns-discovery/walkthrough.md - Junior-dev friendly code walkthrough

Key Features

  • Discovers Ollama (_ollama._tcp.local) and generic LLM services (_llm._tcp.local)
  • Grace period (60s default) prevents flapping
  • Manual config takes precedence over discovered backends
  • Graceful fallback when mDNS unavailable (Docker, WSL)
  • IPv4 preferred over IPv6

Testing

  • 258 tests total (+34 discovery tests)
  • All tests pass: cargo test

Closes

Closes #59, Closes #60, Closes #61, Closes #62, Closes #63, Closes #64, Closes #65, Closes #66, Closes #67, Closes #68, Closes #69, Closes #70

Adds comprehensive spec for auto-discovering LLM backends via mDNS:
- spec.md: User stories, acceptance criteria, API design
- plan.md: Implementation phases with constitution compliance
- tasks.md: 12 tasks with ~35 tests planned
- verification.md: Template for implementation verification

Key features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable
Implements automatic discovery of LLM backends on local network via mDNS.

Features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Parse TXT records for backend type and API path
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable
- CLI integration with --no-discovery flag

New files:
- src/discovery/mod.rs - Main discovery logic
- src/discovery/events.rs - DiscoveryEvent types
- src/discovery/parser.rs - TXT record parsing

Registry extensions:
- has_backend_url() - Check for existing URL
- set_mdns_instance() - Store mDNS instance name
- find_by_mdns_instance() - Lookup by instance

Tests: 258 passing (+34 new discovery tests)

Closes #59
Closes #60
Closes #61
Closes #62
Closes #63
Closes #64
Closes #65
Closes #66
Closes #67
Closes #68
Closes #69
Closes #70
@leocamello leocamello added the enhancement New feature or request label Feb 7, 2026
@leocamello leocamello added P1 Phase 1 Priority mdns-discovery mDNS Discovery feature (F05) labels Feb 7, 2026
The mdns-sd crate requires service types to end with a trailing dot
(e.g., '_ollama._tcp.local.' not '_ollama._tcp.local'). This fix
normalizes user-provided service types to ensure they work correctly.
138 items verified, 72 items N/A, 0 open issues
@leocamello leocamello merged commit c2b24ed into main Feb 7, 2026
8 checks passed
@leocamello leocamello deleted the feature/f05-mdns-discovery branch February 7, 2026 23:33
leocamello added a commit that referenced this pull request Feb 17, 2026
* docs: add F05 mDNS Discovery specification

Adds comprehensive spec for auto-discovering LLM backends via mDNS:
- spec.md: User stories, acceptance criteria, API design
- plan.md: Implementation phases with constitution compliance
- tasks.md: 12 tasks with ~35 tests planned
- verification.md: Template for implementation verification

Key features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable

* feat: implement mDNS Discovery (F05)

Implements automatic discovery of LLM backends on local network via mDNS.

Features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Parse TXT records for backend type and API path
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable
- CLI integration with --no-discovery flag

New files:
- src/discovery/mod.rs - Main discovery logic
- src/discovery/events.rs - DiscoveryEvent types
- src/discovery/parser.rs - TXT record parsing

Registry extensions:
- has_backend_url() - Check for existing URL
- set_mdns_instance() - Store mDNS instance name
- find_by_mdns_instance() - Lookup by instance

Tests: 258 passing (+34 new discovery tests)

Closes #59
Closes #60
Closes #61
Closes #62
Closes #63
Closes #64
Closes #65
Closes #66
Closes #67
Closes #68
Closes #69
Closes #70

* docs: add F05 mDNS Discovery walkthrough

* docs: add F05 mDNS Discovery to manual testing guide

* fix: normalize mDNS service types with trailing dot

The mdns-sd crate requires service types to end with a trailing dot
(e.g., '_ollama._tcp.local.' not '_ollama._tcp.local'). This fix
normalizes user-provided service types to ensure they work correctly.

* docs: add note about trailing dot normalization for mDNS service types

* chore: complete F05 implementation verification checklist

138 items verified, 72 items N/A, 0 open issues

* docs: clarify verification checklist usage in workflow
leocamello added a commit that referenced this pull request Feb 17, 2026
* docs: add F05 mDNS Discovery specification

Adds comprehensive spec for auto-discovering LLM backends via mDNS:
- spec.md: User stories, acceptance criteria, API design
- plan.md: Implementation phases with constitution compliance
- tasks.md: 12 tasks with ~35 tests planned
- verification.md: Template for implementation verification

Key features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable

* feat: implement mDNS Discovery (F05)

Implements automatic discovery of LLM backends on local network via mDNS.

Features:
- Discover Ollama via _ollama._tcp.local
- Discover generic LLM services via _llm._tcp.local
- Parse TXT records for backend type and API path
- Grace period (60s) prevents service flapping
- Manual config takes precedence over discovered
- Graceful fallback when mDNS unavailable
- CLI integration with --no-discovery flag

New files:
- src/discovery/mod.rs - Main discovery logic
- src/discovery/events.rs - DiscoveryEvent types
- src/discovery/parser.rs - TXT record parsing

Registry extensions:
- has_backend_url() - Check for existing URL
- set_mdns_instance() - Store mDNS instance name
- find_by_mdns_instance() - Lookup by instance

Tests: 258 passing (+34 new discovery tests)

Closes #59
Closes #60
Closes #61
Closes #62
Closes #63
Closes #64
Closes #65
Closes #66
Closes #67
Closes #68
Closes #69
Closes #70

* docs: add F05 mDNS Discovery walkthrough

* docs: add F05 mDNS Discovery to manual testing guide

* fix: normalize mDNS service types with trailing dot

The mdns-sd crate requires service types to end with a trailing dot
(e.g., '_ollama._tcp.local.' not '_ollama._tcp.local'). This fix
normalizes user-provided service types to ensure they work correctly.

* docs: add note about trailing dot normalization for mDNS service types

* chore: complete F05 implementation verification checklist

138 items verified, 72 items N/A, 0 open issues

* docs: clarify verification checklist usage in workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment