Documentation
¶
Overview ¶
Package apps connects GoHead to other services: remote MCP servers (Model Context Protocol, Streamable HTTP transport) whose tools agents can use. A connection stores the server's URL and token; its tools are listed once (on save or refresh) and called on demand, each call over a short session of its own.
Index ¶
- Variables
- func Configure(c Config)
- func ListTools(ctx context.Context, ep Endpoint) (models.ConnectionTools, error)
- func ProposedCall(p *models.Proposal) (connection, tool string, args map[string]any)
- func Refresh(ctx context.Context, c *models.Connection) error
- type Config
- type Endpoint
- type Preset
- type Result
- func ApproveCall(ctx context.Context, id uint, reviewer string, args map[string]any) (*models.Proposal, Result, error)
- func Call(ctx context.Context, ep Endpoint, tool string, args map[string]any) (Result, error)
- func CallTool(ctx context.Context, connection, tool string, args map[string]any) (Result, error)
Constants ¶
This section is empty.
Variables ¶
var ErrBlockedAddress = errors.New("address not allowed for connections (see connections.allow_private_networks)")
ErrBlockedAddress is returned when a connection's URL resolves to an address it may not reach.
var ErrCallFailed = errors.New("the call failed")
ErrCallFailed is returned when an approved call failed; the proposal is marked failed with the error.
var ErrResponseTooLarge = errors.New("the server's response is too large")
ErrResponseTooLarge is returned for a response over maxResponse.
var Presets = []Preset{ { ID: "github", Label: "GitHub", Description: "Issues, pull requests, repositories and code search, with GitHub's MCP server.", URL: "https://api.githubcopilot.com/mcp/", AuthType: models.ConnectionAuthBearer, TokenLabel: "Personal access token", TokenHelp: "A fine-grained token limited to the repositories and permissions the agents need.", TokenURL: "https://github.com/settings/personal-access-tokens/new", DocsURL: "https://github.com/github/github-mcp-server", }, { ID: "zapier", Label: "Zapier", Description: "Gmail, Google Drive, Sheets, Slack, Notion and thousands of other apps, through the actions you enable in Zapier MCP.", URL: "https://mcp.zapier.com/api/v1/connect", AuthType: models.ConnectionAuthBearer, TokenLabel: "Zapier MCP token", TokenHelp: "At mcp.zapier.com, click Add MCP server and choose \"Other\" as the AI agent, add the actions agents may use, then in Settings → API token click Generate token. It is shown once.", TokenURL: "https://mcp.zapier.com/", DocsURL: "https://docs.zapier.com/mcp/get-started/connect/other", }, }
Presets are the services of the catalog, besides custom servers.
Functions ¶
func ProposedCall ¶
ProposedCall is the call a proposal asks for.
Types ¶
type Config ¶
type Config struct {
// AllowPrivateNetworks lets connections reach private and loopback
// addresses (an MCP server on your own network). Link-local addresses
// (cloud metadata endpoints) are always refused.
AllowPrivateNetworks bool
// Timeout of one call (connecting, listing or calling a tool).
Timeout time.Duration
}
Config controls connections to other services.
type Endpoint ¶
Endpoint is where and how to reach a server.
func EndpointOf ¶
func EndpointOf(c models.Connection) (Endpoint, error)
EndpointOf returns a connection's endpoint, with its token decrypted.
type Preset ¶
type Preset struct {
ID string `json:"id"`
Label string `json:"label"`
Description string `json:"description"`
URL string `json:"url"`
AuthType string `json:"authType"`
HeaderName string `json:"headerName,omitempty"`
// TokenLabel names the token people paste, TokenHelp says where to get
// one, TokenURL links to that page.
TokenLabel string `json:"tokenLabel"`
TokenHelp string `json:"tokenHelp"`
TokenURL string `json:"tokenUrl,omitempty"`
DocsURL string `json:"docsUrl,omitempty"`
}
Preset is a service GoHead knows how to connect to: the admin UI fills in its URL and asks for its token.
type Result ¶
Result is what a tool call returned.
func ApproveCall ¶
func ApproveCall(ctx context.Context, id uint, reviewer string, args map[string]any) (*models.Proposal, Result, error)
ApproveCall makes the call a proposal asks for, with arguments edited by the reviewer if given, and records the result in the proposal.