mcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMemberStatus

func FormatMemberStatus(members []central.Member) string

FormatMemberStatus formats member status with visual indicators

func FormatNetworkStatus

func FormatNetworkStatus(networks []client.Network) string

FormatNetworkStatus formats network status for better readability

func ValidateIPAddress

func ValidateIPAddress(ip string) error

ValidateIPAddress validates IP address format

func ValidateNetworkID

func ValidateNetworkID(networkID string) error

ValidateNetworkID validates ZeroTier network ID format

Types

type Config

type Config struct {
	LocalToken   string `json:"local_token,omitempty"`
	CentralToken string `json:"central_token,omitempty"`
}

Config represents MCP configuration

func LoadConfig

func LoadConfig() *Config

LoadConfig loads configuration from environment and default locations

type McpServer

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

MCP Server for ZeroTier - Model Context Protocol integration

func NewMcpServer

func NewMcpServer() *McpServer

NewMcpServer creates a new MCP server instance

func (*McpServer) ExecuteTool

func (s *McpServer) ExecuteTool(ctx context.Context, toolName string, params map[string]interface{}) ToolResult

ExecuteTool executes a specific MCP tool. ctx 用于底层 ZeroTier API 的超时与取消控制。

func (*McpServer) GetTools

func (s *McpServer) GetTools() []Tool

GetTools returns all available MCP tools

func (*McpServer) WithCentralToken

func (s *McpServer) WithCentralToken(token string) *McpServer

WithCentralToken sets the central API token

type Param

type Param struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
}

Param represents a tool parameter

type Tool

type Tool struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Parameters  []Param `json:"parameters"`
}

Tool represents an MCP tool definition

type ToolResult

type ToolResult struct {
	Success bool   `json:"success"`
	Data    string `json:"data"`
	Error   string `json:"error,omitempty"`
}

ToolResult represents the result of a tool execution

func CreateErrorResponse

func CreateErrorResponse(format string, args ...interface{}) ToolResult

CreateErrorResponse creates a standardized error response

func CreateSuccessResponse

func CreateSuccessResponse(message string, data interface{}) ToolResult

CreateSuccessResponse creates a standardized success response

func (ToolResult) ToJSON

func (r ToolResult) ToJSON() string

ToJSON converts the result to JSON format

Jump to

Keyboard shortcuts

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