Skip to main content
Glama

github_cicd_setup

Configure GitHub CI/CD pipelines with deploy keys and workflows to automate deployment from repositories to specified server paths.

Instructions

Setup GitHub CI/CD with deploy keys and workflow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoUrlYesGitHub repository URL
deployPathYesDeployment path on server

Implementation Reference

  • Registration of the 'github_cicd_setup' tool including name, description, and input schema definition.
    {
      name: 'github_cicd_setup',
      description: 'Setup GitHub CI/CD with deploy keys and workflow',
      inputSchema: {
        type: 'object',
        properties: {
          repoUrl: { type: 'string', description: 'GitHub repository URL' },
          deployPath: { type: 'string', description: 'Deployment path on server' },
        },
        required: ['repoUrl', 'deployPath'],
      },
    },
  • Zod validation schema for github_cicd_setup tool inputs.
    const GitHubConfigSchema = z.object({
      repoUrl: z.string().describe('GitHub repository URL'),
      deployPath: z.string().describe('Deployment path on the server'),
    });
  • MCP server dispatch handler for 'github_cicd_setup' that validates inputs and calls the GitHubCICD service.
    private async handleGitHubCICDSetup(
      args: unknown
    ): Promise<{ content: Array<{ type: 'text'; text: string }> }> {
      if (!this.githubCICD) {
        throw new Error('SSH connection not established. Please connect first.');
      }
    
      const config = GitHubConfigSchema.parse(args);
      const result = await this.githubCICD.setupCICD(config);
    
      return {
        content: [
          {
            type: 'text',
            text: result.success
              ? `GitHub CI/CD setup completed. Deploy key and workflow generated.`
              : `GitHub CI/CD setup failed: ${result.message}`,
          },
        ],
      };
    }
  • Core implementation of GitHub CI/CD setup: generates SSH deploy key, sets up server deployment directory and script, generates action secret, and creates GitHub workflow YAML.
    async setupCICD(config: GitHubCICDConfig): Promise<GitHubCICDResult> {
      try {
        logger.info('Setting up GitHub CI/CD', {
          repoUrl: config.repoUrl,
          deployPath: config.deployPath,
        });
    
        // Generate deploy key
        const deployKey = await this.generateDeployKey();
        if (!deployKey) {
          return {
            success: false,
            message: 'Failed to generate deploy key',
          };
        }
    
        // Setup deployment directory
        const setupResult = await this.setupDeploymentDirectory(config.deployPath);
        if (!setupResult.success) {
          return setupResult;
        }
    
        // Generate action secret
        const actionSecret = await this.generateActionSecret();
        if (!actionSecret) {
          return {
            success: false,
            message: 'Failed to generate action secret',
          };
        }
    
        // Create workflow file
        const workflowFile = this.generateWorkflowFile(config);
    
        return {
          success: true,
          message: 'GitHub CI/CD setup completed successfully',
          deployKey,
          actionSecret,
          workflowFile,
        };
      } catch (error) {
        logger.error('GitHub CI/CD setup failed', { error, config });
        return {
          success: false,
          message: `GitHub CI/CD setup failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
        };
      }
    }

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/oxy-Op/DevPilot'

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