Documentation
¶
Index ¶
- Constants
- func LaunchdPlistPath(home string) string
- func RemoveLaunchdPlist(path string) error
- func SlugFromServer(server string) (string, error)
- func UniqueSlug(base string, taken func(string) bool) string
- func WriteLaunchdPlist(path, binary string, env map[string]string) error
- type AddProfileRequest
- type Control
- type Daemon
- func (d *Daemon) AddProfile(ctx context.Context, req AddProfileRequest) (Profile, string, error)
- func (d *Daemon) ClientConfig(id string) (Profile, string, error)
- func (d *Daemon) DeleteProfile(id string, purge bool) error
- func (d *Daemon) LogTail(n int) []string
- func (d *Daemon) RestartProfile(ctx context.Context, id string) error
- func (d *Daemon) Run(ctx context.Context) error
- func (d *Daemon) SetStartupAtLogin(v bool)
- func (d *Daemon) Status() Status
- type FileSecretStore
- type Hooks
- type LogBuffer
- type Material
- type Profile
- type ProfileStatus
- type Route
- type Router
- type SecretStore
- type Status
- type Store
Constants ¶
const ( // ProtocolVersion is the management API version shared by the daemon and the Dock app. ProtocolVersion = 1 // LocalTokenHeader is the per-profile loopback credential. It is never forwarded upstream. LocalTokenHeader = "X-MCP-Runtime-Local-Token" // #nosec G101 -- HTTP header name; no credential value is embedded. // DefaultListenAddr is the single loopback listener shared by every profile path. DefaultListenAddr = "127.0.0.1:8099" )
const ( AuthEnrolled = "enrolled" AuthSignInRequired = "sign_in_required" AuthRenewalFailed = "renewal_failed" AuthNotEnrolled = "not_enrolled" )
Variables ¶
This section is empty.
Functions ¶
func LaunchdPlistPath ¶
LaunchdPlistPath is the per-user LaunchAgent path.
func RemoveLaunchdPlist ¶
RemoveLaunchdPlist deletes the managed plist.
func SlugFromServer ¶
SlugFromServer builds a URL path segment from a server name.
func UniqueSlug ¶
UniqueSlug returns slug, or slug-2, slug-3, when taken.
Types ¶
type AddProfileRequest ¶
type AddProfileRequest struct {
Server string `json:"server"`
Namespace string `json:"namespace,omitempty"`
Team string `json:"team,omitempty"`
Agent string `json:"agent,omitempty"`
PlatformURL string `json:"platformUrl,omitempty"`
RuntimeURL string `json:"runtimeUrl"`
}
AddProfileRequest creates one profile. LocalToken is returned once.
type Daemon ¶
type Daemon struct {
ListenAddr string
StateDir string
SocketPath string
Store *Store
Secrets SecretStore
Hooks Hooks
Router *Router
Logs *LogBuffer
// contains filtered or unexported fields
}
Daemon supervises one loopback listener and many profile paths.
func (*Daemon) AddProfile ¶
func (*Daemon) ClientConfig ¶
ClientConfig returns one profile's local endpoint and credential for the same-user CLI to write to an owner-only MCP client configuration file.
func (*Daemon) RestartProfile ¶
func (*Daemon) SetStartupAtLogin ¶
type FileSecretStore ¶
type FileSecretStore struct {
// contains filtered or unexported fields
}
FileSecretStore is an owner-only JSON file. Tests and non-Keychain hosts use it.
func NewFileSecretStore ¶
func NewFileSecretStore(path string) *FileSecretStore
func (*FileSecretStore) Delete ¶
func (s *FileSecretStore) Delete(account string) error
func (*FileSecretStore) Put ¶
func (s *FileSecretStore) Put(account, secret string) error
type LogBuffer ¶
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer keeps a bounded list of redacted lines.
func NewLogBuffer ¶
type Material ¶
type Material struct {
CertPEM []byte
KeyPEM []byte
CA []byte
Expires time.Time
PlatformURL string
Human string
Team string
Session string
SessionExpires time.Time
TrustDomain string
Namespace string
OAuthRequired *bool
}
Material is certificate PEM stored for one profile.
type Profile ¶
type Profile struct {
ID string `json:"id"`
Slug string `json:"slug"`
Server string `json:"server"`
Namespace string `json:"namespace,omitempty"`
Team string `json:"team,omitempty"`
Agent string `json:"agent,omitempty"`
PlatformURL string `json:"platformUrl,omitempty"`
RuntimeURL string `json:"runtimeUrl"`
Human string `json:"human,omitempty"`
Session string `json:"session,omitempty"`
SessionExpires time.Time `json:"sessionExpires,omitempty"`
TrustDomain string `json:"trustDomain,omitempty"`
CreatedAt time.Time `json:"createdAt"`
CertExpires time.Time `json:"certExpires,omitempty"`
AuthState string `json:"authState"`
OAuthRequired *bool `json:"oauthRequired,omitempty"`
LastError string `json:"lastError,omitempty"`
RenewalError string `json:"renewalError,omitempty"`
}
Profile is one saved connection to one MCP server.
type ProfileStatus ¶
type ProfileStatus struct {
ID string `json:"id"`
Slug string `json:"slug"`
Server string `json:"server"`
Team string `json:"team,omitempty"`
Human string `json:"human,omitempty"`
Agent string `json:"agent,omitempty"`
PlatformURL string `json:"platformUrl,omitempty"`
RuntimeURL string `json:"runtimeUrl,omitempty"`
Namespace string `json:"namespace,omitempty"`
LocalURL string `json:"localUrl"`
UpstreamReachable *bool `json:"upstreamReachable"`
UpstreamCheckedAt time.Time `json:"upstreamCheckedAt,omitempty"`
AuthState string `json:"authState"`
OAuthRequired *bool `json:"oauthRequired,omitempty"`
CertExpires *time.Time `json:"certExpires,omitempty"`
SessionExpires *time.Time `json:"sessionExpires,omitempty"`
CertNotBefore *time.Time `json:"certNotBefore,omitempty"`
CertSPIFFE string `json:"certSpiffe,omitempty"`
RenewalError string `json:"renewalError,omitempty"`
LastError string `json:"lastError,omitempty"`
}
ProfileStatus separates local readiness from upstream and enrollment state.
type Route ¶
type Route struct {
Profile Profile
Token string
Handler http.Handler
// UpstreamReachable is the last connectivity probe, distinct from local readiness.
UpstreamReachable *bool
UpstreamCheckedAt time.Time
}
Route is one profile mounted at /<slug>/mcp.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router serves every profile on one listener and rejects unknown paths.
type SecretStore ¶
type SecretStore interface {
Put(account, secret string) error
Get(account string) (string, error)
Delete(account string) error
}
SecretStore keeps per-profile credentials out of the profile catalog.
func NewKeychainStore ¶
func NewKeychainStore() SecretStore
NewKeychainStore is unavailable off macOS. Callers use FileSecretStore.
type Status ¶
type Status struct {
Protocol int `json:"protocol"`
ProcessRunning bool `json:"processRunning"`
ListenAddr string `json:"listenAddr"`
ListenerReady bool `json:"listenerReady"`
CheckedAt time.Time `json:"checkedAt"`
StartupAtLogin bool `json:"startupAtLogin"`
Profiles []ProfileStatus `json:"profiles"`
}
Status is the machine-readable daemon snapshot.