server

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 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 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