relay

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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