mcp

package
v0.20260522.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TransportStdio          = "stdio"
	TransportStreamableHTTP = "streamable-http"
)

Variables

This section is empty.

Functions

func ConfiguredServerCount

func ConfiguredServerCount() (int, error)

func ExposedToolName

func ExposedToolName(serverName, toolName string) string

func UniqueToolName

func UniqueToolName(base string, used map[string]bool) string

Types

type Config

type Config struct {
	Servers []ServerConfig
	Path    string
}

func LoadConfig

func LoadConfig() (*Config, error)

func ParseConfig

func ParseConfig(raw []byte) (*Config, error)

type Manager

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

func NewManager

func NewManager(ctx context.Context, cfg *Config, stderr io.Writer) *Manager

func NewManagerWithRemoteTools

func NewManagerWithRemoteTools(tools []RemoteTool) *Manager

func Start

func Start(ctx context.Context, stderr io.Writer) (*Manager, error)

func (*Manager) CallTool

func (m *Manager) CallTool(ctx context.Context, name string, raw json.RawMessage) (any, error)

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) HasTool

func (m *Manager) HasTool(name string) bool

func (*Manager) OpenAITools

func (m *Manager) OpenAITools() []openai.ChatCompletionToolUnionParam

func (*Manager) ToolDump

func (m *Manager) ToolDump() string

type RemoteTool

type RemoteTool struct {
	OpenAIName  string
	ServerName  string
	ToolName    string
	Description string
	Schema      map[string]any
}

func AdaptTool

func AdaptTool(serverName string, tool *sdkmcp.Tool) (RemoteTool, error)

type ServerConfig

type ServerConfig struct {
	Name      string            `json:"-"`
	Type      string            `json:"type"`
	Command   string            `json:"command"`
	Args      []string          `json:"args"`
	Env       map[string]string `json:"env"`
	CWD       string            `json:"cwd"`
	URL       string            `json:"url"`
	Headers   map[string]string `json:"headers"`
	Timeout   int               `json:"timeout"`
	Allow     []string          `json:"allow"`
	Deny      []string          `json:"deny"`
	Fallback  bool              `json:"-"`
	SortIndex int               `json:"-"`
}

func (ServerConfig) ToolAllowed

func (sc ServerConfig) ToolAllowed(name string) bool

Jump to

Keyboard shortcuts

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