Add Serena MCP duplicate code detector workflow with Docker container support#1293
Merged
Add Serena MCP duplicate code detector workflow with Docker container support#1293
Conversation
… in schema Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Oct 7, 2025
| engine: copilot | ||
| mcp-servers: | ||
| serena: | ||
| container: "ghcr.io/oraios/serena:latest" |
Collaborator
There was a problem hiding this comment.
@copilot use version field to specify "latest" and make sure the docker container contains the image name and version.
Contributor
Author
There was a problem hiding this comment.
Updated in commit 1117412. The workflow now uses container: "ghcr.io/oraios/serena" with version: "latest" as a separate field. The compiler automatically appends the version to create the full image reference ghcr.io/oraios/serena:latest.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… support Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add agentic workflow to analyze commit changes
Add Serena MCP duplicate code detector workflow with Docker container support
Oct 7, 2025
pelikhan
reviewed
Oct 7, 2025
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Oct 7, 2025
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Oct 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new agentic workflow that uses the Serena MCP server running in a Docker container to analyze commits to the main branch and detect duplicated code patterns in Go files.
Overview
The workflow leverages Serena's semantic code analysis capabilities to identify various types of code duplication:
When significant duplication is found, the workflow automatically creates a GitHub issue with detailed findings, including specific file locations, severity assessment, and refactoring recommendations.
Key Changes
1. New Duplicate Code Detection Workflow
Added
.github/workflows/duplicate-code-detector.mdwhich:**.go) are modifiedworkflow_dispatchtrigger2. Enhanced Container Support
Fixed container image pattern in schema to support version tags:
^[a-zA-Z0-9][a-zA-Z0-9/_.-]*$to^[a-zA-Z0-9][a-zA-Z0-9/:_.-]*$ghcr.io/oraios/serena:latest(with colons)docker.io/mcp/brave-search(without tags) workedAdded
versionfield for container-based MCP servers:versionfieldcontainerfield directlyAdded support for custom Docker arguments:
containerfield can now specify customargsfor advanced Docker configurationsExample:
Generates:
3. Documentation and Tests
docs/src/content/docs/guides/mcps.mdexplaining custom Docker args and the version fieldpkg/workflow/mcp_container_args_test.goto verify the new functionality including version field handlingWhy These Changes?
The Serena MCP server is a powerful code analysis tool that requires access to the codebase when running in Docker. Previously, there was no way to mount the repository directory into the container, making it impossible to use containerized code analysis tools effectively. This PR enables that use case while maintaining the security and isolation benefits of Docker containers.
The addition of the
versionfield provides a cleaner way to specify container versions separately from the image name, making configurations more maintainable and following best practices for container image management.Testing
make agent-finishcompletes successfullyResolves the requirement to add an agentic workflow using Serena MCP Docker with the container feature.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.