admin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeStatic

func ServeStatic(w http.ResponseWriter, r *http.Request)

ServeStatic serves static files from the embedded assets

Types

type Admin

type Admin struct {
	// contains filtered or unexported fields
}

Admin handles admin UI requests

func New

func New(config *types.Config, getStats func() *Stats, getProviders func() []ProviderInfo, getMCPServers func() []MCPServerInfo, getMCPTools func(string) ([]ToolInfo, error), getModels func() []ModelInfo, mcpStorage storage.MCPStorage, mcpStorageWritable bool, onMCPServerChange func(), onMCPCacheRefresh func()) *Admin

New creates a new Admin handler

func (*Admin) Enabled

func (a *Admin) Enabled() bool

Enabled returns true if admin UI is enabled

func (*Admin) HandleCreateMCPServer

func (a *Admin) HandleCreateMCPServer(w http.ResponseWriter, r *http.Request)

HandleCreateMCPServer creates a new MCP server

func (*Admin) HandleDashboard

func (a *Admin) HandleDashboard(w http.ResponseWriter, r *http.Request)

HandleDashboard renders the dashboard page

func (*Admin) HandleDeleteMCPServer

func (a *Admin) HandleDeleteMCPServer(w http.ResponseWriter, r *http.Request)

HandleDeleteMCPServer deletes an MCP server

func (*Admin) HandleGetMCPServer

func (a *Admin) HandleGetMCPServer(w http.ResponseWriter, r *http.Request)

HandleGetMCPServer returns a single MCP server

func (*Admin) HandleGetMCPServerTools

func (a *Admin) HandleGetMCPServerTools(w http.ResponseWriter, r *http.Request)

HandleGetMCPServerTools returns tools for an MCP server

func (*Admin) HandleListMCPServers

func (a *Admin) HandleListMCPServers(w http.ResponseWriter, r *http.Request)

func (*Admin) HandleLogin

func (a *Admin) HandleLogin(w http.ResponseWriter, r *http.Request)

HandleLogin handles login requests

func (*Admin) HandleLoginPage

func (a *Admin) HandleLoginPage(w http.ResponseWriter, r *http.Request)

HandleLoginPage renders the login page

func (*Admin) HandleLogout

func (a *Admin) HandleLogout(w http.ResponseWriter, r *http.Request)

HandleLogout invalidates the session

func (*Admin) HandleMCPServersPage

func (a *Admin) HandleMCPServersPage(w http.ResponseWriter, r *http.Request)

HandleMCPServersPage renders the MCP servers page

func (*Admin) HandleMCPStorageStatus

func (a *Admin) HandleMCPStorageStatus(w http.ResponseWriter, r *http.Request)

HandleMCPStorageStatus returns whether MCP server storage is writable

func (*Admin) HandleModels

func (a *Admin) HandleModels(w http.ResponseWriter, r *http.Request)

HandleModels returns model information

func (*Admin) HandleModelsPage

func (a *Admin) HandleModelsPage(w http.ResponseWriter, r *http.Request)

HandleModelsPage renders the models page

func (*Admin) HandleOAuthCallback

func (a *Admin) HandleOAuthCallback(w http.ResponseWriter, r *http.Request)

HandleOAuthCallback handles the redirect back from the OAuth2 server. GET /admin/oauth/callback

func (*Admin) HandleOAuthStart

func (a *Admin) HandleOAuthStart(w http.ResponseWriter, r *http.Request)

HandleOAuthStart initiates the PKCE flow for a new OAuth2 MCP server. POST /admin/api/mcp-servers/oauth/start

func (*Admin) HandleProviders

func (a *Admin) HandleProviders(w http.ResponseWriter, r *http.Request)

HandleProviders returns provider information

func (*Admin) HandleRefreshMCPCache added in v0.1.5

func (a *Admin) HandleRefreshMCPCache(w http.ResponseWriter, r *http.Request)

HandleRefreshMCPCache refreshes the tool cache from all remote MCP servers

func (*Admin) HandleStats

func (a *Admin) HandleStats(w http.ResponseWriter, r *http.Request)

HandleStats returns dashboard statistics

func (*Admin) HandleToggleMCPServer

func (a *Admin) HandleToggleMCPServer(w http.ResponseWriter, r *http.Request)

HandleToggleMCPServer toggles an MCP server's enabled state

func (*Admin) HandleToggleMCPServerTool

func (a *Admin) HandleToggleMCPServerTool(w http.ResponseWriter, r *http.Request)

HandleToggleMCPServerTool toggles a tool's enabled state (lazy write)

func (*Admin) HandleUpdateMCPServer

func (a *Admin) HandleUpdateMCPServer(w http.ResponseWriter, r *http.Request)

HandleUpdateMCPServer updates an MCP server

func (*Admin) RegisterRoutes

func (a *Admin) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers admin routes on the given mux

func (*Admin) Serve404 added in v0.1.2

func (a *Admin) Serve404(w http.ResponseWriter, r *http.Request)

Serve404 renders the 404 page

type MCPServerInfo

type MCPServerInfo struct {
	Namespace      string   `json:"namespace"`
	URL            string   `json:"url"`
	AuthType       string   `json:"auth_type,omitempty"`
	Enabled        bool     `json:"enabled"`
	ToolVisibility string   `json:"tool_visibility"`
	ToolAllowlist  []string `json:"tool_allowlist,omitempty"`
	ToolDenylist   []string `json:"tool_denylist,omitempty"`
	StaticServer   bool     `json:"static_server"`
	RemoteSearch   bool     `json:"remote_search"`
}

MCPServerInfo represents MCP server information for the UI

type ModelInfo

type ModelInfo struct {
	ID        string   `json:"id"`
	Providers []string `json:"providers"`
}

ModelInfo represents a model and its providers for the UI

type ProviderInfo

type ProviderInfo struct {
	Name       string  `json:"name"`
	Type       string  `json:"type"`
	Healthy    bool    `json:"healthy"`
	ModelCount int     `json:"model_count"`
	Weight     float64 `json:"weight"`
}

ProviderInfo represents provider information for the UI

type Session

type Session struct {
	Token     string
	CreatedAt time.Time
}

Session represents an admin session

type Stats

type Stats struct {
	Providers      int `json:"providers"`
	Models         int `json:"models"`
	MCPServers     int `json:"mcp_servers"`
	ActiveRequests int `json:"active_requests"`
}

Stats represents dashboard statistics

type TemplateData

type TemplateData struct {
	CSSFile string
	JSFile  string
}

TemplateData contains data passed to templates

type TemplateRenderer

type TemplateRenderer struct {
	// contains filtered or unexported fields
}

TemplateRenderer handles HTML template rendering

func NewTemplateRenderer

func NewTemplateRenderer(fsys fs.FS) *TemplateRenderer

NewTemplateRenderer creates a new template renderer

func (*TemplateRenderer) Render

func (r *TemplateRenderer) Render(w io.Writer, name string, data *TemplateData) error

Render renders a template with the given data

type ToolInfo

type ToolInfo struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"input_schema"`
	Enabled     bool                   `json:"enabled"`
}

ToolInfo represents tool information for the UI

Jump to

Keyboard shortcuts

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