Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server provides the MCP (Model Context Protocol) server implementation for ToolHive.

Index

Constants

View Source
const (
	// DefaultMCPPort is the default port for the MCP server
	// 4483 represents "HIVE" on a phone keypad (4=HI, 8=V, 3=E)
	DefaultMCPPort = "4483"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port string
}

Config holds the configuration for the MCP server

type Handler

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

Handler handles MCP tool requests for ToolHive

func NewHandler

func NewHandler(ctx context.Context) (*Handler, error)

NewHandler creates a new ToolHive handler

func (*Handler) GetServerLogs

func (h *Handler) GetServerLogs(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

GetServerLogs gets logs from a running MCP server

func (*Handler) ListServers

func (h *Handler) ListServers(ctx context.Context, _ mcp.CallToolRequest) (*mcp.CallToolResult, error)

ListServers lists all running MCP servers

func (*Handler) RemoveServer

func (h *Handler) RemoveServer(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

RemoveServer removes a stopped MCP server

func (*Handler) RunServer

func (h *Handler) RunServer(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

RunServer runs an MCP server

func (*Handler) SearchRegistry

func (h *Handler) SearchRegistry(_ context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

SearchRegistry searches the ToolHive registry

func (*Handler) StopServer

func (h *Handler) StopServer(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

StopServer stops a running MCP server

type Info

type Info struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Transport   string   `json:"transport"`
	Image       string   `json:"image,omitempty"`
	Args        []string `json:"args,omitempty"`
	Tools       []string `json:"tools,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

Info represents server information returned by search

type ListServersResponse added in v0.2.14

type ListServersResponse struct {
	Servers []WorkloadInfo `json:"servers"`
}

ListServersResponse represents the response from listing servers

type SearchRegistryResponse added in v0.2.14

type SearchRegistryResponse struct {
	Servers []Info `json:"servers"`
}

SearchRegistryResponse represents the response from searching the registry

type Server

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

Server represents the ToolHive MCP server

func New

func New(ctx context.Context, config *Config) (*Server, error)

New creates a new ToolHive MCP server

func (*Server) GetAddress

func (s *Server) GetAddress() string

GetAddress returns the server address

func (*Server) Shutdown

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

Shutdown gracefully shuts down the MCP server

func (*Server) Start

func (s *Server) Start() error

Start starts the MCP server

type WorkloadInfo

type WorkloadInfo struct {
	Name      string `json:"name"`
	Server    string `json:"server,omitempty"`
	Status    string `json:"status"`
	CreatedAt string `json:"created_at"`
	URL       string `json:"url,omitempty"`
}

WorkloadInfo represents workload information returned by list

Jump to

Keyboard shortcuts

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