mcpoauthpage

package
v0.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mcpoauthpage renders the page a browser lands on after an MCP OAuth redirect reaches the daemon's loopback callback. The page is standalone: its styles, fonts and brand images are embedded and inlined as data URIs, so it needs no other route and runs under a CSP that only admits its own hashed style and script.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentSecurityPolicy

func ContentSecurityPolicy() string

ContentSecurityPolicy is the policy every rendered page must be served with.

func Render

func Render(w io.Writer, page Page) error

Render writes the callback page for one outcome.

Types

type Outcome

type Outcome string

Outcome is what the callback did, as the person in the browser needs to know it.

const (
	// OutcomeConnected means the token was stored and the server is usable.
	OutcomeConnected Outcome = "connected"
	// OutcomeDeclined means the provider redirected back with an OAuth error.
	OutcomeDeclined Outcome = "declined"
	// OutcomeExpired means the sign-in no longer exists: past its TTL or already used.
	OutcomeExpired Outcome = "expired"
	// OutcomeChanged means the server definition changed while the sign-in was open.
	OutcomeChanged Outcome = "changed"
	// OutcomeUnavailable means the runtime could not take the callback yet.
	OutcomeUnavailable Outcome = "unavailable"
	// OutcomeFailed is every other failure; Diagnostic carries the reason.
	OutcomeFailed Outcome = "failed"
)

type Page

type Page struct {
	Outcome     Outcome
	Server      *Server
	Scope       mcpauth.Scope
	ProjectName string
	Scopes      []string
	Refreshable bool
	ExpiresAt   *time.Time
	// Code is the machine-readable reason shown under a failure message.
	Code string
	// Diagnostic is a copyable summary for unclassified failures; it never holds raw error text.
	Diagnostic string
	Now        time.Time
}

Page is one rendered outcome. Server is nil when the callback no longer resolves to a sign-in.

type Server

type Server struct {
	Name string
	// Host is the host of the server's remote URL.
	Host string
}

Server identifies the MCP server the sign-in was for.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL