pages

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pages implements MCP tools for GitLab Pages operations.

The package wraps the GitLab Pages API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for project Pages actions exposed as MCP tools. The settings, custom domain, and admin routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func DeleteDomain

func DeleteDomain(ctx context.Context, client *gitlabclient.Client, input DeleteDomainInput) error

DeleteDomain removes a custom Pages domain from a project via the GitLab Pages domains API (DELETE /projects/:id/pages/domains/:domain). Requires Maintainer or Owner role.

func FormatAllDomainsMarkdown

func FormatAllDomainsMarkdown(out ListAllDomainsOutput) string

FormatAllDomainsMarkdown formats a list of all Pages domains.

func FormatDeleteMarkdown

func FormatDeleteMarkdown(domain string) string

FormatDeleteMarkdown returns a confirmation for domain deletion.

func FormatDomainListMarkdown

func FormatDomainListMarkdown(out ListDomainsOutput) string

FormatDomainListMarkdown formats a list of Pages domains.

func FormatDomainMarkdown

func FormatDomainMarkdown(out DomainOutput) string

FormatDomainMarkdown formats a single Pages domain for display.

func FormatPagesMarkdown

func FormatPagesMarkdown(out Output) string

FormatPagesMarkdown formats Pages settings for display.

func FormatUnpublishMarkdown

func FormatUnpublishMarkdown() string

FormatUnpublishMarkdown returns a confirmation for pages unpublish.

func UnpublishPages

func UnpublishPages(ctx context.Context, client *gitlabclient.Client, input UnpublishPagesInput) error

UnpublishPages removes the published Pages site for a project via the GitLab Pages API (DELETE /projects/:id/pages). Requires Maintainer or Owner role.

Types

type CertificateOutput

type CertificateOutput struct {
	Subject         string `json:"subject"`
	Expired         bool   `json:"expired"`
	Expiration      string `json:"expiration,omitempty"`
	Certificate     string `json:"certificate,omitempty"`
	CertificateText string `json:"certificate_text,omitempty"`
}

CertificateOutput represents a Pages domain certificate.

type CreateDomainInput

type CreateDomainInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain         string               `json:"domain" jsonschema:"Custom domain name (e.g. example.com),required"`
	AutoSslEnabled *bool                `json:"auto_ssl_enabled,omitempty" jsonschema:"Enable automatic SSL certificate provisioning"`
	Certificate    string               `json:"certificate,omitempty" jsonschema:"PEM-encoded SSL certificate"`
	Key            string               `json:"key,omitempty" jsonschema:"PEM-encoded private key for the certificate"`
}

CreateDomainInput defines parameters for creating a Pages domain.

type DeleteDomainInput

type DeleteDomainInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain    string               `json:"domain" jsonschema:"The Pages domain name to delete,required"`
}

DeleteDomainInput defines parameters for deleting a Pages domain.

type DeploymentOutput

type DeploymentOutput struct {
	CreatedAt     string `json:"created_at"`
	URL           string `json:"url"`
	PathPrefix    string `json:"path_prefix"`
	RootDirectory string `json:"root_directory"`
}

DeploymentOutput represents a Pages deployment.

type DomainOutput

type DomainOutput struct {
	toolutil.HintableOutput
	Domain           string            `json:"domain"`
	AutoSslEnabled   bool              `json:"auto_ssl_enabled"`
	URL              string            `json:"url"`
	ProjectID        int64             `json:"project_id"`
	ProjectPath      string            `json:"project_path,omitempty"`
	Verified         bool              `json:"verified"`
	VerificationCode string            `json:"verification_code"`
	EnabledUntil     string            `json:"enabled_until,omitempty"`
	Certificate      CertificateOutput `json:"certificate"`
}

DomainOutput represents a Pages domain.

func CreateDomain

func CreateDomain(ctx context.Context, client *gitlabclient.Client, input CreateDomainInput) (DomainOutput, error)

CreateDomain adds a new custom domain to a project's Pages configuration via the GitLab Pages domains API (POST /projects/:id/pages/domains). Optional AutoSslEnabled, Certificate, and Key fields are forwarded to the API.

func GetDomain

func GetDomain(ctx context.Context, client *gitlabclient.Client, input GetDomainInput) (DomainOutput, error)

