everything

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server added in v0.2.0

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

Server implements a comprehensive test server that exercises all features of the MCP protocol. It provides implementations of prompts, tools, resources, and sampling capabilities primarily for testing MCP client implementations.

Server maintains subscriptions for resource updates and supports progress tracking and multi-level logging through dedicated channels. While not intended for production use, it serves as both a reference implementation and testing tool for MCP protocol features.

func NewServer added in v0.2.0

func NewServer() *Server

NewServer creates a new test server that implements all MCP protocol features. It initializes internal state and starts background tasks for simulating resource updates.

The server starts with debug-level logging and supports concurrent resource subscriptions through thread-safe operations. Resource updates are simulated via background goroutines to facilitate testing of client subscription handling.

Callers must call Close when finished to properly cleanup background tasks and release resources.

func (*Server) CallTool added in v0.2.0

func (s *Server) CallTool(
	ctx context.Context,
	params mcp.ToolsCallParams,
	requestClient mcp.RequestClientFunc,
) (mcp.ToolResult, error)

CallTool implements mcp.ToolServer interface.

func (Server) Close added in v0.2.0

func (s Server) Close()

Close closes the SSEServer and stops all background tasks.

func (*Server) CompletesPrompt added in v0.2.0

CompletesPrompt implements mcp.PromptServer interface.

func (*Server) CompletesResourceTemplate added in v0.2.0

func (s *Server) CompletesResourceTemplate(
	_ context.Context,
	params mcp.CompletionCompleteParams,
	_ mcp.RequestClientFunc,
) (mcp.CompletionResult, error)

CompletesResourceTemplate implements mcp.ResourceServer interface.

func (*Server) GetPrompt added in v0.2.0

GetPrompt implements mcp.PromptServer interface.

func (Server) Info added in v0.2.0

func (s Server) Info() mcp.Info

Info implements mcp.Server interface.

func (*Server) ListPrompts added in v0.2.0

ListPrompts implements mcp.PromptServer interface.

func (*Server) ListResourceTemplates added in v0.2.0

ListResourceTemplates implements mcp.ResourceServer interface.

func (*Server) ListResources added in v0.2.0

func (s *Server) ListResources(
	_ context.Context,
	params mcp.ResourcesListParams,
	_ mcp.RequestClientFunc,
) (mcp.ResourceList, error)

ListResources implements mcp.ResourceServer interface.

func (*Server) ListTools added in v0.2.0

ListTools implements mcp.ToolServer interface.

func (*Server) LogStreams added in v0.2.0

func (s *Server) LogStreams() <-chan mcp.LogParams

LogStreams implements mcp.LogHandler interface.

func (*Server) ProgressReports added in v0.2.0

func (s *Server) ProgressReports() <-chan mcp.ProgressParams

ProgressReports implements mcp.ProgressReporter interface.

func (*Server) ReadResource added in v0.2.0

func (s *Server) ReadResource(
	_ context.Context,
	params mcp.ResourcesReadParams,
	_ mcp.RequestClientFunc,
) (mcp.Resource, error)

ReadResource implements mcp.ResourceServer interface.

func (Server) RequireRootsListClient added in v0.2.0

func (s Server) RequireRootsListClient() bool

RequireRootsListClient implements mcp.Server interface.

func (Server) RequireSamplingClient added in v0.2.0

func (s Server) RequireSamplingClient() bool

RequireSamplingClient implements mcp.Server interface.

func (*Server) ResourceSubscribedUpdates added in v0.2.0

func (s *Server) ResourceSubscribedUpdates() <-chan string

ResourceSubscribedUpdates implements mcp.ResourceSubscribedUpdater interface.

func (*Server) SetLogLevel added in v0.2.0

func (s *Server) SetLogLevel(level mcp.LogLevel)

SetLogLevel implements mcp.LogHandler interface.

func (*Server) SubscribeResource added in v0.2.0

func (s *Server) SubscribeResource(params mcp.ResourcesSubscribeParams)

SubscribeResource implements mcp.ResourceServer interface.

func (*Server) UnsubscribeResource added in v0.2.0

func (s *Server) UnsubscribeResource(params mcp.ResourcesSubscribeParams)

UnsubscribeResource implements mcp.ResourceServer interface.

Jump to

Keyboard shortcuts

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