mcp

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultClientName is the default name for MCP client
	DefaultClientName = "gollem"
	// DefaultClientVersion is the default version for MCP client
	// Empty string means no specific version is advertised
	DefaultClientVersion = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the MCP client that allows to communicate with MCP server.

func NewSSE

func NewSSE(ctx context.Context, baseURL string, options ...SSEOption) (*Client, error)

NewSSE creates a new MCP client for remote MCP server via SSE.

func NewStdio

func NewStdio(ctx context.Context, path string, args []string, options ...StdioOption) (*Client, error)

NewStdio creates a new MCP client for local MCP executable server via stdio.

func NewStreamableHTTP

func NewStreamableHTTP(ctx context.Context, baseURL string, options ...StreamableHTTPOption) (*Client, error)

NewStreamableHTTP creates a new MCP client for remote MCP server via Streamable HTTP.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Run

func (c *Client) Run(ctx context.Context, name string, args map[string]any) (map[string]any, error)

Run implements gollem.ToolSet interface

func (*Client) Specs

func (c *Client) Specs(ctx context.Context) ([]gollem.ToolSpec, error)

Specs implements gollem.ToolSet interface

type SSEOption

type SSEOption func(*Client)

SSEOption is the option for the MCP client for remote MCP server via SSE.

func WithSSEClient

func WithSSEClient(client *http.Client) SSEOption

WithSSEClient sets the HTTP client for the MCP client.

func WithSSEClientInfo

func WithSSEClientInfo(name, version string) SSEOption

WithSSEClientInfo sets the client name and version for the MCP client.

func WithSSEHeaders

func WithSSEHeaders(headers map[string]string) SSEOption

WithSSEHeaders sets the headers for the MCP client. It replaces the existing headers setting.

type StdioOption

type StdioOption func(*Client)

StdioOption is the option for the MCP client for local MCP server via Stdio.

func WithEnvVars

func WithEnvVars(envVars []string) StdioOption

WithEnvVars sets the environment variables for the MCP client.

func WithStdioClientInfo

func WithStdioClientInfo(name, version string) StdioOption

WithStdioClientInfo sets the client name and version for the MCP client.

type StreamableHTTPOption

type StreamableHTTPOption func(*Client)

StreamableHTTPOption is the option for the MCP client for remote MCP server via Streamable HTTP.

func WithStreamableHTTPClient

func WithStreamableHTTPClient(client *http.Client) StreamableHTTPOption

WithStreamableHTTPClient sets the HTTP client for the MCP client.

func WithStreamableHTTPClientInfo

func WithStreamableHTTPClientInfo(name, version string) StreamableHTTPOption

WithStreamableHTTPClientInfo sets the client name and version for the MCP client.

func WithStreamableHTTPHeaders

func WithStreamableHTTPHeaders(headers map[string]string) StreamableHTTPOption

WithStreamableHTTPHeaders sets the headers for the MCP client. It replaces the existing headers setting.

Jump to

Keyboard shortcuts

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