guard

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package guard provides functionality for filtering MCP tool requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunFilterServer

func RunFilterServer(allowPatterns, denyPatterns map[string][]string, cmdArgs []string) error

RunFilterServer creates and runs a filter server with the specified patterns and command.

Types

type ChildProcess

type ChildProcess struct {
	Stdin  io.WriteCloser
	Stdout io.ReadCloser
	Stderr io.ReadCloser
	// contains filtered or unexported fields
}

ChildProcess represents a child process that handles MCP requests.

func NewChildProcess

func NewChildProcess(cmdArgs []string) *ChildProcess

NewChildProcess creates a new child process.

func (*ChildProcess) Close

func (c *ChildProcess) Close() error

Close closes the child process.

func (*ChildProcess) Start

func (c *ChildProcess) Start() error

Start starts the child process.

type FilterServer

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

FilterServer handles proxying requests and filtering tools, prompts, and resources.

func NewFilterServer

func NewFilterServer(allowPatterns, denyPatterns map[string][]string) (*FilterServer, error)

NewFilterServer creates a new filter server.

func (*FilterServer) Close

func (s *FilterServer) Close() error

Close closes the log file.

func (*FilterServer) IsAllowed

func (s *FilterServer) IsAllowed(entityType, name string) bool

IsAllowed determines if a name is allowed based on the configured patterns.

func (*FilterServer) Start

func (s *FilterServer) Start(cmdArgs []string) error

Start begins listening for JSON-RPC requests on stdin, proxying them to the child process, and responding on stdout with filtered responses.

Jump to

Keyboard shortcuts

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