Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Adds native Serena MCP support following the Playwright integration pattern. Enables language-specific code analysis through automatic runtime detection and language server installation.

Syntax

Short form:

tools:
  serena: ["go", "typescript"]

Full configuration:

tools:
  serena:
    version: latest
    args: ["--verbose"]
    languages:
      go:
        version: "1.21"
        go-mod-file: "backend/go.mod"
        gopls-version: "v0.14.2"
      typescript:
      python:
        version: "3.12"

Implementation

Schema & Types

  • Added JSON schema supporting both array and object syntax for 6 languages (go, typescript, python, java, rust, csharp)
  • Added SerenaToolConfig struct with per-language version configuration
  • Implemented dual-syntax parser in parseSerenaTool()
  • Added Go-specific configuration fields: go-mod-file and gopls-version

MCP Rendering

  • Generates uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context codex --project ${{ github.workspace }}
  • Appends custom args when specified
  • Integrated across all engines (Copilot, Claude, Codex, Custom)

Runtime Integration

  • detectSerenaLanguages() maps languages to runtime requirements (Go → go, TypeScript → node, Python → python)
  • Enhanced Go runtime detection to support custom go.mod file paths and explicit version configuration
  • GenerateSerenaLanguageServiceSteps() installs language servers:
    • Go: go install golang.org/x/tools/gopls@<version> (configurable version)
    • TypeScript: npm install -g typescript-language-server typescript
    • Python: pip install python-lsp-server
    • Rust: rustup component add rust-analyzer
  • Steps injected after runtime setup in compiler

Go Configuration Options

  • version: Explicitly set Go version (e.g., "1.21", 1.21)
  • go-mod-file: Specify path to go.mod file for version detection (e.g., "backend/go.mod")
    • Default: "go.mod"
    • Useful for monorepos with Go modules in subdirectories
  • gopls-version: Specify gopls version to install (e.g., "latest", "v0.14.2")
    • Default: "latest"

Validation

  • Added "serena" to standard MCP tools list in mcp_servers.go
  • Skip built-in tools in ValidateMCPConfigs() to prevent custom MCP schema conflicts

Smoke Test Integration

  • Added serena: ["go"] to all smoke test workflows for continuous validation:
    • smoke-copilot.md - Tests Serena with Copilot engine
    • smoke-claude.md - Tests Serena with Claude engine
    • smoke-codex.md - Tests Serena with Codex engine
  • Each smoke test now verifies Serena MCP functionality, Go runtime setup, and gopls installation

Files Changed

  • Schema: main_workflow_schema.json
  • Types: tools_types.go, args.go
  • Rendering: mcp-config.go, mcp_renderer.go
  • Engines: copilot_engine.go, claude_mcp.go, codex_engine.go, custom_engine.go
  • Runtime: runtime_setup.go, compiler_yaml.go
  • Validation: mcp_config_validation.go, mcp_servers.go
  • Demo: dev.md, test workflows
  • Smoke Tests: smoke-copilot.md, smoke-claude.md, smoke-codex.md
  • Test Workflows: test-serena-go-config.md, test-serena-custom-gomod.md, updated test-serena-long.md
Original prompt

Add builtin support for the Serena MCP in the "tools" frontmatter section, similarly to the playwright support.

  • added to schema and added compiler support
  • allows selection and configuration of each language
  • integration with runtime system to install runtime dependencies steps

Syntax: short

tools:
serena: ["go"]

Longer with options

tools:
serena:
version: ... # MCP version
args: ["..."] # custom arguments to MCP
languages:
go:
version: ... # go tooling version
typescript: # empty key supported

  • Update dev.md to use this feature as a test.
  • see Serena shared agentic workflow for code pattern to invoke MCP

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 23, 2025 19:31
…ntime integration

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>
Copilot AI changed the title [WIP] Add builtin support for the Serena MCP in tools section Add built-in Serena MCP support with language service integration Nov 23, 2025
Copilot finished work on behalf of pelikhan November 23, 2025 19:49
Copilot AI requested a review from pelikhan November 23, 2025 19:49
@pelikhan
Copy link
Contributor

@copilot add serena with go all smoke agentic workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot add serena with go all smoke agentic workflows

Added serena: ["go"] to all three smoke test workflows (smoke-copilot, smoke-claude, and smoke-codex). Each workflow now includes:

  • Serena MCP configuration with uvx
  • Go runtime setup
  • gopls language service installation

Commit: 190207f

Copilot finished work on behalf of pelikhan November 23, 2025 20:01
@pelikhan
Copy link
Contributor

@copilot for go, allow configuring the go version, go.mod file location and the gopls version

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot for go, allow configuring the go version, go.mod file location and the gopls version

Added Go configuration options to Serena:

Fields:

  • version: Go version (e.g., "1.21", 1.21)
  • go-mod-file: Path to go.mod file (e.g., "backend/go.mod")
  • gopls-version: gopls version (e.g., "latest", "v0.14.2")

Example:

tools:
  serena:
    languages:
      go:
        version: "1.21"
        go-mod-file: "backend/go.mod"
        gopls-version: "v0.14.2"

Generated steps:

  • Go setup uses go-version-file: backend/go.mod when go-mod-file is specified
  • gopls installation uses go install golang.org/x/tools/gopls@v0.14.2

All three test workflows created and verified:

  • test-serena-go-config.md (all options)
  • test-serena-custom-gomod.md (custom path)
  • test-serena-long.md (updated with new options)

Commit: 6872bb5

Copilot AI changed the title Add built-in Serena MCP support with language service integration Add built-in Serena MCP support with language service integration and Go configuration options Nov 23, 2025
Copilot finished work on behalf of pelikhan November 23, 2025 20:50
@pelikhan pelikhan added the smoke label Nov 23, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 23, 2025

✅ Agentic Changeset Generator completed successfully.

@pelikhan pelikhan marked this pull request as ready for review November 23, 2025 21:04
Copilot AI review requested due to automatic review settings November 23, 2025 21:04
@pelikhan pelikhan merged commit 7569987 into main Nov 23, 2025
17 checks passed
@pelikhan pelikhan deleted the copilot/add-serena-mcp-support branch November 23, 2025 21:04
Copilot finished reviewing on behalf of pelikhan November 23, 2025 21:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds native Serena MCP support following the Playwright integration pattern. It enables language-specific code analysis through automatic runtime detection and language server installation.

Key features:

  • Dual syntax support: short form (array) and full configuration (object)
  • 6 supported languages: Go, TypeScript, Python, Java, Rust, C#
  • Go-specific configuration: custom go.mod path and gopls version
  • Automatic runtime detection and language service installation
  • Integration across all engines (Copilot, Claude, Codex, Custom)

Main concerns:

  • Duplicate arguments in MCP config generation causing command duplication
  • Unrelated whitespace changes mixed into the PR
  • Potential missing import issue in tools_types.go

Reviewed changes

Copilot reviewed 41 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/workflow/tools_types.go Adds SerenaToolConfig struct and parsing logic with dual-syntax support
pkg/workflow/runtime_setup.go Implements language detection and language service installation steps
pkg/workflow/mcp_servers.go Adds "serena" to standard MCP tools list
pkg/workflow/mcp_renderer.go Adds Serena MCP rendering for all engines
pkg/workflow/mcp-config.go Implements Serena MCP config generation with engine-specific options
pkg/workflow/compiler_yaml.go Integrates Serena language service steps into compilation
pkg/parser/schemas/main_workflow_schema.json Adds comprehensive JSON schema for Serena configuration
.github/workflows/smoke-*.md Adds Serena to smoke tests for continuous validation
.github/workflows/test-serena-*.md New test workflows for various Serena configurations
.github/workflows/*.lock.yml Generated lock files showing MCP config (with duplicate args bug)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1724 to +1731
"--from",
"git+https://github.com/oraios/serena",
"serena",
"start-mcp-server",
"--context",
"codex",
"--project",
"${{ github.workspace }}",
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP configuration is generating duplicate arguments. The args array contains the full command sequence twice:

"--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "codex", "--project", "${{ github.workspace }}"

This pattern appears twice in the args array, which will cause the command to fail or behave incorrectly. This appears to be happening in multiple generated lock files (typist.lock.yml, semantic-function-refactor.lock.yml, repository-quality-improver.lock.yml, etc.).

See below for a potential fix:


Copilot uses AI. Check for mistakes.
Comment on lines +35 to +39

// Reset mock implementations to default
mockExistsSync.mockReturnValue(false);
mockReadFileSync.mockReturnValue("");

Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent whitespace: There are extra blank lines being removed (lines 35 and 39 in the diff) that are unrelated to the Serena functionality being added. These formatting changes should be in a separate commit or reverted to keep the PR focused on the Serena feature.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
"fmt"

Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import: The fmt package is imported but this file was already using fmt.Sprintf in existing code (line 513 in the diff), so the import should have already existed. However, if this is a new file or the import was previously missing, this is correct. Please verify that the existing code compiles without this import or if this import is actually needed for the new code.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants