deploykeys

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package deploykeys implements GitLab Deploy Keys API operations as MCP tools. It supports listing, getting, creating, updating, deleting, and enabling project deploy keys, as well as listing and creating instance-level deploy keys and listing deploy keys by user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error

Delete removes a deploy key from a project.

func FormatInstanceListMarkdown

func FormatInstanceListMarkdown(o InstanceListOutput) string

FormatInstanceListMarkdown formats a list of instance deploy keys.

func FormatInstanceOutputMarkdown

func FormatInstanceOutputMarkdown(o InstanceOutput) string

FormatInstanceOutputMarkdown formats a single instance deploy key.

func FormatListMarkdown

func FormatListMarkdown(o ListOutput) string

FormatListMarkdown formats a list of project deploy keys.

func FormatOutputMarkdown

func FormatOutputMarkdown(o Output) string

FormatOutputMarkdown formats a single deploy key.

func RegisterMeta

func RegisterMeta(server *mcp.Server, client *gitlabclient.Client)

RegisterMeta registers the gitlab_deploy_key meta-tool.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers all deploy key MCP tools.

Types

type AddInput

type AddInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Title     string               `json:"title" jsonschema:"Deploy key title,required"`
	Key       string               `json:"key" jsonschema:"Public SSH key content,required"`
	CanPush   *bool                `json:"can_push,omitempty" jsonschema:"Whether the key can push to the project"`
	ExpiresAt string               `json:"expires_at,omitempty" jsonschema:"Expiry date (YYYY-MM-DD)"`
}

AddInput represents parameters for adding a deploy key to a project.

type AddInstanceInput

type AddInstanceInput struct {
	Title     string `json:"title" jsonschema:"Deploy key title,required"`
	Key       string `json:"key" jsonschema:"Public SSH key content,required"`
	ExpiresAt string `json:"expires_at,omitempty" jsonschema:"Expiry date (YYYY-MM-DD)"`
}

AddInstanceInput represents parameters for creating an instance-level deploy key.

type DeleteInput

type DeleteInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID,required"`
}

DeleteInput represents parameters for deleting a deploy key.

type EnableInput

type EnableInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID to enable,required"`
}

EnableInput represents parameters for enabling a deploy key for a project.

type GetInput

type GetInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID,required"`
}

GetInput represents parameters for getting a single deploy key.

type InstanceListOutput

type InstanceListOutput struct {
	toolutil.HintableOutput
	DeployKeys []InstanceOutput          `json:"deploy_keys"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

InstanceListOutput holds a paginated list of instance deploy keys.

func ListAll

func ListAll(ctx context.Context, client *gitlabclient.Client, input ListAllInput) (InstanceListOutput, error)

ListAll lists all instance-level deploy keys.

type InstanceOutput

type InstanceOutput struct {
	toolutil.HintableOutput
	ID                         int64            `json:"id"`
	Title                      string           `json:"title"`
	Key                        string           `json:"key"`
	Fingerprint                string           `json:"fingerprint,omitempty"`
	FingerprintSHA256          string           `json:"fingerprint_sha256,omitempty"`
	CreatedAt                  string           `json:"created_at,omitempty"`
	ExpiresAt                  string           `json:"expires_at,omitempty"`
	ProjectsWithWriteAccess    []ProjectSummary `json:"projects_with_write_access,omitempty"`
	ProjectsWithReadonlyAccess []ProjectSummary `json:"projects_with_readonly_access,omitempty"`
}

InstanceOutput represents an instance-level deploy key.

func AddInstance

func AddInstance(ctx context.Context, client *gitlabclient.Client, input AddInstanceInput) (InstanceOutput, error)

AddInstance creates an instance-level deploy key.

type ListAllInput

type ListAllInput struct {
	Public  *bool `json:"public,omitempty" jsonschema:"Filter by public keys"`
	Page    int   `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage int   `json:"per_page,omitempty" jsonschema:"Results per page (max 100)"`
}

ListAllInput represents parameters for listing all instance-level deploy keys.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	DeployKeys []Output                  `json:"deploy_keys"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListOutput holds a paginated list of project deploy keys.

func ListProject

func ListProject(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListOutput, error)

ListProject lists all deploy keys for a project.

func ListUserProject

func ListUserProject(ctx context.Context, client *gitlabclient.Client, input ListUserProjectInput) (ListOutput, error)

ListUserProject lists deploy keys for a specific user's projects.

type ListProjectInput

type ListProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Page      int                  `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage   int                  `json:"per_page,omitempty" jsonschema:"Results per page (max 100)"`
}

ListProjectInput represents parameters for listing project deploy keys.

type ListUserProjectInput

type ListUserProjectInput struct {
	UserID  toolutil.StringOrInt `json:"user_id" jsonschema:"User ID or username,required"`
	Page    int                  `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage int                  `json:"per_page,omitempty" jsonschema:"Results per page (max 100)"`
}

ListUserProjectInput represents parameters for listing a user's project deploy keys.

type Output

type Output struct {
	toolutil.HintableOutput
	ID                int64  `json:"id"`
	Title             string `json:"title"`
	Key               string `json:"key"`
	Fingerprint       string `json:"fingerprint,omitempty"`
	FingerprintSHA256 string `json:"fingerprint_sha256,omitempty"`
	CreatedAt         string `json:"created_at,omitempty"`
	CanPush           bool   `json:"can_push"`
	ExpiresAt         string `json:"expires_at,omitempty"`
}

Output represents a project-level deploy key.

func Add

func Add(ctx context.Context, client *gitlabclient.Client, input AddInput) (Output, error)

Add adds a deploy key to a project.

func Enable

func Enable(ctx context.Context, client *gitlabclient.Client, input EnableInput) (Output, error)

Enable enables a deploy key for a project.

func Get

func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

Get retrieves a single deploy key by ID.

func Update

func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)

Update updates an existing deploy key.

type ProjectSummary

type ProjectSummary struct {
	ID                int64  `json:"id"`
	Name              string `json:"name"`
	PathWithNamespace string `json:"path_with_namespace"`
	CreatedAt         string `json:"created_at,omitempty"`
}

ProjectSummary holds basic project info for an InstanceDeployKey.

type UpdateInput

type UpdateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID,required"`
	Title       string               `json:"title,omitempty" jsonschema:"New deploy key title"`
	CanPush     *bool                `json:"can_push,omitempty" jsonschema:"Whether the key can push to the project"`
}

UpdateInput represents parameters for updating a deploy key.

Jump to

Keyboard shortcuts

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