Skip to main content
MCP Practices

Tongyi Lingma + Alibaba Cloud DevOps MCP: Automatically generate code and submit a merge request from a DevOps work item

By integrating the Alibaba Cloud DevOps MCP Server with Tongyi Lingma, R&D teams can automate the end-to-end workflow, from parsing work item content to automatically generating code. This topic describes how to use the Alibaba Cloud DevOps MCP Server to generate code based on a work item, create a branch, commit the code, and submit a merge request. For information about how the Alibaba Cloud DevOps MCP Server works with other large language models, see https://github.com/aliyun/alibabacloud-devops-mcp-server.

Prerequisites

Step 1: Create a code requirement in Projex

  1. Go to Projex and click Agile Development Sample Project. The Agile Development Sample Project is created by default in your Alibaba Cloud DevOps organization. You can also choose another project.
  2. In the Agile Development Sample Project, click Requirements in the left-side navigation pane, and then click New in the upper-right corner. On the New Requirement page that appears, enter the following:
  • Title: Add QuickSortUtils sorting utility class.
  • Content: Create a QuickSortUtils sorting utility class to sort arrays.
  1. Click New to complete the creation, and copy the requirement ID (for example, DEMO-38).

Step 2: Create a personal access token

  1. On the Alibaba Cloud DevOps homepage, click your profile picture in the upper-right corner and then click Personal Settings.
  2. Click Personal Access Tokens in the left-side navigation pane, and then click New Token. On the New Access Token page, configure the following items:
  • Token name: Enter a name as needed.
  • Expiration time: The default validity period is 7 days. You can select a longer period.
  • Select permissions: Grant read-only or read/write permissions to each sub-item under Organization Management, Project Collaboration, and Code Management.
  1. After the token is created, be sure to copy and save it immediately so that you can use it when you install the MCP Server.

Step 3: Add the Alibaba Cloud DevOps service

  1. Click the MCP Marketplace tab, search for Alibaba Cloud DevOps, and then click Install.
  2. In the dialog box that appears, enter the personal access token that you created in Step 2, and then click Add Now. After the installation is complete, go to My Services to verify. If the icon is displayed, the connection is successful and the service is ready to use. Expand the details to view the list of tools provided by the MCP Server. The host running the IDE must have Node.js installed; otherwise, an error may appear: "failed to create MCP client for yunxiao: failed to start command: exec: "npx": executable file not found in %PATH%". For a fix, see MCP FAQ: The environment required by the npx command is missing.

Step 4: Generate code and submit a merge request

  1. Pull the Codeup-Demo sample repository to your local host and open the project in IntelliJ IDEA.
  2. Go to the Qwen Qoder CN Intelligent Chat page, switch to Agent mode, and enter the following two prompts for testing.
Please show the content of work item DEMO-38.
Please find the Codeup-Demo repository and list its branches.
  1. After a successful test, enter the formal prompt.
    Please create a branch in the Codeup-Demo repository, write code based on the work item (ID: DEMO-38), push the code to the remote Codeup repository when finished, and create a merge request in the Codeup repository.
    
  2. Because this prompt includes multiple operations—reading the requirement, writing code, uploading code, and creating a merge request—the system prompts you multiple times when invoking the MCP tools and waits for your confirmation before proceeding. After Qoder CN generates the QuickSortUtils code, click Accept at the bottom of the diff view to accept the generated code, and then press Ctrl+Enter to confirm the execution of the git commands in the terminal. QuickSortUtils.java snippet generated by Qoder CN:
    package com.aliyun.codeupdemo.util;
    
    import java.util.Arrays;
    
    /**
     * 快速排序工具类
     */
    public class QuickSortUtils {
    
        /**
         * 对数组进行快速排序
         *
         * @param array 需要排序的数组
         * @return 排序后的数组
         */
        public static int[] quickSort(int[] array) {
            if (array == null || array.len...
                return array;
            }
            quickSort...
            return array;
        }
    
        /**
         * 快速排序递归方法
         *
         * @param array 数组
         * @param low 排序起始位...
    
    Git commit and push commands to be executed in the terminal:
    cd D:\Project\JavaProject\Codeup-Demo && git add . && git commit -m feat "add QuickSortUtils and test cases" && git push origin feature/DEMO-38
    
  3. After the interaction is complete, you can view the newly created branch and its corresponding merge request in the Codeup-Demo sample repository. The merge request is titled Add QuickSortUtils sorting utility class, merging from branch feature/DEMO-38 to master. The status shows Pending Merge, with Merge Allowed and No Code Conflicts. On the File Changes tab, you can view the diff of QuickSortUtils.java, which adds 41 lines of quicksort utility code.

References

MCP FAQ Alibaba Cloud DevOps MCP Server DingTalk group: 134400004101
Guides
Developer Reference