mcp_dodder

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunServer

func RunServer(
	utility command.Utility,
	repo *local_working_copy.Repo,
	startupRepoId scoped_id.Id,
	userReposDir string,
	dodderVersion string,
) error

Types

type Bridge

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

func MakeBridge

func MakeBridge(
	utility command.Utility,
	defaultRepoId scoped_id.Id,
	pinned bool,
) Bridge

func (Bridge) RunCommand

func (b Bridge) RunCommand(
	ctx context.Context,
	cmdName string,
	cliArgs []string,
	maxBytes int,
) (BridgeResult, error)

RunCommand runs a command against the bridge's default repo (the server's startup repo). Use RunCommandWithRepoId to target a specific repo per call.

func (Bridge) RunCommandWithRepoId added in v0.2.6

func (b Bridge) RunCommandWithRepoId(
	ctx context.Context,
	cmdName string,
	cliArgs []string,
	maxBytes int,
	repoIdParam string,
) (BridgeResult, error)

RunCommandWithRepoId runs a command targeting the given repo (see resolveRepoId). An empty repoIdParam means the server's default repo.

func (Bridge) WithRepo added in v0.2.6

func (b Bridge) WithRepo(
	ctx context.Context,
	repoIdParam string,
	fn func(*local_working_copy.Repo) error,
) error

WithRepo builds a fresh local working copy for the repo addressed by repoIdParam (empty = the server's default repo), gated by the same pin/CheckSupported resolution as the tool path (resolveRepoId), and runs fn against it. It is the store-backed counterpart to RunCommandWithRepoId: the handlers that need a real *Repo rather than a CLI run — edit, reset-lock, and blob-format listing (FDR-0019 #278) — call this.

fn runs INSIDE the build's error context, exactly as RunCommandWithRepoId runs cmd.Run inside it. This is load-bearing: MakeLocalWorkingCopy registers the env's temp-dir cleanup (and the repo Flush) as After hooks on that context, so they must fire AFTER fn finishes — returning the repo for use after the context completed would tear its temp dirs down first, and a subsequent blob write would chmod into a removed directory.

A fresh repo is built per call, mirroring how RunCommandWithRepoId builds one per command run: no held-open cache, so no lock-holding or index staleness. The build duration is emitted as a statsd timer so the build-per-call cost is observable; if it ever dominates MCP latency, switch to a lazy per-repo cache (the FDR "MCP repo cache" lever).

type BridgeResult

type BridgeResult struct {
	Stdout    string
	Stderr    string
	Truncated bool
	BytesSeen int
}

type LimitingWriter

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

func MakeLimitingWriter

func MakeLimitingWriter(maxBytes int) *LimitingWriter

func (*LimitingWriter) BytesKept

func (w *LimitingWriter) BytesKept() int

func (*LimitingWriter) BytesSeen

func (w *LimitingWriter) BytesSeen() int

func (*LimitingWriter) Reset

func (w *LimitingWriter) Reset()

func (*LimitingWriter) String

func (w *LimitingWriter) String() string

func (*LimitingWriter) Truncated

func (w *LimitingWriter) Truncated() bool

func (*LimitingWriter) Write

func (w *LimitingWriter) Write(p []byte) (n int, err error)

func (*LimitingWriter) WriteString

func (w *LimitingWriter) WriteString(s string) (n int, err error)

Jump to

Keyboard shortcuts

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