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
| Name | Required | Description | Default |
|---|---|---|---|
| repoUrl | Yes | GitHub repository URL | |
| deployPath | Yes | Deployment path on server |
Implementation Reference
- src/services/mcp-server.ts:122-133 (registration)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'], }, },
- src/services/mcp-server.ts:40-43 (schema)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'), });
- src/services/mcp-server.ts:268-288 (handler)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}`, }, ], }; }
- src/tools/github-cicd.ts:21-69 (handler)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'}`, }; } }