mcp

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMCPCmd

func NewMCPCmd(globalFlags *flags.GlobalFlags) *cobra.Command

NewMCPCmd builds the 'devsy mcp' parent command.

func NewServeCmd

func NewServeCmd(globalFlags *flags.GlobalFlags) *cobra.Command

NewServeCmd builds the `serve` subcommand.

Types

type BoundedBuffer

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

BoundedBuffer is an io.Writer that keeps only the last cap bytes written. Tail retention beats mid-truncation for command output because endings carry exit status, errors, and final state.

func NewBoundedBuffer

func NewBoundedBuffer(cap int) *BoundedBuffer

NewBoundedBuffer returns a BoundedBuffer with the given capacity (minimum 64).

func (*BoundedBuffer) BytesWritten

func (b *BoundedBuffer) BytesWritten() int64

BytesWritten returns the total number of bytes written, including dropped ones.

func (*BoundedBuffer) String

func (b *BoundedBuffer) String() string

String returns the buffered content. When truncated, a marker showing how many bytes were dropped is prepended so callers know output is incomplete.

func (*BoundedBuffer) Truncated

func (b *BoundedBuffer) Truncated() bool

Truncated reports whether more bytes were written than the buffer can hold.

func (*BoundedBuffer) Write

func (b *BoundedBuffer) Write(p []byte) (int, error)

type ErrorPayload

type ErrorPayload struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Hint    string `json:"hint,omitempty"`
	DocURL  string `json:"doc_url,omitempty"`
}

ErrorPayload is the JSON shape attached to MCP tool errors so the agent gets the same structured information the Devsy CLI shows humans (code, hint, doc URL).

func ClassifyError

func ClassifyError(err error) ErrorPayload

ClassifyError converts any error returned by an MCP handler into a structured payload using the same classifier the CLI uses.

type ServeCmd

type ServeCmd struct {
	*flags.GlobalFlags

	ExecTimeoutDefault time.Duration
	ExecTimeoutMax     time.Duration
	ExecOutputCap      int
}

ServeCmd holds configuration for `devsy mcp serve`.

func (*ServeCmd) Run

func (cmd *ServeCmd) Run(ctx context.Context) error

Run wires up the MCP server and serves over stdio until ctx is cancelled.

Jump to

Keyboard shortcuts

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