federation

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package federation provides peer-to-peer federation capabilities for distributed MCP server discovery and tool invocation across server boundaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FederationRouter

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

func NewFederationRouter

func NewFederationRouter(pm *PeerManager, logger Logger) *FederationRouter

func (*FederationRouter) InvokeWithFailover

func (fr *FederationRouter) InvokeWithFailover(ctx context.Context, server, tool string, params map[string]interface{}) ([]byte, error)

func (*FederationRouter) IsEnabled

func (fr *FederationRouter) IsEnabled() bool

func (*FederationRouter) Route

func (fr *FederationRouter) Route(ctx context.Context, toolName string) (peerName string, err error)

type InvokeRequest

type InvokeRequest struct {
	Server string                 `json:"server"`
	Tool   string                 `json:"tool"`
	Params map[string]interface{} `json:"params"`
}

type InvokeResponse

type InvokeResponse struct {
	Result json.RawMessage `json:"result"`
}

type ListToolsResponse

type ListToolsResponse struct {
	Tools []string `json:"tools"`
}

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Info(msg string, args ...any)
	Error(msg string, args ...any)
}

type Peer

type Peer struct {
	Name      string
	URL       string
	AuthToken string
	Status    PeerStatus
	LastCheck time.Time
	// contains filtered or unexported fields
}

type PeerManager

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

func NewPeerManager

func NewPeerManager(cfg *migrate.FederationConfig, logger Logger) (*PeerManager, error)

func (*PeerManager) Connect

func (pm *PeerManager) Connect(ctx context.Context, peerName string) error

func (*PeerManager) DiscoverTools

func (pm *PeerManager) DiscoverTools(ctx context.Context, peerName string) ([]ToolInfo, error)

func (*PeerManager) GetPeerStatus

func (pm *PeerManager) GetPeerStatus(peerName string) PeerStatus

func (*PeerManager) GetToolPeer

func (pm *PeerManager) GetToolPeer(toolName string) string

func (*PeerManager) Invoke

func (pm *PeerManager) Invoke(ctx context.Context, peerName string, server, tool string, params map[string]interface{}) ([]byte, error)

func (*PeerManager) IsEnabled

func (pm *PeerManager) IsEnabled() bool

func (*PeerManager) ListPeers

func (pm *PeerManager) ListPeers() []string

func (*PeerManager) MarkPeerOffline

func (pm *PeerManager) MarkPeerOffline(peerName string)

type PeerStatus

type PeerStatus string
const (
	PeerStatusUnknown PeerStatus = "unknown"
	PeerStatusOnline  PeerStatus = "online"
	PeerStatusOffline PeerStatus = "offline"
	PeerStatusError   PeerStatus = "error"
)

type ToolInfo

type ToolInfo struct {
	Name      string
	Namespace string
	Server    string
}

Jump to

Keyboard shortcuts

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