mcp

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPProvider

type MCPProvider struct {
	Name       string            `json:"name" yaml:"name"`
	Command    []string          `json:"command" yaml:"command"`
	Args       []string          `json:"args,omitempty" yaml:"args,omitempty"`
	Env        map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	WorkingDir string            `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
	StdinData  string            `json:"stdinData,omitempty" yaml:"stdinData,omitempty"`
	Timeout    int               `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	URL        string            `json:"url,omitempty" yaml:"url,omitempty"`
	Headers    map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
}

MCPProvider represents an MCP (Model Context Protocol) tool provider.

func NewMCPProvider

func NewMCPProvider(name string, command []string) *MCPProvider

NewMCPProvider constructs a new MCPProvider with the given name and command.

func NewMCPProviderFromJSON

func NewMCPProviderFromJSON(data []byte) (*MCPProvider, error)

NewMCPProviderFromJSON creates an MCPProvider from JSON configuration.

func (*MCPProvider) GetName

func (p *MCPProvider) GetName() string

GetName returns the provider's name.

func (*MCPProvider) Type

func (p *MCPProvider) Type() ProviderType

Type returns the provider type.

func (*MCPProvider) Validate

func (p *MCPProvider) Validate() error

Validate ensures the provider configuration is valid.

func (*MCPProvider) WithArgs

func (p *MCPProvider) WithArgs(args ...string) *MCPProvider

WithArgs sets command line arguments for the MCP server process.

func (*MCPProvider) WithEnv

func (p *MCPProvider) WithEnv(key, value string) *MCPProvider

WithEnv sets environment variables for the MCP server process.

func (*MCPProvider) WithHeader added in v1.4.9

func (p *MCPProvider) WithHeader(key, value string) *MCPProvider

WithHeader adds a custom HTTP header for HTTP transport.

func (*MCPProvider) WithStdinData

func (p *MCPProvider) WithStdinData(data string) *MCPProvider

WithStdinData sets data to be sent to the MCP server's stdin on startup.

func (*MCPProvider) WithTimeout

func (p *MCPProvider) WithTimeout(seconds int) *MCPProvider

WithTimeout sets the timeout for MCP operations in seconds.

func (*MCPProvider) WithURL added in v1.4.9

func (p *MCPProvider) WithURL(url string) *MCPProvider

WithURL sets the remote MCP server URL for HTTP transport.

func (*MCPProvider) WithWorkingDir

func (p *MCPProvider) WithWorkingDir(dir string) *MCPProvider

WithWorkingDir sets the working directory for the MCP server process.

type McpConfig

type McpConfig struct {
	McpServers map[string]McpServer `json:"mcpServers"`
}

type McpHttpServer

type McpHttpServer struct {
	Transport string `json:"transport"` // always "http"
	URL       string `json:"url"`
}

McpHttpServer config for HTTP transport.

type McpServer

type McpServer interface{}

McpServer is a union of the two MCP transports.

type McpStdioServer

type McpStdioServer struct {
	Transport string            `json:"transport"` // always "stdio"
	Command   string            `json:"command"`
	Args      []string          `json:"args,omitempty"`
	Env       map[string]string `json:"env,omitempty"`
}

McpStdioServer config for stdio transport.

Jump to

Keyboard shortcuts

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