Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

create_pipeline

Create a new GitLab CI/CD pipeline for a project by specifying the branch or tag and optional variables to automate software delivery processes.

Instructions

Create a new pipeline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
refYesBranch or tag name
variablesNoPipeline variables

Implementation Reference

  • The handler function that implements the create_pipeline tool logic. It constructs a request with ref and optional variables, posts to GitLab API endpoint /projects/{project_id}/pipeline, and returns the response as text content.
    async createPipeline(args: CreatePipelineParams) {
      const requestData: any = {
        ref: args.ref,
      };
    
      if (args.variables && args.variables.length > 0) {
        requestData.variables = args.variables;
      }
    
      const data = await this.client.post(`/projects/${encodeURIComponent(args.project_id)}/pipeline`, requestData);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • MCP tool definition including the inputSchema (JSON Schema) for validating parameters: project_id (string, required), ref (string, required), variables (array of key-value objects, optional).
    {
      name: 'create_pipeline',
      description: 'Create a new pipeline',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          ref: {
            type: 'string',
            description: 'Branch or tag name',
          },
          variables: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                key: { type: 'string' },
                value: { type: 'string' },
                variable_type: {
                  type: 'string',
                  enum: ['env_var', 'file'],
                  default: 'env_var',
                },
              },
              required: ['key', 'value'],
            },
            description: 'Pipeline variables',
          },
        },
        required: ['project_id', 'ref'],
      },
    },
  • src/server.ts:295-298 (registration)
    Registration of the create_pipeline tool handler in the MCP server's CallToolRequestSchema switch statement, dispatching to pipelineHandlers.createPipeline.
    case "create_pipeline":
      return await this.pipelineHandlers.createPipeline(
        args as unknown as CreatePipelineParams
      );
  • TypeScript interface defining the parameters for createPipeline, used in handlers and server for type checking.
    export interface CreatePipelineParams {
      project_id: string;
      ref: string;
      variables?: Array<{
        key: string;
        value: string;
        variable_type?: 'env_var' | 'file';
      }>;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Alosies/gitlab-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server