relay

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RelayHandler

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

RelayHandler bridges MCP tool calls to Keep policy evaluation.

func NewRelayHandler

func NewRelayHandler(engine *keep.Engine, router *Router, logger *audit.Logger, agentID string) *RelayHandler

NewRelayHandler creates a handler that evaluates policy on every tool call.

func (*RelayHandler) HandleToolCall

func (h *RelayHandler) HandleToolCall(ctx context.Context, name string, args map[string]any) (*mcp.ToolCallResult, error)

HandleToolCall implements mcp.Handler.

type Router

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

Router maps tool names to upstream MCP clients and scopes.

func NewRouter

func NewRouter(ctx context.Context, routes []relayconfig.Route) (*Router, error)

NewRouter connects to all configured upstreams, discovers tools, and builds a routing table. Returns an error if any tool name appears in multiple upstreams.

func (*Router) Lookup

func (r *Router) Lookup(toolName string) (*ToolRoute, error)

Lookup returns the route for a tool name, or an error if not found.

func (*Router) Tools

func (r *Router) Tools() []mcp.Tool

Tools returns the merged list of all tools from all upstreams.

type ToolRoute

type ToolRoute struct {
	Client mcp.ToolCaller
	Scope  string
	Tool   mcp.Tool
}

ToolRoute maps a tool to its upstream client and scope.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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