proxy

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package proxy provides functionality for proxying MCP tool requests to shell scripts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunProxyServer

func RunProxyServer(toolConfigs map[string]map[string]string) error

RunProxyServer creates and runs a proxy server with the specified tool configs.

Types

type Parameter

type Parameter struct {
	Name string
	Type string
}

Parameter represents a tool parameter with a name and type.

type Server

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

Server handles proxying requests to shell scripts.

func NewProxyServer

func NewProxyServer() (*Server, error)

NewProxyServer creates a new proxy server.

func (*Server) AddTool

func (s *Server) AddTool(name, description, paramStr, scriptPath string, command string) error

AddTool adds a new tool to the proxy server.

func (*Server) Close

func (s *Server) Close() error

Close closes the log file.

func (*Server) ExecuteScript

func (s *Server) ExecuteScript(toolName string, args map[string]interface{}) (string, error)

ExecuteScript executes a shell script or command with the given parameters.

func (*Server) GetToolSchema

func (s *Server) GetToolSchema(toolName string) (map[string]interface{}, error)

GetToolSchema generates a JSON schema for the tool's parameters.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for JSON-RPC requests on stdin and responding on stdout.

type Tool

type Tool struct {
	// Fields ordered for optimal memory alignment (8-byte aligned fields first)
	Name        string
	Description string
	ScriptPath  string
	Command     string // Inline command to execute
	Parameters  []Parameter
}

Tool represents a proxy tool that executes a shell script or command.

Jump to

Keyboard shortcuts

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