Documentation
¶
Overview ¶
Package mcphttp contains remote Streamable HTTP and legacy SSE MCP clients.
The core mcp package only speaks stdio; this adapts an HTTP/JSON-RPC MCP server to the same tool.CoreTool shape (mcp__server__tool) WITHOUT touching the SDK. It implements the MCP "Streamable HTTP" transport: JSON-RPC over HTTP POST, with the server free to answer either as application/json or a text/event-stream (SSE) carrying the response. Custom headers (e.g. Authorization) come from the MCP row's env map, so a bearer token is configured as {"Authorization":"Bearer …"}.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to one remote MCP server. New uses Streamable HTTP; NewSSE uses the legacy GET /sse + POST /message transport.
func New ¶
func New(ctx context.Context, server, url string, headers map[string]string, insecure bool) (*Client, error)
New connects to a remote MCP endpoint and performs the initialize handshake. headers are sent on every request (Authorization, custom API keys, …). When insecure is true, TLS certificate verification is skipped so servers that present a self-signed certificate can still be reached (issue #108).
func NewSSE ¶
func NewSSE(ctx context.Context, server, sseURL string, headers map[string]string, insecure bool) (*Client, error)
NewSSE connects to the legacy MCP SSE transport: a long-lived GET /sse announces a per-session POST /message endpoint, while JSON-RPC responses are delivered asynchronously as SSE message events.
func (*Client) Call ¶
Call invokes one tool and returns the concatenated text of its content blocks (ScopeSentry answers with a single JSON text block). Unlike the CoreTool wrapper from Tools(), this bypasses the agent permission (AskUser) layer — it is meant for backend batch jobs (e.g. asset sync) that call MCP tools programmatically.