Documentation
¶
Index ¶
- func CreateMCPServer(appConfig *AppConfig, version string) (*server.MCPServer, error)
- func ExecuteREST(ctx context.Context, baseURL, method, path string, headers map[string]string, ...) ([]byte, error)
- func RegisterTools(srv *server.MCPServer, cfg *ForgeConfig, configDir string, isDebug bool) error
- func Serve(srv *server.MCPServer, opts ServeOptions) error
- type AppConfig
- type BodyConfig
- type CtxAuthKey
- type ForgeConfig
- type HTTPStatusError
- type InputConfig
- type QueryParam
- type ServeOptions
- type ToolAnnotations
- type ToolConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMCPServer ¶
CreateMCPServer creates and configures an MCP server with all tools registered
func ExecuteREST ¶
func ExecuteREST(ctx context.Context, baseURL, method, path string, headers map[string]string, queryParams map[string]string, body []byte, contentType string, token string, isDebug bool) ([]byte, error)
ExecuteREST performs an HTTP request and returns the response body
func RegisterTools ¶
RegisterTools discovers and registers all tools from the config directory
Types ¶
type AppConfig ¶
type AppConfig struct {
ConfigDir string
IsDebug bool
Config *ForgeConfig
}
AppConfig holds the parsed application configuration
type BodyConfig ¶
type BodyConfig struct {
ContentType string `yaml:"content_type"`
Template string `yaml:"template"`
}
BodyConfig defines the body for the REST request
type CtxAuthKey ¶
type CtxAuthKey struct{}
CtxAuthKey is used as a key for storing auth tokens in context
type ForgeConfig ¶
type ForgeConfig struct {
Name string `yaml:"name"`
BaseURL string `yaml:"base_url"`
Headers map[string]string `yaml:"headers,omitempty"`
TokenCommand string `yaml:"token_command"`
Env map[string]string `yaml:"env,omitempty"`
EnvPassthrough bool `yaml:"env_passthrough,omitempty"`
}
ForgeConfig holds global server settings
func LoadForgeConfig ¶
func LoadForgeConfig(path string) (*ForgeConfig, error)
LoadForgeConfig loads ForgeConfig from the given file path
type HTTPStatusError ¶
HTTPStatusError is returned when the upstream REST API responds with a non-2xx status.
func (*HTTPStatusError) Error ¶
func (e *HTTPStatusError) Error() string
type InputConfig ¶
type InputConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // "string" or "number"
Description string `yaml:"description"`
Required bool `yaml:"required"`
}
InputConfig defines an input parameter for the tool
type QueryParam ¶
QueryParam defines a query parameter for the REST request
type ServeOptions ¶
ServeOptions holds options for serving the MCP server
type ToolAnnotations ¶
type ToolAnnotations struct {
Title string `yaml:"title,omitempty"`
ReadOnlyHint *bool `yaml:"readOnlyHint,omitempty"`
DestructiveHint *bool `yaml:"destructiveHint,omitempty"`
IdempotentHint *bool `yaml:"idempotentHint,omitempty"`
OpenWorldHint *bool `yaml:"openWorldHint,omitempty"`
}
ToolAnnotations defines the annotations for a tool
type ToolConfig ¶
type ToolConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Method string `yaml:"method"`
Path string `yaml:"path"`
Headers map[string]string `yaml:"headers,omitempty"`
QueryParams []QueryParam `yaml:"query_params,omitempty"`
Body *BodyConfig `yaml:"body,omitempty"`
Inputs []InputConfig `yaml:"inputs"`
Annotations ToolAnnotations `yaml:"annotations,omitempty"`
Output string `yaml:"output,omitempty"` // "raw" (default), "json", or "toon"
}
ToolConfig holds one tool's YAML definition
func LoadToolConfig ¶
func LoadToolConfig(path string) (*ToolConfig, error)
LoadToolConfig loads ToolConfig from the given file path