apps

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 16 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

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

Constants

This section is empty.

Variables

View Source
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.

View Source
var ErrCallFailed = errors.New("the call failed")

ErrCallFailed is returned when an approved call failed; the proposal is marked failed with the error.

View Source
var ErrResponseTooLarge = errors.New("the server's response is too large")

ErrResponseTooLarge is returned for a response over maxResponse.

View Source
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 Configure

func Configure(c Config)

Configure sets the connection settings (call at startup).

func ListTools

func ListTools(ctx context.Context, ep Endpoint) (models.ConnectionTools, error)

ListTools returns the tools the server offers.

func ProposedCall

func ProposedCall(p *models.Proposal) (connection, tool string, args map[string]any)

ProposedCall is the call a proposal asks for.

func Refresh

func Refresh(ctx context.Context, c *models.Connection) error

Refresh lists a connection's tools again and stores them, or the error.

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

type Endpoint struct {
	URL        string
	AuthType   string
	HeaderName string
	Token      string
}

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.

func PresetByID

func PresetByID(id string) (Preset, bool)

PresetByID returns a preset.

type Result

type Result struct {
	IsError    bool
	Text       string
	Structured any
}

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.

func Call

func Call(ctx context.Context, ep Endpoint, tool string, args map[string]any) (Result, error)

Call calls a tool of the server.

func CallTool

func CallTool(ctx context.Context, connection, tool string, args map[string]any) (Result, error)

CallTool calls a tool of a stored connection.

func (Result) JSON

func (r Result) JSON() string

JSON is the result as the model gets it.

Directories

Path Synopsis
Package apptest runs a small MCP server for tests of connected apps.
Package apptest runs a small MCP server for tests of connected apps.

Jump to

Keyboard shortcuts

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