mcpmock

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeStdio

func ServeStdio(ctx context.Context, cfg *Config, r io.Reader, w io.Writer, logger *slog.Logger)

Types

type Config

type Config struct {
	Name  string          `json:"name"`
	Tools map[string]Tool `json:"tools"`
}

Config is the fully resolved configuration for one deterministic MCP mock server.

func FromEvalConfig

func FromEvalConfig(mock models.MCPMockConfig, baseDir string) (*Config, error)

FromEvalConfig resolves an eval.yaml mcp_mocks entry into a mock server config.

type Response

type Response struct {
	Match       map[string]any    `json:"match,omitempty"`
	MatchSchema map[string]any    `json:"match_schema,omitempty"`
	MatchRegex  map[string]string `json:"match_regex,omitempty"`
	Return      any               `json:"return,omitempty"`
	Error       string            `json:"error,omitempty"`
}

Response defines one fixture response and its matching rules.

type Server

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

func NewServer

func NewServer(cfg *Config, logger *slog.Logger) *Server

func (*Server) HandleRequest

func (s *Server) HandleRequest(_ context.Context, req *jsonrpc.Request) *jsonrpc.Response

type Tool

type Tool struct {
	Description string     `json:"description,omitempty"`
	InputSchema any        `json:"input_schema,omitempty"`
	Responses   []Response `json:"responses,omitempty"`
}

Tool defines one mocked MCP tool.

Jump to

Keyboard shortcuts

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