osauer.dev

Go HTTP server library

A net/http-shaped Go server library with optional MCP.

HyperServe began as the Go API server I wanted to own. It keeps ordinary net/http handlers and collects lifecycle, typed boundaries, security, observability, WebSocket, and optional MCP in one module. Its in-tree protocols mean fewer packages to assemble and more protocol code maintained here.

import (
    "fmt"
    "log"
    "net/http"

    server "github.com/osauer/hyperserve/pkg/server"
)

func main() {
    srv, err := server.NewServer()
    if err != nil {
        log.Fatal(err)
    }

    srv.GET("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintln(w, "Hello, World!")
    })

    if err := srv.Run(); err != nil {
        log.Fatal(err)
    }
}

What it gives you

HTTP shape

Method-aware routes on top of Go's ServeMux, middleware stacks, recovery, request logging, metrics, CORS, security headers, auth, and graceful shutdown.

Typed edges

Request binding and validation for JSON, query, and form input. JSONHandler wraps bind, validate, call, and respond without pulling in a larger framework.

Protocol pieces

WebSocket, SSE formatting, JSON-RPC, static file serving sandboxed with os.Root, and deferred initialization for services that need a fast health endpoint.

MCP when it belongs in the server

Install

go get github.com/osauer/hyperserve@latest