{"modulePath":"github.com/txn2/mcp-data-platform","version":"v1.173.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package endpointwire\n\nPackage endpointwire mounts endpoints (#2170) on the platform's mux: the /endpoints/{name}/... routes and the bot check's, which authenticate a signed-in caller the way the portal does (a browser session, CSRF-checked on a write, or an API key), and the bot check's settings behind the admin API.\n\n## Functions\n\n```go\nfunc Authenticator(a portalAuth, personas Personas) func(r *http.Request) (*eprun.Caller, error)\n```\nAuthenticator adapts the portal's authentication to an endpoint's caller, with whether they administer the platform, the persona their roles resolve to and the API key's name, which an authenticated endpoint admits by (#2259). The portal reports an error only for a browser session refused its CSRF token, which is the caller's credential refused rather than absent. A person of an external persona is refused too (#2290): an authenticated endpoint runs a script, which reaches far more than what is shared with them.\n\n```go\nfunc Mount(mux *http.ServeMux, p *platform.Platform, adminAuth func() func(http.Handler) http.Handler, author func(*http.Request) string)\n```\nMount registers the routes. A deployment with no database has no endpoints and mounts nothing. The settings routes are mounted where the admin API is on, behind adminAuth.\n\n```go\nfunc Raw(p *platform.Platform, next http.Handler) http.Handler\n```\nRaw routes a request under /endpoints/ with an empty or dot segment to the endpoint router before next (the mux) would redirect it (#2628); next alone where the deployment has no endpoints.\n\n## Types\n\n```go\ntype Personas struct {\n\tExternal func(roles []string) bool\n\tName     func(roles []string) string\n\tAdmin    func(roles []string) bool\n}\n```\nPersonas resolves a caller's roles: whether they are an external persona's, the name of the persona they resolve to (\"\" for none), and whether the platform's one administrator rule says they administer it. A nil function answers no.\n\n","path":"github.com/txn2/mcp-data-platform/internal/httpserver/endpointwire","name":"endpointwire","synopsis":"Package endpointwire mounts endpoints (#2170) on the platform's mux: the /endpoints/{name}/...","isRedistributable":true}
