Documentation
¶
Overview ¶
Package transport defines the Transport interface used by the orchestrator and provides stdio and HTTP/SSE implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP is an HTTP/SSE-based JSON-RPC transport.
type HTTPConfig ¶
type HTTPConfig struct {
URL string
Headers map[string]string
// Client overrides the default http.Client. Optional.
Client *http.Client
// AllowSSE enables parsing of text/event-stream responses. When the
// server sends SSE, the transport collates all `data:` events into a
// single JSON-RPC response (the last well-formed frame wins).
AllowSSE bool
}
HTTPConfig configures the HTTP/SSE transport.
type Kind ¶
type Kind string
Kind enumerates the transport varieties mcpbench can open.
Known transport kinds.
type Stdio ¶
type Stdio struct {
// contains filtered or unexported fields
}
Stdio is a subprocess-backed JSON-RPC transport speaking newline-delimited frames.
func StartStdio ¶
func StartStdio(ctx context.Context, cfg StdioConfig) (*Stdio, error)
StartStdio launches the subprocess and returns a ready Stdio transport.
type StdioConfig ¶
type StdioConfig struct {
// Cmd is the binary to execute.
Cmd string
// Args are the arguments passed to the subprocess.
Args []string
// Env holds additional environment variables (merged with os.Environ).
Env map[string]string
// Silent, when true, discards the subprocess stderr instead of forwarding.
Silent bool
// ShutdownGrace is the time allowed between SIGTERM and SIGKILL during
// Close. Defaults to 5 seconds when zero.
ShutdownGrace time.Duration
// MaxLineBytes overrides the bufio.Scanner buffer size. Defaults to 16
// MiB. Oversized responses are reported as transport errors.
MaxLineBytes int
}
StdioConfig holds subprocess launch parameters.
type Transport ¶
type Transport interface {
// Call issues a single JSON-RPC request and returns the raw response
// bytes. Timeouts and cancellation are honored via ctx.
Call(ctx context.Context, method string, params any) (json []byte, err error)
// Close releases resources (kills subprocess, closes HTTP connections).
Close() error
}
Transport is the wire-level abstraction for an MCP server connection. Implementations must be safe for concurrent Call invocation.