mcp

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenStore added in v1.3.1

func GetTokenStore(url string) client.TokenStore

GetTokenStore returns the tokenStore instance for the given URL

Types

type BaseMessage

type BaseMessage struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      *int64          `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error,omitempty"`
}

type Client

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

Client implements an MCP client for interacting with MCP servers

func NewRemoteClient

func NewRemoteClient(url, transportType string, headers map[string]string, redirectURI string, tokenStore client.TokenStore) (*Client, error)

NewRemoteClient creates a new MCP client that can connect to a remote MCP server

func NewStdioClient

func NewStdioClient(command string, args, env []string) *Client

NewStdioClient creates a new MCP client that can start an stdio MCP server

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, toolCall tools.ToolCall) (*tools.ToolCallResult, error)

CallTool calls a tool on the MCP server

func (*Client) CallToolWithArgs

func (c *Client) CallToolWithArgs(ctx context.Context, toolName string, args any) (*tools.ToolCallResult, error)

CallToolWithArgs is a convenience method to call a tool with arguments

func (*Client) GetServerInfo added in v1.3.1

func (c *Client) GetServerInfo() (serverURL, serverType string)

GetServerInfo returns server identification information

func (*Client) GetToolByName

func (c *Client) GetToolByName(name string) (tools.Tool, error)

GetToolByName returns a tool by name

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context, toolFilter []string) ([]tools.Tool, error)

ListTools fetches available tools from the MCP server

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Start initializes and starts the MCP server connection

func (*Client) Stop

func (c *Client) Stop() error

Stop stops the MCP server

type GatewayToolset added in v1.0.7

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

func NewGatewayToolset added in v1.0.7

func NewGatewayToolset(mcpServerName string, config any, toolFilter []string, envProvider environment.Provider) *GatewayToolset

func (*GatewayToolset) Instructions added in v1.0.7

func (t *GatewayToolset) Instructions() string

func (*GatewayToolset) Start added in v1.0.7

func (t *GatewayToolset) Start(ctx context.Context) error

func (*GatewayToolset) Stop added in v1.0.7

func (t *GatewayToolset) Stop() error

func (*GatewayToolset) Tools added in v1.0.7

func (t *GatewayToolset) Tools(ctx context.Context) ([]tools.Tool, error)

type RPCResponse

type RPCResponse struct {
	Error    *string
	Response *json.RawMessage
}

type TokenManager added in v1.3.1

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

TokenManager manages token stores per URL

func (*TokenManager) GetTokenStoreForServer added in v1.3.1

func (m *TokenManager) GetTokenStoreForServer(url string) client.TokenStore

GetTokenStoreForServer returns a token store for the given URL, creating it if necessary

type Toolset

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

Toolset represents a set of MCP tools

func NewToolsetCommand

func NewToolsetCommand(command string, args, env, toolFilter []string) *Toolset

NewToolsetCommand creates a new MCP toolset from a command.

func NewToolsetRemote

func NewToolsetRemote(url, transport string, headers map[string]string, toolFilter []string, redirectURI string) (*Toolset, error)

NewToolsetRemote creates a new MCP toolset from a remote MCP Server.

func (*Toolset) GetServerInfo added in v1.3.1

func (t *Toolset) GetServerInfo() (serverURL, serverType string)

GetServerInfo returns server identification information

func (*Toolset) Instructions

func (t *Toolset) Instructions() string

Instructions returns the toolset instructions

func (*Toolset) Start

func (t *Toolset) Start(ctx context.Context) error

Start starts the toolset

func (*Toolset) Stop

func (t *Toolset) Stop() error

Stop stops the toolset

func (*Toolset) Tools

func (t *Toolset) Tools(ctx context.Context) ([]tools.Tool, error)

Tools returns the available tools

Jump to

Keyboard shortcuts

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