mcp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSEConfig

type SSEConfig struct {
	Addr              string
	BaseURL           string
	StaticBasePath    string
	KeepAliveInterval time.Duration
}

SSEConfig contains configuration for SSE transport.

type Server

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

Server represents the MCP server instance.

func NewServer

func NewServer(name string, version string) (*Server, error)

NewServer creates a new MCP server instance with default stdio transport.

func (*Server) GetMCPServer

func (s *Server) GetMCPServer() *server.MCPServer

GetMCPServer returns the underlying MCP server instance.

func (*Server) RegisterResource

func (s *Server) RegisterResource(resource mcp.Resource, handler server.ResourceHandlerFunc) error

RegisterResource registers a resource with the MCP server.

func (*Server) RegisterTool

func (s *Server) RegisterTool(tool mcp.Tool, handler server.ToolHandlerFunc) error

RegisterTool registers a tool with the MCP server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the MCP server with the configured transport.

func (*Server) WithSSEConfig

func (s *Server) WithSSEConfig(config *SSEConfig) *Server

WithSSEConfig sets the SSE configuration for the server.

func (*Server) WithStreamableHTTPConfig

func (s *Server) WithStreamableHTTPConfig(config *StreamableHTTPConfig) *Server

WithStreamableHTTPConfig sets the Streamable HTTP configuration for the server.

func (*Server) WithTransport

func (s *Server) WithTransport(transport TransportType) *Server

WithTransport sets the transport type for the server.

type StreamableHTTPConfig

type StreamableHTTPConfig struct {
	Addr              string
	EndpointPath      string
	HeartbeatInterval time.Duration
	Stateless         bool
}

StreamableHTTPConfig contains configuration for Streamable HTTP transport.

type TransportType

type TransportType string

TransportType represents the type of transport to use.

const (
	// TransportStdio uses standard input/output.
	TransportStdio TransportType = "stdio"
	// TransportSSE uses Server-Sent Events over HTTP.
	TransportSSE TransportType = "sse"
	// TransportStreamableHTTP uses Streamable HTTP protocol.
	TransportStreamableHTTP TransportType = "streamable"
)

Jump to

Keyboard shortcuts

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