mcpserver

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mcpserver exposes an opened Sentra repository as a Model Context Protocol server, so outside agents (Claude, editors, anything speaking MCP) can query snapshots and drive confirm-gated operations within the same guardrails the CLI and TUI enforce.

Two rules shape every tool here (see the spec in docs/superpowers/specs/2026-08-28-mcp-server-design.md):

  • Metadata only, never contents. Tools return names, sizes, times, ids, and stats. Nothing reads file bodies out of snapshots, so a malicious or curious client cannot exfiltrate backed-up data through this surface.

  • Mutations are two-phase. MCP has no interactive prompt, so the confirm gate becomes protocol: plan_* validates and returns a single-use token bound to that exact plan; confirm_* executes it. Tokens expire (tokenTTL) and die on first use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.5.0

type Options struct {
	// Version is reported to MCP clients in the server's implementation
	// info.
	Version string

	// Walker is the directory-walk configuration every confirmed backup
	// runs with. The Server never sees sentra.yaml, so the CLI resolves
	// backup.ignore_file / exclude_caches / concurrency into this exactly
	// as `sentra backup` does; leaving it zero means MCP-driven backups
	// silently fall back to the repo's legacy defaults (.sentraignore,
	// caches excluded) and diverge from what the operator configured.
	Walker walker.Options
}

Options configures a Server beyond the repository it serves.

type Server

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

Server wraps an opened repository with the MCP tool set. now is a seam for the token-expiry tests.

func New

func New(r *repo.Repo, opts Options) *Server

New builds a Server over an already-opened repository. The caller owns the repo's lifecycle; Run does not close it.

func (*Server) Run

func (s *Server) Run(ctx context.Context, t mcp.Transport) error

Run serves MCP over the given transport until ctx ends or the client disconnects. Production passes &mcp.StdioTransport{}; tests use the in-memory pair.

Jump to

Keyboard shortcuts

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