forge

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMCPServer

func CreateMCPServer(appConfig *AppConfig, version string) (*server.MCPServer, error)

CreateMCPServer creates and configures an MCP server with all tools registered

func ExecuteGraphQL

func ExecuteGraphQL(url, query string, vars map[string]interface{}, token string, isDebug bool) ([]byte, error)

ExecuteGraphQL posts a query+vars to url with Bearer token, returning raw JSON

func RegisterTools

func RegisterTools(srv *server.MCPServer, cfg *ForgeConfig, configDir string, isDebug bool) error

RegisterTools discovers and registers all tools from the config directory

func Serve

func Serve(srv *server.MCPServer, opts ServeOptions) error

Serve starts the MCP server in either HTTP or stdio mode

Types

type AppConfig

type AppConfig struct {
	ConfigDir string
	IsDebug   bool
	Config    *ForgeConfig
}

AppConfig holds the parsed application configuration

func LoadAppConfig

func LoadAppConfig(forgeConfigFlag string, debugEnabled bool) (*AppConfig, error)

LoadAppConfig loads and validates the application configuration

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"`
	URL            string            `yaml:"url"`
	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 GraphqlRequest

type GraphqlRequest struct {
	Query     string                 `json:"query"`
	Variables map[string]interface{} `json:"variables,omitempty"`
}

GraphqlRequest is the POST payload for GraphQL

type ServeOptions

type ServeOptions struct {
	HTTPAddr string
	IsDebug  bool
}

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"`
	Query       string `yaml:"query"`
	Inputs      []struct {
		Name        string `yaml:"name"`
		Type        string `yaml:"type"` // "string" or "number"
		Description string `yaml:"description"`
		Required    bool   `yaml:"required"`
	} `yaml:"inputs"`
	Annotations ToolAnnotations `yaml:"annotations,omitempty"`
}

ToolConfig holds one tool's YAML definition

func LoadToolConfig

func LoadToolConfig(path string) (*ToolConfig, error)

LoadToolConfig loads ToolConfig from the given file path

Jump to

Keyboard shortcuts

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