mcp

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 15 Imported by: ? modules, 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

Index

Constants

View Source
const (
	ErrMCPInitializeFailed    greet.ErrorCode = "mcp_initialize_failed"
	ErrMCPUnexpectedStatus    greet.ErrorCode = "mcp_unexpected_status"
	ErrMCPMissingSession      greet.ErrorCode = "mcp_missing_session"
	ErrMCPAuthFailed          greet.ErrorCode = "mcp_auth_failed"
	ErrMCPUnsupportedOAuth    greet.ErrorCode = "mcp_unsupported_oauth"
	ErrMCPListResourcesFailed greet.ErrorCode = "mcp_list_resources_failed"
	ErrMCPListToolsFailed     greet.ErrorCode = "mcp_list_tools_failed"
	ErrMCPListPromptsFailed   greet.ErrorCode = "mcp_list_prompts_failed"
	ErrMCPListTemplatesFailed greet.ErrorCode = "mcp_list_templates_failed"
)

MCP-specific error codes.

View Source
const DefaultMCPPort = 443

DefaultMCPPort is the well-known HTTPS port for the MCP streamable transport.

View Source
const ProtocolName = "mcp"

ProtocolName is the registered name for the MCP application layer.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCP

type MCP struct{}

MCP implements an MCP streamable HTTP application-layer probe.

func New

func New() *MCP

New creates a new MCP application layer.

func (*MCP) BaseTransport

func (m *MCP) BaseTransport() greet.Transport

func (*MCP) DefaultPort

func (m *MCP) DefaultPort() int

func (*MCP) Description

func (m *MCP) Description() string

func (*MCP) Handshake

func (m *MCP) Handshake(ctx context.Context, start time.Time, conn net.Conn, host string, port int, cfg *greet.GreetConfig) (net.Conn, greet.LayerData, greet.LayerTiming, error)

Handshake performs the MCP initialize handshake and optional list probes over the supplied TLS connection.

func (*MCP) Name

func (m *MCP) Name() string

type MCPConfig

type MCPConfig struct {
	// ClientInfo is sent in the initialize request.
	ClientInfo mcp.Implementation
	// Path is the request path for MCP streamable HTTP requests (e.g. "/mcp").
	// Defaults to "/" when empty.
	Path string
	// BearerToken is an optional OAuth 2.0 Bearer token sent in the
	// Authorization header on every request. When a server returns
	// 401 with a Bearer WWW-Authenticate challenge, greet probes the
	// resource metadata well-known endpoint for diagnostic information.
	BearerToken string
	// ListResources also runs resources/list after the handshake.
	ListResources bool
	// ListTools also runs tools/list after the handshake.
	ListTools bool
	// ListPrompts also runs prompts/list after the handshake.
	ListPrompts bool
	// ListResourceTemplates also runs resources/templates/list after the handshake.
	ListResourceTemplates bool
}

MCPConfig holds protocol-specific configuration for an MCP probe.

func (*MCPConfig) LayerConfigName

func (c *MCPConfig) LayerConfigName() string

LayerConfigName returns the layer name for config lookup.

type MCPResult

type MCPResult struct {
	ProtocolVersion   string                  `json:"protocolVersion"`
	ServerInfo        *mcp.Implementation     `json:"serverInfo,omitempty"`
	Capabilities      *mcp.ServerCapabilities `json:"capabilities,omitempty"`
	Resources         []*ResourceInfo         `json:"resources,omitempty"`
	ResourceTemplates []*ResourceTemplateInfo `json:"resourceTemplates,omitempty"`
	Tools             []*ToolInfo             `json:"tools,omitempty"`
	Prompts           []*PromptInfo           `json:"prompts,omitempty"`
}

MCPResult holds the outcome of an MCP handshake and optional list probes.

func (*MCPResult) LayerDataName

func (r *MCPResult) LayerDataName() string

LayerDataName returns the layer name for result aggregation.

type PromptInfo

type PromptInfo struct {
	Name string `json:"name"`
}

PromptInfo is a compact view of an MCP prompt.

type ResourceInfo

type ResourceInfo struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

ResourceInfo is a compact view of an MCP resource.

type ResourceTemplateInfo

type ResourceTemplateInfo struct {
	Name        string `json:"name"`
	URITemplate string `json:"uriTemplate"`
}

ResourceTemplateInfo is a compact view of an MCP resource template.

type ToolInfo

type ToolInfo struct {
	Name string `json:"name"`
}

ToolInfo is a compact view of an MCP tool.

Jump to

Keyboard shortcuts

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