Documentation
¶
Overview ¶
Package mcptools exposes everything the CLI can do as MCP tools, for the local `goship mcp` server and the hosted one alike. Only the way a client and an organization are found differs between the two, and Clients hides that.
Index ¶
- func New(c Clients, version string, o Options) *mcp.Server
- func Register(s *mcp.Server, c Clients, o Options)
- type AccessToken
- type AccessTokenArgs
- type AccessUserArgs
- type AccessUserList
- type AccessUserRef
- type AppArg
- type AppDomainArgs
- type AppList
- type BilledMessage
- type BindDBServerArgs
- type Clients
- type CloudAccountArg
- type CloudAccountList
- type CloudRegionList
- type CloudSizeList
- type CloudSizesArgs
- type ClusterArg
- type ClusterList
- type ClusterSizeList
- type CreateAppArgs
- type CreateClusterArgs
- type CreateDBArgs
- type CreateDBServerArgs
- type CreateDBUserArgs
- type CreateEnvironmentArgs
- type CreateTokenArgs
- type CreateVolumeArgs
- type CreateWebhookArgs
- type DBArg
- type DBBindArgs
- type DBList
- type DBServerArg
- type DBServerList
- type DBServerTierList
- type DBUserList
- type DeleteClusterArgs
- type DeleteDBServerArgs
- type DeployArgs
- type DeployResult
- type DomainArg
- type DomainIDArg
- type DomainList
- type EnableDBExtensionArgs
- type EnvList
- type EnvironmentArg
- type EnvironmentList
- type ListReleasesArgs
- type LogList
- type LogsArgs
- type Message
- type Options
- type OrgArg
- type OrgList
- type PlanList
- type PlansArgs
- type ProjectArg
- type ProjectDomainApplyResult
- type ProjectDomainArg
- type ProjectDomainList
- type ProjectDomainResult
- type ProjectDomainRuleArg
- type ProjectList
- type ProjectOnlyArg
- type ReleaseList
- type ReleaseLog
- type ReleaseLogArgs
- type RenameDBServerArgs
- type ResizeClusterArgs
- type ResizeDBServerArgs
- type RollbackArgs
- type RollbackResult
- type RunArgs
- type RunResult
- type ScaleArgs
- type SetDBServerDiskLimitArgs
- type SetDBSizeLimitArgs
- type SetEnvArgs
- type SetPlanArgs
- type SetProjectDomainArgs
- type Step
- type TokenIDArg
- type TokenList
- type UnsetEnvArgs
- type VisibilityArgs
- type VolumeArg
- type VolumeBindArgs
- type VolumeList
- type WebhookDeliveriesArgs
- type WebhookDeliveryList
- type WebhookIDArg
- type WebhookList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶ added in v0.12.0
type AccessToken struct {
Token string `json:"token"`
}
type AccessTokenArgs ¶ added in v0.12.0
type AccessUserArgs ¶ added in v0.12.0
type AccessUserList ¶ added in v0.12.0
type AccessUserList struct {
Users []portal.AccessUser `json:"users"`
}
type AccessUserRef ¶ added in v0.12.0
type AppArg ¶
type AppArg struct {
ProjectArg
App string `json:"app" jsonschema:"app name"`
}
type AppDomainArgs ¶
type BilledMessage ¶ added in v0.15.0
type BilledMessage struct {
Message string `json:"message"`
BillingStartsAt *time.Time `json:"billing_starts_at,omitempty"`
}
BilledMessage is the result of a create or a plan change. While an invited trial holds the resource unbilled, the text also says when billing starts and BillingStartsAt carries the date.
type BindDBServerArgs ¶ added in v0.19.0
type BindDBServerArgs struct {
DBServerArg
Environment string `json:"environment" jsonschema:"environment slug the server joins (goship_list_environments)"`
}
type Clients ¶
type Clients interface {
Client(ctx context.Context) (*portal.Client, error)
// Org resolves the organization for a call: override when the tool was
// given one, else whatever the caller's context selects. The error says
// how to select one.
Org(ctx context.Context, override string) (string, error)
// Project is Org for the project inside org. The error says how to select
// one.
Project(ctx context.Context, c *portal.Client, org, override string) (string, error)
// Environment is Project for the environment of project: override when
// the tool was given one, else the caller's selection, else the
// organization's default. The error says how to choose one.
Environment(ctx context.Context, c *portal.Client, org, project, override string) (string, error)
// DeploySelection is what goship_deploy weighs after its environment
// argument and the deployed directory's goship.yml: the environment the
// caller chose for a target ("" when nothing did), then the default of
// the organization, from orgs.
DeploySelection(c *portal.Client) (environment func(deploy.Target) string, orgs deploy.OrgLister)
}
Clients gives each tool call its API client, organization, project and environment. The local server reads them from the config file; the hosted one from the request.
type CloudAccountArg ¶
type CloudAccountList ¶
type CloudAccountList struct {
Accounts []portal.CloudAccount `json:"accounts"`
}
type CloudRegionList ¶
type CloudRegionList struct {
Regions []portal.CloudRegion `json:"regions"`
}
type CloudSizeList ¶
type CloudSizesArgs ¶
type CloudSizesArgs struct {
CloudAccountArg
Region string `json:"region" jsonschema:"region slug from goship_list_cloud_regions"`
}
type ClusterArg ¶ added in v0.14.0
type ClusterList ¶ added in v0.14.0
type ClusterSizeList ¶ added in v0.14.0
type ClusterSizeList struct {
Sizes []portal.ResizeOption `json:"sizes"`
}
type CreateAppArgs ¶
type CreateAppArgs struct {
ProjectArg
Name string `json:"name" jsonschema:"app name: lowercase letters, digits and hyphens"`
Platform string `json:"platform,omitempty" jsonschema:"go, python, nodejs or static; omit for an app built from a Dockerfile"`
Plan string `` /* 136-byte string literal not displayed */
Private bool `json:"private,omitempty" jsonschema:"true puts a GoShip login page in front of the app from its first deploy"`
NoDomain bool `json:"no_domain,omitempty" jsonschema:"attach no custom domain, even when the project or organization has a default"`
}
type CreateClusterArgs ¶ added in v0.14.0
type CreateClusterArgs struct {
OrgArg
Name string `json:"name" jsonschema:"cluster name"`
CloudAccount string `` /* 174-byte string literal not displayed */
Region string `json:"region,omitempty" jsonschema:"cloud region slug (goship_list_cloud_regions)"`
Size string `json:"size,omitempty" jsonschema:"cloud machine size slug (goship_list_cloud_sizes)"`
Host string `json:"host,omitempty" jsonschema:"connect a machine the customer already runs, over SSH: its hostname or IP; needs ssh_key"`
Port int `json:"port,omitempty" jsonschema:"SSH port, default 22"`
SSHUser string `json:"ssh_user,omitempty" jsonschema:"SSH user, default root"`
SSHKey string `json:"ssh_key,omitempty" jsonschema:"the private key itself (not a path) with access to the host"`
Kubeconfig string `` /* 131-byte string literal not displayed */
Environments []string `` /* 151-byte string literal not displayed */
}
type CreateDBArgs ¶
type CreateDBArgs struct {
ProjectArg
Name string `json:"name" jsonschema:"database name"`
Plan string `json:"plan,omitempty" jsonschema:"database plan slug; required on GoShip, ignored on the customer's own server"`
Description string `json:"description,omitempty"`
Server string `` /* 229-byte string literal not displayed */
SizeLimitMB *int `` /* 138-byte string literal not displayed */
}
type CreateDBServerArgs ¶ added in v0.9.0
type CreateDBServerArgs struct {
OrgArg
CloudAccount string `json:"cloud_account" jsonschema:"connected Google Cloud account: id, label or provider (goship_list_cloud_accounts)"`
Region string `json:"region" jsonschema:"cloud region slug (goship_list_cloud_regions)"`
Environment string `` /* 253-byte string literal not displayed */
Tier string `json:"tier,omitempty" jsonschema:"machine size slug (goship_list_database_server_tiers); default db-f1-micro"`
Name string `json:"name,omitempty" jsonschema:"server name; default pg-<environment>, or pg-<account label> without an environment"`
DiskLimitGB *int `` /* 138-byte string literal not displayed */
}
type CreateDBUserArgs ¶
type CreateEnvironmentArgs ¶ added in v0.14.0
type CreateEnvironmentArgs struct {
OrgArg
Slug string `json:"slug" jsonschema:"environment slug: lowercase letters, digits and hyphens, e.g. staging"`
Name string `json:"name,omitempty" jsonschema:"display name; defaults to the slug"`
Cluster string `` /* 127-byte string literal not displayed */
DBServer string `` /* 151-byte string literal not displayed */
}
type CreateTokenArgs ¶
type CreateVolumeArgs ¶
type CreateVolumeArgs struct {
ProjectArg
Name string `json:"name"`
Plan string `json:"plan" jsonschema:"byon-local (the cluster's own disk) or do-block-storage"`
CapacityGiB int `json:"capacity_gib" jsonschema:"size in GiB"`
}
type CreateWebhookArgs ¶ added in v0.23.0
type DBArg ¶
type DBArg struct {
ProjectArg
Database string `json:"database" jsonschema:"database name"`
}
type DBBindArgs ¶
type DBServerArg ¶ added in v0.9.0
type DBServerList ¶ added in v0.9.0
type DBServerList struct {
Servers []portal.DatabaseServer `json:"servers"`
}
type DBServerTierList ¶ added in v0.9.0
type DBServerTierList struct {
Tiers []portal.DatabaseServerTier `json:"tiers"`
}
type DBUserList ¶
type DBUserList struct {
Users []portal.DatabaseUser `json:"users"`
}
type DeleteClusterArgs ¶ added in v0.14.0
type DeleteClusterArgs struct {
ClusterArg
DestroyServer bool `json:"destroy_server,omitempty" jsonschema:"also destroy the machine at the cloud provider"`
}
type DeleteDBServerArgs ¶ added in v0.9.0
type DeleteDBServerArgs struct {
DBServerArg
Force bool `` /* 192-byte string literal not displayed */
}
type DeployArgs ¶
type DeployArgs struct {
ProjectArg
Path string `` /* 142-byte string literal not displayed */
Image string `json:"image,omitempty" jsonschema:"container image to deploy instead of building a directory (public registries only)"`
App string `json:"app,omitempty" jsonschema:"app name; defaults to goship.yml's app, then the directory name"`
Platform string `json:"platform,omitempty" jsonschema:"go, python, nodejs or static; inferred from the files present when omitted"`
Plan string `json:"plan,omitempty" jsonschema:"plan slug for a new app; a free plan is picked only when the org has one"`
Dockerfile string `json:"dockerfile,omitempty" jsonschema:"build from this container file instead of a platform"`
Message string `json:"message,omitempty" jsonschema:"release message"`
Env map[string]string `json:"env,omitempty" jsonschema:"private variables applied before the build"`
}
type DeployResult ¶
type DeployResult struct {
deploy.Result
DurationSeconds float64 `json:"duration_seconds"`
Steps []Step `json:"steps"`
}
DeployResult is a finished deploy, with the steps it went through.
type DomainIDArg ¶
type DomainList ¶
type EnableDBExtensionArgs ¶ added in v0.10.0
type EnvironmentArg ¶ added in v0.14.0
type EnvironmentList ¶ added in v0.14.0
type EnvironmentList struct {
Environments []portal.Environment `json:"environments"`
}
type ListReleasesArgs ¶
type LogsArgs ¶
type LogsArgs struct {
AppArg
Lines int `json:"lines,omitempty" jsonschema:"how many recent lines; default 100, at most 1000"`
Source string `json:"source,omitempty" jsonschema:"only lines from this source, e.g. app or router"`
Units []string `json:"units,omitempty" jsonschema:"only lines from these unit ids"`
}
type Message ¶
type Message struct {
Message string `json:"message"`
}
Message is the result of a call that changes something and returns nothing.
type Options ¶
type Options struct {
// Deploy adds goship_deploy, which reads a directory on the machine the
// server runs on. Only the local server can honour it.
Deploy bool
}
Options selects what the server offers.
type OrgArg ¶
type OrgArg struct {
Org string `json:"org,omitempty" jsonschema:"organization slug; defaults to the selected organization"`
}
OrgArg is the organization override every org-scoped tool accepts.
type PlansArgs ¶
type PlansArgs struct {
ProjectArg
Kind string `json:"kind,omitempty" jsonschema:"app (default) or database"`
}
type ProjectArg ¶ added in v0.5.0
type ProjectArg struct {
OrgArg
Project string `json:"project,omitempty" jsonschema:"project slug; defaults to the selected project (goship_list_projects)"`
Environment string `` /* 139-byte string literal not displayed */
}
ProjectArg is the organization, project and environment overrides every project-scoped tool accepts.
type ProjectDomainApplyResult ¶ added in v0.22.0
type ProjectDomainApplyResult struct {
Message string `json:"message"`
Attached []string `json:"attached"`
Failed []portal.ProjectDomainApplyFailure `json:"failed"`
}
type ProjectDomainArg ¶ added in v0.22.0
type ProjectDomainArg struct {
ProjectOnlyArg
Domain string `json:"domain" jsonschema:"domain name, e.g. example.com (as goship_list_project_domains shows it)"`
}
type ProjectDomainList ¶ added in v0.22.0
type ProjectDomainList struct {
Domains []portal.ProjectDomain `json:"domains"`
}
type ProjectDomainResult ¶ added in v0.22.0
type ProjectDomainResult struct {
Message string `json:"message"`
Domain *portal.ProjectDomain `json:"domain,omitempty"`
}
type ProjectDomainRuleArg ¶ added in v0.22.0
type ProjectDomainRuleArg struct {
ProjectDomainArg
Environment string `json:"environment" jsonschema:"environment slug the rule applies to, e.g. staging; never defaulted"`
}
type ProjectList ¶ added in v0.5.0
type ProjectOnlyArg ¶ added in v0.22.0
type ProjectOnlyArg struct {
OrgArg
Project string `json:"project,omitempty" jsonschema:"project slug; defaults to the selected project (goship_list_projects)"`
}
ProjectOnlyArg is the organization and project overrides of a tool that acts on the project as a whole, with no environment.
type ReleaseList ¶
type ReleaseLog ¶ added in v0.23.0
type ReleaseLog struct {
App string `json:"app"`
Version string `json:"version,omitempty"`
Failed bool `json:"failed"`
Error string `json:"error,omitempty"`
// Log is the end of what the release wrote; Truncated says earlier lines
// were left out, by this tool or because the stored log was cut.
Log string `json:"log"`
Truncated bool `json:"truncated"`
// Note explains an empty log.
Note string `json:"note,omitempty"`
}
type ReleaseLogArgs ¶ added in v0.23.0
type RenameDBServerArgs ¶ added in v0.21.0
type RenameDBServerArgs struct {
DBServerArg
Name string `json:"name" jsonschema:"the new name: 3-40 lowercase letters, digits and hyphens, unique in the organization"`
}
type ResizeClusterArgs ¶ added in v0.14.0
type ResizeClusterArgs struct {
ClusterArg
Size string `json:"size" jsonschema:"machine size slug from goship_list_cluster_sizes"`
}
type ResizeDBServerArgs ¶ added in v0.20.0
type ResizeDBServerArgs struct {
DBServerArg
Tier string `json:"tier" jsonschema:"new machine size slug (goship_list_database_server_sizes)"`
}
type RollbackArgs ¶
type RollbackResult ¶
type RunArgs ¶
type RunArgs struct {
AppArg
Command string `json:"command" jsonschema:"shell command to run inside the app's image, e.g. python manage.py migrate"`
Once bool `json:"once,omitempty" jsonschema:"run in one unit only (default: every unit)"`
Isolated bool `json:"isolated,omitempty" jsonschema:"run in a fresh unit instead of the running ones"`
}
type SetDBServerDiskLimitArgs ¶ added in v0.14.0
type SetDBServerDiskLimitArgs struct {
DBServerArg
DiskLimitGB int `` /* 146-byte string literal not displayed */
}
type SetDBSizeLimitArgs ¶ added in v0.14.0
type SetEnvArgs ¶
type SetEnvArgs struct {
AppArg
Env map[string]string `json:"env" jsonschema:"variables to set, name to value"`
Public bool `json:"public,omitempty" jsonschema:"mark them public (visible in the dashboard); secrets stay private by default"`
NoRestart bool `json:"no_restart,omitempty" jsonschema:"apply without restarting the app"`
}
type SetPlanArgs ¶
type SetProjectDomainArgs ¶ added in v0.22.0
type SetProjectDomainArgs struct {
ProjectDomainRuleArg
Subdomain string `` /* 144-byte string literal not displayed */
}
type TokenIDArg ¶
type TokenIDArg struct {
ID string `json:"id" jsonschema:"token id from goship_list_api_tokens"`
}
type UnsetEnvArgs ¶
type VisibilityArgs ¶ added in v0.12.0
type VolumeArg ¶
type VolumeArg struct {
ProjectArg
Volume string `json:"volume" jsonschema:"volume name"`
}
type VolumeBindArgs ¶
type VolumeList ¶
type WebhookDeliveriesArgs ¶ added in v0.23.0
type WebhookDeliveriesArgs struct {
WebhookIDArg
Limit int `json:"limit,omitempty" jsonschema:"how many deliveries to return; 0 for the default"`
}
type WebhookDeliveryList ¶ added in v0.23.0
type WebhookDeliveryList struct {
Deliveries []portal.WebhookDelivery `json:"deliveries"`
}