mcp

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

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

func (c *Client) Initialize(ctx context.Context) (*Session, error)

Initialize performs the MCP initialize handshake and returns a Session. It tries candidate endpoint paths until one succeeds.

func (*Client) ListPrompts

func (c *Client) ListPrompts(ctx context.Context, s *Session) ([]Prompt, error)

ListPrompts calls prompts/list and returns all available prompt templates.

func (*Client) ListResources

func (c *Client) ListResources(ctx context.Context, s *Session) ([]Resource, error)

ListResources calls resources/list and returns all available resources.

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context, s *Session) ([]Tool, error)

ListTools calls tools/list and returns all available tools.

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

type PromptArgument struct {
	Name     string
	Required bool
}

PromptArgument is a named parameter for a prompt template.

type Resource

type Resource struct {
	URI         string
	Name        string
	MimeType    string
	Description string
}

Resource is a data source exposed by an MCP server.

type ServerInfo

type ServerInfo struct {
	Name    string
	Version string
	Title   string
}

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

func (s *Session) HasCapability(key string) bool

HasCapability returns true if the session's capability map includes the key.

type Tool

type Tool struct {
	Name        string
	Description string
	InputSchema map[string]interface{}
}

Tool is a callable function exposed by an MCP server.

Jump to

Keyboard shortcuts

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