forge

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMCPServer

func CreateMCPServer(appConfig *AppConfig, version string) (*mcp.Server, error)

CreateMCPServer creates and configures an MCP server with all tools registered

func ExecuteGraphQL

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

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

func RegisterTools

func RegisterTools(srv *mcp.Server, cfg *ForgeConfig, configDir string, isDebug bool) error

RegisterTools discovers and registers all tools from the config directory

func Serve

func Serve(srv *mcp.Server, 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]any `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"`
	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

Jump to

Keyboard shortcuts

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