mock

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mock provides a simple implementation of an MCP server for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMockServer

func RunMockServer(tools map[string]string, prompts map[string]map[string]string, resources map[string]map[string]string) error

RunMockServer creates and runs a mock MCP server with the specified entities.

Types

type Prompt

type Prompt struct {
	Name        string
	Description string
	Template    string
}

Prompt represents a mock prompt in the MCP protocol.

type Resource

type Resource struct {
	URI         string
	Description string
	Content     string
}

Resource represents a mock resource in the MCP protocol.

type Server

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

Server is a mock MCP server that responds to JSON-RPC requests.

func NewServer

func NewServer() (*Server, error)

NewServer creates a new mock MCP server.

func (*Server) AddPrompt

func (s *Server) AddPrompt(name, description, template string)

AddPrompt adds a new prompt to the mock server.

func (*Server) AddResource

func (s *Server) AddResource(uri, description, content string)

AddResource adds a new resource to the mock server.

func (*Server) AddTool

func (s *Server) AddTool(name, description string)

AddTool adds a new tool to the mock server.

func (*Server) Close added in v0.0.8

func (s *Server) Close() error

Close closes the log file.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for JSON-RPC requests on stdin and responding on stdout.

type Tool

type Tool struct {
	Name        string
	Description string
}

Tool represents a mock tool in the MCP protocol.

Jump to

Keyboard shortcuts

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