mockmcp

package
v1.0.34 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSchemaURI     = "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json"
	DefaultProtocolVer   = "2025-03-26"
	DefaultMarketSource  = "mock_market"
	DefaultRuntimeSource = "mock_runtime"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailFixture

type DetailFixture struct {
	Response market.DetailResponse `json:"response"`
}

type Fixture

type Fixture struct {
	Servers []ServerFixture `json:"servers"`
}

func DefaultFixture

func DefaultFixture() Fixture

func (Fixture) ServerByMCPID

func (f Fixture) ServerByMCPID(mcpID int) (ServerFixture, bool)

func (Fixture) ServerByRemotePath

func (f Fixture) ServerByRemotePath(path string) (ServerFixture, bool)

func (Fixture) Validate

func (f Fixture) Validate() error

type MCPFixture

type MCPFixture struct {
	ProtocolVersion string                     `json:"protocol_version,omitempty"`
	Capabilities    map[string]any             `json:"capabilities,omitempty"`
	ServerInfo      map[string]any             `json:"server_info,omitempty"`
	Tools           []transport.ToolDescriptor `json:"tools,omitempty"`
	Calls           map[string]ToolCallFixture `json:"calls,omitempty"`
}

type Server

type Server struct {
	*httptest.Server
	Fixture Fixture
}

func DefaultServer

func DefaultServer() *Server

func MustNewServer

func MustNewServer(fixture Fixture) *Server

func NewServer

func NewServer(fixture Fixture) (*Server, error)

func (*Server) DetailURL

func (s *Server) DetailURL(mcpID int) string

func (*Server) MarketURL

func (s *Server) MarketURL() string

func (*Server) RemoteURL

func (s *Server) RemoteURL(path string) string

type ServerFixture

type ServerFixture struct {
	Name        string                  `json:"name"`
	Description string                  `json:"description,omitempty"`
	SchemaURI   string                  `json:"schema_uri,omitempty"`
	RemotePath  string                  `json:"remote_path"`
	Registry    market.RegistryMetadata `json:"registry"`
	CLI         market.CLIOverlay       `json:"cli"`
	Detail      *DetailFixture          `json:"detail,omitempty"`
	MCP         *MCPFixture             `json:"mcp,omitempty"`
}

func (ServerFixture) RegistryWithDetailURL

func (s ServerFixture) RegistryWithDetailURL(detailURL string) market.RegistryMetadata

type ToolCallFixture

type ToolCallFixture struct {
	Result map[string]any      `json:"result,omitempty"`
	Error  *transport.RPCError `json:"error,omitempty"`
	Status int                 `json:"status,omitempty"`
}

func (ToolCallFixture) ResultOrDefault

func (c ToolCallFixture) ResultOrDefault(toolName string) map[string]any

Jump to

Keyboard shortcuts

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