mcp

package
v0.0.0-...-53bd38a Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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