mcp

package
v1.1.57 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseClients

func CloseClients(clients []*Client)

func RawIDKey

func RawIDKey(id json.RawMessage) string

func SanitizeToolName

func SanitizeToolName(name string) string

Types

type Callbacks

type Callbacks struct {
	OnNotification          func(serverName, method string, params json.RawMessage)
	OnSamplingCreateMessage func(ctx context.Context, serverName string, params json.RawMessage) (json.RawMessage, *RPCError)
}

type Client

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

func ConnectServers

func ConnectServers(ctx context.Context, configs []ServerConfig, registry *tools.Registry, callbacks Callbacks) ([]*Client, error)

func (*Client) Close

func (c *Client) Close()

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

type RPCRequest

type RPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   json.RawMessage `json:"error,omitempty"`
}

type ServerConfig

type ServerConfig = config.MCPServer

func LoadConfiguredServers

func LoadConfiguredServers(cwd string) ([]ServerConfig, error)

LoadConfiguredServers loads usable MCP servers from global and project mcp.json. Missing config files are ignored. Obvious template placeholders are skipped so creating a starter config does not break normal startup.

Jump to

Keyboard shortcuts

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