Documentation
¶
Overview ¶
Package transport contains implementatations for different transport options for MCP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTP ¶ added in v0.0.2
type HTTP struct {
// contains filtered or unexported fields
}
HTTP implements the Transport interface by communicating with a MCP server over HTTP using JSON-RPC.
func NewHTTP ¶
NewHTTP creates a new Http transport that will execute the given command. It communicates with the command using JSON-RPC over HTTP. Currently Http transport is implements MCP's Final draft version 2024-11-05, https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse
type Request ¶ added in v0.0.2
type Request struct {
Params any `json:"params,omitempty"`
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
ID int `json:"id,omitempty"`
}
Request represents a JSON-RPC 2.0 request.
type Response ¶ added in v0.0.2
type Response struct {
Result map[string]any `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
JSONRPC string `json:"jsonrpc"`
ID int `json:"id"`
}
Response represents a JSON-RPC 2.0 response.
type Stdio ¶ added in v0.0.2
type Stdio struct {
// contains filtered or unexported fields
}
Stdio implements the Transport interface by executing a command and communicating with it via stdin/stdout using JSON-RPC.
func NewStdio ¶
NewStdio creates a new Stdio transport that will execute the given command. It communicates with the command using JSON-RPC over stdin/stdout.
func (*Stdio) Execute ¶ added in v0.0.2
Execute implements the Transport interface by spawning a subprocess and communicating with it via JSON-RPC over stdin/stdout.
func (*Stdio) SetCloseAfterExecute ¶ added in v0.5.1
SetCloseAfterExecute toggles whether the underlying process should be closed or kept alive after each call to Execute.
func (*Stdio) SetShowServerLogs ¶ added in v0.6.1
SetShowServerLogs toggles whether to print server logs.