{"id":2432,"date":"2025-08-29T13:23:16","date_gmt":"2025-08-29T13:23:16","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/08\/29\/boost-your-copilot-with-sonarqube-via-docker-mcp-toolkit-and-gateway\/"},"modified":"2025-08-29T13:23:16","modified_gmt":"2025-08-29T13:23:16","slug":"boost-your-copilot-with-sonarqube-via-docker-mcp-toolkit-and-gateway","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/08\/29\/boost-your-copilot-with-sonarqube-via-docker-mcp-toolkit-and-gateway\/","title":{"rendered":"Boost Your Copilot with SonarQube via Docker MCP Toolkit and Gateway"},"content":{"rendered":"<p>In the era of AI copilots and code generation tools productivity is skyrocketing, but so is the risk of insecure, untested, or messy code slipping into production. How do you ensure it doesn\u2019t introduce vulnerabilities, bugs, or bad practices?\u00a0<\/p>\n<p>A widely adopted tool to help address these concerns is SonarQube. It provides a rich set of rules and quality gates to analyze code for bugs, test coverage, code smells, and security issues. But there\u2019s a common pain point: the feedback loop. You often need to switch between your IDE and SonarQube\u2019s results, breaking focus and slowing iteration.<\/p>\n<p>What if your AI agent could see code quality issues the moment they appear, right in your IDE, without you switching tabs or breaking your flow? In this post, we\u2019ll focus on enhancing your development workflow by integrating SonarQube analysis directly into your IDE using the Sonar MCP server and Docker MCP Toolkit.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Getting Started with Sonar MCP from the Docker MCP Toolkit<\/strong><\/h2>\n<p>The solution is here: Sonar MCP Server \u2013 a Model Context Protocol (MCP) server that integrates with SonarQube (Cloud or Server) and allows AI agents (like GitHub Copilot) to access code quality metrics and insights directly from your IDE.<\/p>\n<p>To enable Sonar MCP easily and securely, we\u2019ll use the Docker MCP Toolkit. It provides a catalog of over 150 MCP servers \u2013 including SonarQube.<\/p>\n<p>We won\u2019t dive deep into how MCP servers and the MCP Toolkit work, (check out the links below for that), but instead we\u2019ll walk through a hands-on example of using Docker MCP Toolkit with Sonar MCP in a Java project.<\/p>\n<p>Further reading about MCP Catalog and Toolkit:<\/p>\n<p><a href=\"https:\/\/www.docker.com\/blog\/copilot-agent-mode\/\">How Docker MCP Toolkit Works with VS Code Copilot Agent Mode<\/a><\/p>\n<p><a href=\"https:\/\/www.docker.com\/blog\/mcp-catalog\/\">Introducing Docker MCP Catalog and Toolkit<\/a><\/p>\n<h2 class=\"wp-block-heading\"><strong>Demo Project: Java Local Development with Testcontainers<\/strong><\/h2>\n<p>For our demo, we\u2019ll use the Java Local Development Testcontainers Workshop project, a Spring Boot-based microservice for managing a product catalog, complete with APIs and Testcontainers-based tests.<\/p>\n<p>GitHub repo:<a href=\"https:\/\/github.com\/GannaChernyshova\/java-testcontainers-local-development\" target=\"_blank\"> GannaChernyshova\/java-testcontainers-local-development<\/a><\/p>\n<p>Before diving into MCP integration, ensure your Java project is already set up for SonarQube analysis. In this demo project, that includes:<\/p>\n<p>Using the JaCoCo plugin to collect test coverage data<\/p>\n<p>Adding the SonarQube Maven plugin for code scanning<\/p>\n<p>We also created a corresponding project in SonarQube Cloud and linked it to the GitHub repository. The details of SonarQube setup are outside the scope of this post, but if you need guidance, check out the <a href=\"https:\/\/docs.sonarsource.com\/\" target=\"_blank\">official SonarQube documentation<\/a>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 1: Start the Sonar MCP Server via Docker Desktop<\/strong><\/h3>\n<p>The Docker MCP Toolkit, available in Docker Desktop, makes it quick and secure to spin up MCP servers from a pre\u2011curated catalog without worrying about manual setup or complex dependencies.\u00a0<\/p>\n<p>To get started:<\/p>\n<p>Open Docker Desktop and navigate to the MCP Toolkit tab.<\/p>\n<p>Browse the Catalog to find SonarQube.<\/p>\n<p>Configure it with your SonarQube URL, organization, and access token.<\/p>\n<p>Hit Start to launch the MCP server.<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 1: SonarQube MCP settings in the Docker Desktop MCP Toolkit<\/em><\/p>\n\n<p>Your MCP server should now be up and running.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 2: Connect Sonar MCP to GitHub Copilot (IntelliJ)<\/strong><\/h3>\n<p>We\u2019ll use GitHub Copilot in IntelliJ, which now supports Agent Mode and MCP integration.\u00a0 Here is the detailed instruction from GitHub: <a href=\"https:\/\/docs.github.com\/en\/copilot\/how-tos\/provide-context\/use-mcp\/extend-copilot-chat-with-mcp?tool=jetbrains\" target=\"_blank\">how to use the Model Context Protocol (MCP) to extend Copilot Chat.<\/a><\/p>\n<p>Open Copilot Settings.<\/p>\n<p>Edit or create the mcp.json file with:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n{<br \/>\n   &#8220;servers&#8221;: {<br \/>\n       &#8220;MCP_DOCKER&#8221;: {<br \/>\n           &#8220;command&#8221;: &#8220;docker&#8221;,<br \/>\n           &#8220;args&#8221;: [<br \/>\n               &#8220;mcp&#8221;,<br \/>\n               &#8220;gateway&#8221;,<br \/>\n               &#8220;run&#8221;<br \/>\n           ],<br \/>\n           &#8220;type&#8221;: &#8220;stdio&#8221;<br \/>\n       }<br \/>\n   }<br \/>\n}\n<\/div>\n<p>With this configuration you enable the Docker MCP Gateway, a secure enforcement point between agents and external tools, that would connect the MCP servers from the MCP Toolkit to your clients or agents.\u00a0\u00a0<\/p>\n<p>Now when you switch to Agent Mode in Copilot Chat, you\u2019ll see a list of tools available from the connected MCP server \u2013 in this case, the Sonar MCP tools.<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 2: Tools that SonarQube MCP server provides<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 3: Analyze and Improve Your Code<\/strong><\/h3>\n<p>Let\u2019s scan the project:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\nmvn clean verify sonar:sonar\n<\/div>\n<p>In our case, the default quality gate passed. However, 4 security issues, few maintainability and 72.1% test coverage were flagged, leaving room for improvement.<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 3: Initial SonarQube scanning overview<\/em><\/p>\n\n<p>Time to bring in Copilot + Sonar MCP!<\/p>\n<p>We can now ask Copilot Chat to list the issues, suggest fixes, help with adding missing tests, and iterate faster \u2013 all within IntelliJ, without switching context.<\/p>\n<p>Through several iterations, the agent successfully:<\/p>\n<p>Detected open issues, suggested and applied fixes:<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 4: GitHub Copilot Agent detects and fixes issues reported by SonarQube\u00a0<\/em><\/p>\n\n<p>Improved test coverage based on the sonar report of uncovered code lines:\u00a0<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 5: GitHub Copilot Agent writes tests for uncovered code detected in SonarQube report\u00a0<\/em><\/p>\n\n<p>Resolved security problems and improved code maintainability:<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 6: GitHub Copilot Agent implements fixes based on the SonarQube open security and maintainability issues<\/em><\/p>\n\n<p>As a result, the final SonarQube scan showed an A rating in every analysis category, and test coverage increased by over 15%, reaching 91.1%.<\/p>\n<div class=\"wp-block-ponyo-image\"><\/div>\n<p><em>Figure 7: SonarQube scanning results after the fixes made with the help of Copilot<\/em><\/p>\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n<p>With the rapid rise of generative AI tools, developers can move faster than ever. But that speed comes with responsibility. The combination of Sonar MCP + Docker MCP Toolkit turns AI copilots into security- and quality-aware coding partners. It\u2019s not just about writing code faster, it\u2019s about writing better code first.\u00a0<\/p>\n<h2 class=\"wp-block-heading\">Learn More<\/h2>\n<p>Discover hundreds of curated MCP servers on the<a href=\"https:\/\/hub.docker.com\/mcp\" target=\"_blank\"> Docker MCP Catalog<\/a><\/p>\n<p>Learn more about<a href=\"https:\/\/docs.docker.com\/ai\/mcp-catalog-and-toolkit\/toolkit\/\" target=\"_blank\"> Docker MCP Toolkit<\/a><\/p>\n<p>Explore<a href=\"https:\/\/github.com\/docker\/mcp-gateway\" target=\"_blank\"> Docker MCP Gateway<\/a> on GitHub<\/p>","protected":false},"excerpt":{"rendered":"<p>In the era of AI copilots and code generation tools productivity is skyrocketing, but so is the risk of insecure, [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2432","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/2432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=2432"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/2432\/revisions"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=2432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=2432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=2432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}