GetDomain retrieves a single Pages domain by name via the GitLab Pages domains API (GET /projects/:id/pages/domains/:domain).

func UpdateDomain

func UpdateDomain(ctx context.Context, client *gitlabclient.Client, input UpdateDomainInput) (DomainOutput, error)

UpdateDomain updates the auto-SSL flag and/or custom certificate of an existing Pages domain via the GitLab Pages domains API (PUT /projects/:id/pages/domains/:domain).

type GetDomainInput

type GetDomainInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain    string               `json:"domain" jsonschema:"The Pages domain name,required"`
}

GetDomainInput defines parameters for getting a single Pages domain.

type GetPagesInput

type GetPagesInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}

GetPagesInput defines parameters for getting Pages settings.

type ListAllDomainsInput

type ListAllDomainsInput struct{}

ListAllDomainsInput defines parameters for listing all Pages domains globally.

type ListAllDomainsOutput

type ListAllDomainsOutput struct {
	toolutil.HintableOutput
	Domains []DomainOutput `json:"domains"`
}

ListAllDomainsOutput wraps a list of all Pages domains.

func ListAllDomains

ListAllDomains returns every Pages domain across the entire instance via the GitLab Pages domains admin API (GET /pages/domains). Requires administrator access.

type ListDomainsInput

type ListDomainsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	toolutil.PaginationInput
}

ListDomainsInput defines parameters for listing Pages domains for a project.

type ListDomainsOutput

type ListDomainsOutput struct {
	toolutil.HintableOutput
	Domains    []DomainOutput            `json:"domains"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListDomainsOutput wraps a list of Pages domains with pagination.

func ListDomains

func ListDomains(ctx context.Context, client *gitlabclient.Client, input ListDomainsInput) (ListDomainsOutput, error)

ListDomains returns the custom Pages domains configured for a project via the GitLab Pages domains API (GET /projects/:id/pages/domains). Supports pagination.

type Output

type Output struct {
	toolutil.HintableOutput
	URL                   string             `json:"url"`
	IsUniqueDomainEnabled bool               `json:"is_unique_domain_enabled"`
	ForceHTTPS            bool               `json:"force_https"`
	Deployments           []DeploymentOutput `json:"deployments,omitempty"`
	PrimaryDomain         string             `json:"primary_domain"`
}

Output represents Pages settings for a project.

func GetPages

func GetPages(ctx context.Context, client *gitlabclient.Client, input GetPagesInput) (Output, error)

GetPages retrieves the Pages settings (URL, unique domain, force HTTPS, deployments) for a project via the GitLab Pages API (GET /projects/:id/pages).

func UpdatePages

func UpdatePages(ctx context.Context, client *gitlabclient.Client, input UpdatePagesInput) (Output, error)

UpdatePages updates the Pages settings for a project via the GitLab Pages API (PUT /projects/:id/pages). Only non-nil fields are applied; pages_primary_domain must reference a domain previously added via CreateDomain.

type UnpublishPagesInput

type UnpublishPagesInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}

UnpublishPagesInput defines parameters for unpublishing Pages.

type UpdateDomainInput

type UpdateDomainInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain         string               `json:"domain" jsonschema:"The Pages domain name to update,required"`
	AutoSslEnabled *bool                `json:"auto_ssl_enabled,omitempty" jsonschema:"Enable automatic SSL certificate provisioning"`
	Certificate    string               `json:"certificate,omitempty" jsonschema:"PEM-encoded SSL certificate"`
	Key            string               `json:"key,omitempty" jsonschema:"PEM-encoded private key for the certificate"`
}

UpdateDomainInput defines parameters for updating a Pages domain.

type UpdatePagesInput

type UpdatePagesInput struct {
	ProjectID                toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	PagesUniqueDomainEnabled *bool                `json:"pages_unique_domain_enabled,omitempty" jsonschema:"Enable unique domain for Pages"`
	PagesHTTPSOnly           *bool                `json:"pages_https_only,omitempty" jsonschema:"Enforce HTTPS for Pages"`
	PagesPrimaryDomain       string               `json:"pages_primary_domain,omitempty" jsonschema:"Primary domain for Pages"`
}

UpdatePagesInput defines parameters for updating Pages settings.

Jump to

Keyboard shortcuts

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