Documentation
¶
Index ¶
- func CreateCommandTransport(ctx context.Context, command string, args ...string) sdk.Transport
- type ResourceConfig
- type Server
- type ServerConfig
- type TestDriver
- type ToolConfig
- type ValidatorClient
- func (v *ValidatorClient) CallTool(name string, arguments map[string]interface{}) (*sdk.CallToolResult, error)
- func (v *ValidatorClient) Close() error
- func (v *ValidatorClient) GetServerInfo() *sdk.Implementation
- func (v *ValidatorClient) ListResources() ([]*sdk.Resource, error)
- func (v *ValidatorClient) ListTools() ([]*sdk.Tool, error)
- func (v *ValidatorClient) ReadResource(uri string) (*sdk.ReadResourceResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ResourceConfig ¶
type ResourceConfig struct {
// URI of the resource
URI string
// Name of the resource
Name string
// Description of the resource
Description string
// MimeType of the resource content
MimeType string
// Content is the actual resource data
Content string
}
ResourceConfig defines a resource for the test server
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a configurable MCP test server
func NewServer ¶
func NewServer(config *ServerConfig) *Server
NewServer creates a new configurable MCP test server
type ServerConfig ¶
type ServerConfig struct {
// Name is the name of the test server
Name string
// Version is the version of the test server
Version string
// Tools is the list of tools to expose
Tools []ToolConfig
// Resources is the list of resources to expose
Resources []ResourceConfig
}
ServerConfig defines the configuration for a test MCP server
func DefaultServerConfig ¶
func DefaultServerConfig() *ServerConfig
DefaultServerConfig returns a basic server configuration for testing
func (*ServerConfig) WithResource ¶
func (c *ServerConfig) WithResource(resource ResourceConfig) *ServerConfig
WithResource adds a resource to the server configuration
func (*ServerConfig) WithTool ¶
func (c *ServerConfig) WithTool(tool ToolConfig) *ServerConfig
WithTool adds a tool to the server configuration
type TestDriver ¶
type TestDriver struct {
// contains filtered or unexported fields
}
TestDriver manages test servers and the gateway for integration testing
func (*TestDriver) AddTestServer ¶
func (td *TestDriver) AddTestServer(serverID string, config *ServerConfig) error
AddTestServer adds a test server with the given ID and configuration
func (*TestDriver) CreateStdioTransport ¶
func (td *TestDriver) CreateStdioTransport(serverID string) (sdk.Transport, error)
CreateStdioTransport creates an in-memory stdio transport to a test server
func (*TestDriver) GetGatewayServer ¶
func (td *TestDriver) GetGatewayServer() *server.UnifiedServer
GetGatewayServer returns the unified server for testing
func (*TestDriver) StartGateway ¶
func (td *TestDriver) StartGateway() error
StartGateway starts the AWMG gateway on top of the test servers
func (*TestDriver) Stop ¶
func (td *TestDriver) Stop()
Stop stops the test driver and all test servers
type ToolConfig ¶
type ToolConfig struct {
// Name of the tool
Name string
// Description of what the tool does
Description string
// InputSchema defines the expected input parameters
InputSchema map[string]interface{}
// Handler is the function that executes when the tool is called
Handler func(arguments map[string]interface{}) ([]sdk.Content, error)
}
ToolConfig defines a tool for the test server
func SimpleEchoTool ¶
func SimpleEchoTool(name string) ToolConfig
SimpleEchoTool creates a basic echo tool for testing
type ValidatorClient ¶
type ValidatorClient struct {
// contains filtered or unexported fields
}
ValidatorClient is a client for validating MCP servers
func NewValidatorClient ¶
NewValidatorClient creates a new validator client connected to the given transport
func (*ValidatorClient) CallTool ¶
func (v *ValidatorClient) CallTool(name string, arguments map[string]interface{}) (*sdk.CallToolResult, error)
CallTool calls a tool on the MCP server
func (*ValidatorClient) Close ¶
func (v *ValidatorClient) Close() error
Close closes the validator client connection
func (*ValidatorClient) GetServerInfo ¶
func (v *ValidatorClient) GetServerInfo() *sdk.Implementation
GetServerInfo returns the server information from the initialize handshake
func (*ValidatorClient) ListResources ¶
func (v *ValidatorClient) ListResources() ([]*sdk.Resource, error)
ListResources retrieves the list of resources from the connected MCP server
func (*ValidatorClient) ListTools ¶
func (v *ValidatorClient) ListTools() ([]*sdk.Tool, error)
ListTools retrieves the list of tools from the connected MCP server
func (*ValidatorClient) ReadResource ¶
func (v *ValidatorClient) ReadResource(uri string) (*sdk.ReadResourceResult, error)
ReadResource reads a resource from the MCP server