Documentation
¶
Overview ¶
Package mcpcredential provides the small, root-pinned custody seam used by local MCP onboarding. It deliberately contains no OAuth or client policy.
Index ¶
Constants ¶
const ( BackendKeyring = "keyring" // BackendKeyring stores the generated key in the OS keyring. BackendFile = "file" // BackendFile stores the generated key in a protected file. // NativeNamespace is the credential-store namespace reserved for native MCP // custody. It is deliberately distinct from the legacy key_env namespace. NativeNamespace = "mecatl-mcp-oauth-native/v1" // #nosec G101 -- public namespace discriminator, not a credential. )
BackendKeyring stores generated keys in the OS keyring; BackendFile uses a protected file.
Variables ¶
var ( // ErrObsoleteMarker identifies the prototype marker format handled by reset. ErrObsoleteMarker = errors.New("MCP credential marker uses an obsolete format") // ErrPendingArtifactMismatch identifies an artifact that does not match its pending marker. ErrPendingArtifactMismatch = errors.New("MCP credential artifact identity does not match pending marker") // ErrArtifactMissing identifies a missing artifact pinned by custody metadata. ErrArtifactMissing = errors.New("MCP credential artifact is missing") // ErrArtifactMismatch identifies a valid artifact whose identity differs from its marker. ErrArtifactMismatch = errors.New("MCP credential artifact identity does not match marker") // ErrResetInProgress identifies custody that only Reset may resume. ErrResetInProgress = errors.New("MCP credential custody reset is in progress") )
Functions ¶
func CanonicalFileKeyPath ¶ added in v0.0.49
CanonicalFileKeyPath returns the physical path pinned by native file custody. The host lifecycle command uses it to detect profiles that share a key.
Types ¶
type ConfirmFile ¶
ConfirmFile confirms the attended fallback to file custody.
type Keyring ¶
type Keyring interface {
Get(string, string) (string, error)
Set(string, string, string) error
Delete(string, string) error
}
Keyring reads and writes the OS credential entry used by MCP custody.
type MarkerInspection ¶
type MarkerInspection string
MarkerInspection is the bounded, non-secret result of inspecting custody metadata.
const ( // MarkerMissing means the custody marker does not exist. MarkerMissing MarkerInspection = "missing" MarkerUnavailable MarkerInspection = "unavailable" // MarkerLocked means the custody root is locked. MarkerLocked MarkerInspection = "locked" // MarkerRecovery means the marker requires recovery. MarkerRecovery MarkerInspection = "recovery required" // MarkerPresent means the custody marker is valid. MarkerPresent MarkerInspection = "present" )
func InspectMarker ¶
func InspectMarker(root string) MarkerInspection
InspectMarker checks only the root-pinned custody marker. It never opens a keyring, reads a credential, or returns marker contents. The result is safe for status/list projections.
type Options ¶
type Options struct {
Requested, FilePath, Platform string
Detect Detector
ConfirmFile ConfirmFile
Attended bool
Keyring Keyring
}
Options controls MCP credential custody selection.
type ResetResult ¶ added in v0.0.49
type ResetResult struct {
ArtifactPreserved bool
}
ResetResult reports custody that reset deliberately left untouched.
func ResetWithResult ¶ added in v0.0.49
func ResetWithResult(ctx context.Context, root, backend, filePath string, keyring Keyring, preserveArtifact bool) (ResetResult, error)
ResetWithResult retires the native custody for root. preserveArtifact is set when the host has found another configured root using the same file key path. A mismatched artifact is never deleted; the resetting marker records that decision so retries preserve it too.