Submind YouTube summaries
Thumbnail for GitLab + Claude Code: Fix C++ Bugs with Model Context Protocol (MCP)

GitLab + Claude Code: Fix C++ Bugs with Model Context Protocol (MCP)

Watch on YouTube

Video summary

In this video, Marcel from GitLab demonstrates a powerful integration between Cloud Code and the Model Context Protocol (MCP) to enhance AI-assisted development workflows using GitLab's native infrastructure. The core subject is connecting an external AI agent like Claude Code directly into the GitLab ecosystem by configuring a specific GitLab MCP server within the terminal environment of Cloud Code. This setup allows the AI model to access authentic context from the developer's repository, enabling it to understand project specifics such as issue trackers and codebases without manual intervention or constant switching between different applications. The demonstration focuses on resolving Issue Number Four regarding an Arduino IoT collector crash caused by a missing port configuration. By activating authentication against GitLab.com through Cloud Code, Marcel shows how Claude can immediately read the issue details using dedicated tool calls provided by the MCP server. The AI agent then formulates a comprehensive strategy to fix the bug, which involves catching initialization exceptions with try-catch blocks and utilizing smart pointers like `std::unique_ptr` as required by specific code review guidelines. This process highlights how the model leverages real-time data from GitLab instances—whether self-managed or dedicated—to generate precise solutions tailored to the project's existing architecture. Once a fix is generated, the workflow seamlessly transitions into creating a new branch and initiating a merge request directly through Claude Code commands. The integration ensures that standard GitLab processes are automatically triggered upon submission, including CI/CD pipeline execution for testing, code review approvals based on development style guides, and Advanced SAST scanning to detect security vulnerabilities or regressions in C++ code. Marcel illustrates how developers can monitor the progress of these automated checks without leaving their terminal session, effectively maintaining a continuous flow where the AI agent fetches real-time status updates from running pipelines to confirm when changes are ready for merging. The video concludes by emphasizing the efficiency gained through this seamless integration, which eliminates unnecessary context switching between separate tools like Claude Code and the GitLab web interface. By staying within the terminal environment, developers can instruct the AI on specific tasks such as checking merge request statuses or verifying pipeline health while continuing other work, thereby maximizing productivity. This approach showcases a future-ready development model where advanced language models operate natively alongside established DevOps platforms to accelerate bug fixing and code quality assurance without compromising security or workflow integrity.
Read the full video transcript
Hello everyone, my name is Marcel. I'm a developer advocate here at GitLab and in today's video we want to look into Cloud Code and GitLab specifically context with the GitLab MCP server. In the previous video, which I will link in the description, we looked into the Tanuki IT platform already and the Arduino IOT collector crashing and there is a specific issue open for that which we will look into in the next steps. Now we want to connect that into Cloud Code and by default Cloud Code might not know about this, but there is one way to bring more authentic context into Cloud Code and this is MCP. So the model context protocol. GitLab provides a GitLab MCP server for that purpose and there's also documentation available to make that happen with Cloud Code directly. So this specific command for Cloud to add a GitLab MCP server. I'll show you that in the terminal right now. I've prepared it already. So we want to work against gitlab.com and we can run that configuration. Now we know it's it has been added and then let's start Cloud again. And type in /mcp to manage that server. GitLab is disabled. Let's enable that. And it also needs authentication. Let's go back, authenticate. It will open browser window. Let's authorize that. Close the browser window, go back into Cloud Code. Authentication is successful. Now that this works, we can immediately put it to test. Remember, we are working or looking at issue number four. So, quick quick check here. Issue number four. And in chart code, I can say I need help with fixing issue four. Please help. And we can see that it's building up a strategy here. It will attempt or it's it reads the Git configuration and invokes a tool call. So, we can see it uses the GitLab MCPS over here and the get underscore issue tool call in order to get an inside of what's going on. So, it knows immediately the issue is about the Arduino IoT collector. Um it crashes with an uncod exception when the Arduino port isn't found. It immediately read that from the GitLab uh from the GitLab instance. Can either be gitlab.com, self-managed, dedicated. Um it's it's available everywhere and we can see we get to fixing much faster here. The problem is clear um and it wants us or it starts immediately with a fix. First, it catches the um the exception here. So, a try and catch block is in introduced. It now goes ahead and actually wants to create a new Git branch. Yes, please do that. And it wants to create a merge request. Um the first thing we need to do is to get push um and set the upstream origin, which happens with the dash U here. Um so, the local branch is tracking the remote branch and pushes that. Now, um, we could go ahead and click on the URL, uh, which is a little unreadable here in blue. Um, but we also have to get the MC piece over configured, which has the create merge request tool, which we can see here. And, um, it can use that. So, let's approve that. I'm authenticated against the GitLab server. So, um, the merge request has been created. It's linked to issue number four. Here's a summary for the root cause. It implemented a fix. And we can open the merge request here. And we can see there's a summary, a test plan. It was generated with cloud code. Um, and the good thing is again, GitLab workflow kicks in. Uh, the CI/CD pipelines are running. So, we can follow the pros, uh, the progress along here. Um, to verify that the source code works. We can also see that there an approval is required here from a code review perspective. And last but not least, we see GitLab 2 action platform, uh, with the code review flow automatically triggering on a merge request. So, any change that's being made is again reviewed against the, for example, the development style guide for C++. Um, and any specific other requirements necessary for code reviews. Um, we will also see in a little bit that there is Well, not in a little bit. Um, we can see actually that it kicked off uh, GitLab advanced SAST and also the Advanced SAST scanner for C++. So, we can we can um make sure that the code is not introducing any security vulnerabilities or regressions on or what not. And from there let's peek into our sessions. We can either go here or on the right-hand side we have the GitLab Duo sessions that are running. And we can see that it's reasoning or that the agents are reasoning in the background providing a summary um and as I've shown this the the the review completed um the try and catch block properly handles Arduino sensor initially initialization failures. Um error logging is correct and it also uses um for example smart pointers with STD unique pointer uh which is a requirement in the code review instructions. Um and that's fine. And we can also see that when Advanced SAST finishes that everything works out. Um if I'm if I cannot wait um pressing command R sometimes also is helpful but doesn't speed up the SAST pipelines. But yeah, so we can see this is a fix for the initial problem. And um we can then move further and loop in more custom agents and flows from from the GitLab Duo agent platform. But essentially this video just showed um the pipelines are passing. We can approve the changes. And then I could click on merge and have the same nice integration. Um what I can also to before I close off here, we have the merge request now. Um go back to Claude and say uh is the merge request running okay? Or something similar to um avoid the context switch. Now, um it uses a different tool to get the merge request pipelines. So, essentially fetching the state. Merge is green and ready to merge. So, um I wouldn't or the it's not necessary for me to do the context switch from the terminal directly into the GitLab UI. I could have just stayed here in the terminal create the merge request um and then check in on uh the merge uh the merge request status while I'm already working on something else. Um so, this is a great integration showing the GitLab MCP server together with Claude Code avoiding context switches get the best of both um both tools, both worlds. Um and I hope you've learned something new today. Um and let us know how things are going. Um yeah, thanks for watching and see you next time.