// route-provider: route-proxy's Go half, one binary the node's runtime launches and speaks MCP to over stdio // through the Go SDK. It runs the SDK's provider helper that answers the consumers of `route` (issue 792), and serves // the module's tools, which read what the proxy keeps on the bus (issue 774, tools.go). // // stdout is the MCP channel, so everything this module says, it says on stderr. package main import ( "context" "fmt" "os" "time" stdio "git.novox.be/novox/mesh-sdk/go" "git.novox.be/novox/mesh-sdk/go/provider" "route-proxy/internal/routestate" ) func say(format string, args ...any) { fmt.Fprintf(os.Stderr, "[route-proxy] "+format+"\n", args...) } func main() { node := os.Getenv("MESH_NODE") if node == "" { say("MESH_NODE is not set; answering no consumers") } else { p := newProvider(node, provider.StateBus(ModuleName), say) go func() { if err := p.Run(context.Background()); err != nil { say("the provider helper stopped: %v", err) } }() } tools := front{routes: stdio.State(routestate.RoutesState), unrouted: stdio.State(routestate.UnroutedState), now: time.Now}.tools() if err := stdio.Serve("", tools); err != nil { say("%v", err) os.Exit(1) } }