osauer.dev

Go HTTP and MCP

HyperServe keeps a Go service small, but not bare.

It is a thin layer over net/http for services that need the usual HTTP pieces and may also need an MCP surface in the same process. The design bias is plain Go, few dependencies, explicit opt-ins, and code you can read.

import (
    "fmt"
    "net/http"

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

func main() {
    srv, _ := server.NewServer()

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

    srv.Run()
}

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/pkg/server