models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name        string         `yaml:"name"`
	Description string         `yaml:"description"`
	Type        string         `yaml:"type,omitempty"`
	Required    bool           `yaml:"required,omitempty"`
	Default     any            `yaml:"default,omitempty"`
	Enum        []any          `yaml:"enum,omitempty"`
	Items       map[string]any `yaml:"items,omitempty"`
	Properties  map[string]any `yaml:"properties,omitempty"`
	Position    string         `yaml:"position,omitempty"`
}

Arg represents an MCP tool argument

type ConvertOptions

type ConvertOptions struct {
	ServerName     string
	ServerConfig   map[string]interface{}
	ToolNamePrefix string
	TemplatePath   string
}

ConvertOptions represents options for the conversion process

type Header struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

Header represents an HTTP header

type MCPConfig

type MCPConfig struct {
	ToolSet *ToolSetConfig `yaml:"toolSet,omitempty"`
	Server  ServerConfig   `yaml:"server,omitempty"`
	Tools   []Tool         `yaml:"tools,omitempty"`
}

MCPConfig represents the top-level MCP server configuration

type MCPConfigTemplate

type MCPConfigTemplate struct {
	Server ServerConfig `yaml:"server"`
	Tools  ToolTemplate `yaml:"tools,omitempty"`
}

MCPConfigTemplate represents a template for patching the generated config

type RequestTemplate

type RequestTemplate struct {
	URL            string                   `yaml:"url,omitempty"`
	Method         string                   `yaml:"method,omitempty"`
	Headers        []Header                 `yaml:"headers,omitempty"`
	Body           string                   `yaml:"body,omitempty"`
	ArgsToJsonBody bool                     `yaml:"argsToJsonBody,omitempty"`
	ArgsToUrlParam bool                     `yaml:"argsToUrlParam,omitempty"`
	ArgsToFormBody bool                     `yaml:"argsToFormBody,omitempty"`
	Security       *ToolSecurityRequirement `yaml:"security,omitempty"`
}

RequestTemplate represents the MCP request template

type ResponseTemplate

type ResponseTemplate struct {
	Body        string `yaml:"body,omitempty"`
	PrependBody string `yaml:"prependBody,omitempty"`
	AppendBody  string `yaml:"appendBody,omitempty"`
}

ResponseTemplate represents the MCP response template

type SecurityScheme

type SecurityScheme struct {
	ID                string `yaml:"id"`
	Type              string `yaml:"type"`             // e.g., "http", "apiKey", "oauth2", "openIdConnect"
	Scheme            string `yaml:"scheme,omitempty"` // e.g., "basic", "bearer" for "http" type
	In                string `yaml:"in,omitempty"`     // e.g., "header", "query", "cookie" for "apiKey" type
	Name              string `yaml:"name,omitempty"`   // Name of the header, query parameter or cookie for "apiKey" type
	DefaultCredential string `yaml:"defaultCredential,omitempty"`
}

SecurityScheme defines a security scheme that can be used by the tools.

type ServerConfig

type ServerConfig struct {
	Name                      string                   `yaml:"name"`
	Config                    map[string]any           `yaml:"config,omitempty"`
	Type                      string                   `yaml:"type,omitempty"`      // e.g.,"mcp-proxy"
	Transport                 string                   `yaml:"transport,omitempty"` // e.g.,"http", "sse"
	McpServerURL              string                   `yaml:"mcpServerURL,omitempty"`
	Timeout                   *int                     `yaml:"timeout,omitempty"`
	DefaultUpstreamSecurity   *ToolSecurityRequirement `yaml:"defaultUpstreamSecurity,omitempty"`
	DefaultDownstreamSecurity *ToolSecurityRequirement `yaml:"defaultDownstreamSecurity,omitempty"`
	AllowTools                []string                 `yaml:"allowTools,omitempty"`
	SecuritySchemes           []SecurityScheme         `yaml:"securitySchemes,omitempty"`
}

ServerConfig represents the MCP server configuration

type ServerToolConfig

type ServerToolConfig struct {
	ServerName string   `json:"serverName"`
	Tools      []string `json:"tools"`
}

ServerToolConfig specifies which tools from a server to include in a toolset.

type Tool

type Tool struct {
	Name                  string                   `yaml:"name"`
	Description           string                   `yaml:"description"`
	Args                  []Arg                    `yaml:"args"`
	RequestTemplate       RequestTemplate          `yaml:"requestTemplate"`
	ResponseTemplate      ResponseTemplate         `yaml:"responseTemplate"`
	ErrorResponseTemplate *string                  `yaml:"errorResponseTemplate,omitempty"`
	Security              *ToolSecurityRequirement `yaml:"security,omitempty"`
	OutputSchema          map[string]any           `yaml:"outputSchema,omitempty"` // NEW: Output schema for MCP 2025-06-18
}

Tool represents an MCP tool configuration

type ToolSecurityRequirement

type ToolSecurityRequirement struct {
	ID          string `yaml:"id"`                    // References a SecurityScheme ID defined in ServerConfig.SecuritySchemes
	Passthrough bool   `yaml:"passthrough,omitempty"` // Whether to pass through the security credentials
}

ToolSecurityRequirement specifies a security scheme requirement for a tool.

type ToolSetConfig

type ToolSetConfig struct {
	Name        string             `json:"name"`
	ServerTools []ServerToolConfig `json:"serverTools"`
}

ToolSetConfig defines the configuration for a toolset.

type ToolTemplate

type ToolTemplate struct {
	RequestTemplate  *RequestTemplate         `yaml:"requestTemplate,omitempty"`
	ResponseTemplate *ResponseTemplate        `yaml:"responseTemplate,omitempty"`
	Security         *ToolSecurityRequirement `yaml:"security,omitempty"`
	OutputSchema     map[string]any           `yaml:"outputSchema,omitempty"` // NEW: Output schema template
}

ToolTemplate represents a template for applying to all tools

Jump to

Keyboard shortcuts

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