Documentation
¶
Overview ¶
Package mcp provides a lightweight MCP protocol client for reconnaissance. It handles the initialize handshake, SSE response parsing, and session ID threading required by the MCP 2025-03-26 specification.
Index ¶
- type Client
- func (c *Client) Initialize(ctx context.Context) (*Session, error)
- func (c *Client) ListPrompts(ctx context.Context, s *Session) ([]Prompt, error)
- func (c *Client) ListResources(ctx context.Context, s *Session) ([]Resource, error)
- func (c *Client) ListTools(ctx context.Context, s *Session) ([]Tool, error)
- type ClientOption
- type Prompt
- type PromptArgument
- type Resource
- type ServerInfo
- type Session
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a lightweight MCP protocol client for use by the probe command.
func NewClient ¶
func NewClient(baseURL string, opts ...ClientOption) (*Client, error)
NewClient creates a new MCP client for the given base URL.
func (*Client) Initialize ¶
Initialize performs the MCP initialize handshake and returns a Session. It tries candidate endpoint paths until one succeeds.
func (*Client) ListPrompts ¶
ListPrompts calls prompts/list and returns all available prompt templates.
func (*Client) ListResources ¶
ListResources calls resources/list and returns all available resources.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures a Client.
func WithBearerToken ¶
func WithBearerToken(token string) ClientOption
WithBearerToken attaches an Authorization: Bearer header to every request.
func WithSkipTLSVerify ¶
func WithSkipTLSVerify() ClientOption
WithSkipTLSVerify disables TLS certificate verification.
func WithTimeout ¶
func WithTimeout(d time.Duration) ClientOption
WithTimeout sets the HTTP request timeout.
type Prompt ¶
type Prompt struct {
Name string
Description string
Arguments []PromptArgument
}
Prompt is a reusable prompt template exposed by an MCP server.
type PromptArgument ¶
PromptArgument is a named parameter for a prompt template.
type ServerInfo ¶
ServerInfo holds the identifying fields from the server's initialize response.
type Session ¶
type Session struct {
Endpoint string
SessionID string
ProtocolVersion string
ServerInfo ServerInfo
Capabilities map[string]interface{}
}
Session represents an active MCP connection after the initialize handshake.
func (*Session) HasCapability ¶
HasCapability returns true if the session's capability map includes the key.