mcpsnapshot

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package mcpsnapshot owns canonical MCP tool manifests and approval snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(alias string, target mcpexplore.Server, server *protocol.Implementation, tools []*protocol.Tool, capturedAt time.Time) (Snapshot, []Warning, error)

Build captures a stable tool manifest without retaining any credential values.

func CanonicalJSON

func CanonicalJSON(value any) ([]byte, error)

CanonicalJSON encodes a JSON value with lexical object-key order and no HTML escaping.

func Fingerprint

func Fingerprint(value any) (string, error)

Fingerprint returns the documented sha256:<hex> identity for canonical data.

func Path

func Path(alias string) (string, error)

Path returns the approval snapshot path without creating any directory.

func Save

func Save(snapshot Snapshot) error

Save replaces a valid snapshot atomically and leaves the last valid contents in .bak.

Types

type DiffChange

type DiffChange struct {
	Kind    string   `json:"kind"`
	Tool    string   `json:"tool,omitempty"`
	Paths   []string `json:"paths,omitempty"`
	Message string   `json:"message"`
}

DiffChange is one user-visible approval drift class.

func Diff

func Diff(approved, current Snapshot) ([]DiffChange, error)

Diff compares a current snapshot candidate with its approved predecessor.

type Snapshot

type Snapshot struct {
	Version             int               `json:"version"`
	Alias               string            `json:"alias"`
	CapturedAt          time.Time         `json:"captured_at"`
	TargetFingerprint   string            `json:"target_fingerprint"`
	ManifestFingerprint string            `json:"manifest_fingerprint"`
	Server              json.RawMessage   `json:"server"`
	Tools               []json.RawMessage `json:"tools"`
}

Snapshot is the versioned approved description of one named server.

func Load

func Load(alias string) (Snapshot, bool, error)

Load reads one validated approval snapshot. exists is false only when absent.

func (Snapshot) Validate

func (snapshot Snapshot) Validate() error

Validate rejects malformed, stale, or internally inconsistent snapshot files.

type Warning

type Warning struct {
	Code    string `json:"code"`
	Path    string `json:"path"`
	Message string `json:"message"`
}

Warning identifies advisory, unmodified untrusted server metadata.

func LintImplementation

func LintImplementation(server *protocol.Implementation, base string) []Warning

LintImplementation examines self-reported server identity without changing it.

func LintTool

func LintTool(tool *protocol.Tool, base string) []Warning

LintTool examines copied metadata without changing it.

Jump to

Keyboard shortcuts

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