Documentation
¶
Overview ¶
Package mcp parses MCP JSON-RPC 2.0 requests and responses from plain values. It computes no cost and does not use the plugin engine (#1503). The mcp-parser plugin is a thin wrapper over it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRequest ¶
func ParseRequest(method, path string, headers http.Header, rawBody []byte, paths *bypass.Matcher) *model.MCPExtension
ParseRequest parses one MCP request from plain values. It returns nil when the parser does not claim the request. paths is the matcher of the MCP endpoint paths for body-less requests. A nil paths matches no path.
func ParseResponse ¶
func ParseResponse(body []byte, ext *model.MCPExtension) bool
ParseResponse reads one MCP response into ext: a plain JSON-RPC response, or an SSE body or frame (MCP's Streamable HTTP transport). For SSE, the first data: line carrying a result or error wins. It sets ext.Err for an error and ext.Result for a result. It returns false, and changes nothing, when body holds no JSON-RPC result or error. JSON-RPC gives a request one response, so a caller that folds frames stops after the first true.
Types ¶
This section is empty.