From e3abf69b8961005cec83a1bfa54ccf0b73e43db9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:36:51 +0000 Subject: [PATCH 1/5] Initial plan From 11e60ab05015c987784c6cf968219d8198890924 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:43:28 +0000 Subject: [PATCH 2/5] Add initialization script to Serena Dockerfile for multi-language support - Created serena-init.sh script that auto-generates .serena/project.yml - Ensures Go, TypeScript, and Python are configured on container startup - Script checks if project.yml exists or only has Go, then adds all languages - Updated ENTRYPOINT to use initialization script instead of direct serena-mcp-server - Tested locally: container builds successfully and creates correct configuration Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- containers/serena-mcp-server/Dockerfile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/containers/serena-mcp-server/Dockerfile b/containers/serena-mcp-server/Dockerfile index cbf298036..9f4caadcb 100644 --- a/containers/serena-mcp-server/Dockerfile +++ b/containers/serena-mcp-server/Dockerfile @@ -53,6 +53,24 @@ RUN mkdir -p /workspace /tmp/serena-cache /root/.serena ENV SERENA_WORKSPACE=/workspace ENV SERENA_CACHE_DIR=/tmp/serena-cache +# Create a startup script that ensures multi-language support +# This script will initialize the workspace with Go, TypeScript, and Python if not already configured +RUN printf '#!/bin/bash\n\ +set -e\n\ +\n\ +# Ensure .serena directory exists in workspace\n\ +mkdir -p /workspace/.serena\n\ +\n\ +# If project.yml does not exist or only has go, create/update it with all languages\n\ +if [ ! -f /workspace/.serena/project.yml ] || ! grep -q "typescript" /workspace/.serena/project.yml; then\n\ + echo "Initializing Serena project with Go, TypeScript, and Python support..."\n\ + printf "languages:\\n- go\\n- typescript\\n- python\\n" > /workspace/.serena/project.yml\n\ +fi\n\ +\n\ +# Start the Serena MCP server\n\ +exec serena-mcp-server "$@"\n\ +' > /usr/local/bin/serena-init.sh && chmod +x /usr/local/bin/serena-init.sh + # Create a dummy project to pre-warm Serena's LSP cache # Focus on Python, Go, and TypeScript for codex context RUN mkdir -p /tmp/dummy-project && \ @@ -72,7 +90,7 @@ RUN rm -rf /tmp/dummy-project # Expose the workspace directory as a volume mount point VOLUME ["/workspace"] -# Set default entrypoint to run Serena MCP server -ENTRYPOINT ["serena-mcp-server"] +# Set default entrypoint to run initialization script +ENTRYPOINT ["/usr/local/bin/serena-init.sh"] CMD [] From 9b5a1b550e2e627bc4c10e1a6ff0f619f12fab5b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:43:50 +0000 Subject: [PATCH 3/5] Update BUILD_NOTES.md to document multi-language configuration fix Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- containers/serena-mcp-server/BUILD_NOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/containers/serena-mcp-server/BUILD_NOTES.md b/containers/serena-mcp-server/BUILD_NOTES.md index 0c03b75cf..ac271e707 100644 --- a/containers/serena-mcp-server/BUILD_NOTES.md +++ b/containers/serena-mcp-server/BUILD_NOTES.md @@ -10,6 +10,17 @@ The Serena MCP server container Dockerfile has been created with support for: ## Recent Fixes +### Multi-Language Configuration Script (2026-02-07) +Added automatic project configuration for TypeScript and Python language servers: +- **Problem**: The `.serena/project.yml` configuration only included Go, causing TypeScript and Python language server analysis to fail +- **Solution**: Created initialization script (`serena-init.sh`) that automatically generates/updates `.serena/project.yml` with all three languages (Go, TypeScript, Python) on container startup +- **Impact**: TypeScript and Python code analysis now works out-of-the-box without manual project configuration +- **Implementation**: + - Script checks if `project.yml` exists or only contains Go configuration + - Automatically creates/updates configuration with all supported languages + - Runs via ENTRYPOINT before starting the Serena MCP server +- **Testing**: Container successfully creates `.serena/project.yml` when mounting any workspace to `/workspace` + ### Go Runtime Re-added (2026-02-05) Re-added Go runtime to the container to support Go code analysis: - **Problem**: The Dockerfile only installed `gopls` (Go LSP) but not the Go runtime itself From b7a752d21e1727a7c8e56f70a855017e7e17cf78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:45:51 +0000 Subject: [PATCH 4/5] Improve language detection in serena-init.sh script - Check for all three languages individually with anchored grep patterns - Only recreate config if any of go, typescript, or python is missing - Makes the script more precise and truly idempotent - Addresses code review feedback about insufficient condition Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- containers/serena-mcp-server/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/containers/serena-mcp-server/Dockerfile b/containers/serena-mcp-server/Dockerfile index 9f4caadcb..283b5a511 100644 --- a/containers/serena-mcp-server/Dockerfile +++ b/containers/serena-mcp-server/Dockerfile @@ -61,8 +61,12 @@ set -e\n\ # Ensure .serena directory exists in workspace\n\ mkdir -p /workspace/.serena\n\ \n\ -# If project.yml does not exist or only has go, create/update it with all languages\n\ -if [ ! -f /workspace/.serena/project.yml ] || ! grep -q "typescript" /workspace/.serena/project.yml; then\n\ +# Check if project.yml needs to be created or updated\n\ +# Create/update if: file does not exist, OR it is missing any of the three required languages\n\ +if [ ! -f /workspace/.serena/project.yml ] || \\\n\ + ! grep -q "^- go$" /workspace/.serena/project.yml || \\\n\ + ! grep -q "^- typescript$" /workspace/.serena/project.yml || \\\n\ + ! grep -q "^- python$" /workspace/.serena/project.yml; then\n\ echo "Initializing Serena project with Go, TypeScript, and Python support..."\n\ printf "languages:\\n- go\\n- typescript\\n- python\\n" > /workspace/.serena/project.yml\n\ fi\n\ From 797eab696bca85d8ab25f300f70643ebca97e6a6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:46:29 +0000 Subject: [PATCH 5/5] Update BUILD_NOTES.md to accurately describe implementation - Clarify that script checks for all three languages, not just Go - Add detail about anchored grep patterns - Emphasize that config is only recreated when needed Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- containers/serena-mcp-server/BUILD_NOTES.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/containers/serena-mcp-server/BUILD_NOTES.md b/containers/serena-mcp-server/BUILD_NOTES.md index ac271e707..9049a3d37 100644 --- a/containers/serena-mcp-server/BUILD_NOTES.md +++ b/containers/serena-mcp-server/BUILD_NOTES.md @@ -16,8 +16,9 @@ Added automatic project configuration for TypeScript and Python language servers - **Solution**: Created initialization script (`serena-init.sh`) that automatically generates/updates `.serena/project.yml` with all three languages (Go, TypeScript, Python) on container startup - **Impact**: TypeScript and Python code analysis now works out-of-the-box without manual project configuration - **Implementation**: - - Script checks if `project.yml` exists or only contains Go configuration - - Automatically creates/updates configuration with all supported languages + - Script checks if `project.yml` exists and contains all three required languages (Go, TypeScript, Python) + - Automatically creates/updates configuration only when any language is missing + - Uses anchored grep patterns for precise language detection - Runs via ENTRYPOINT before starting the Serena MCP server - **Testing**: Container successfully creates `.serena/project.yml` when mounting any workspace to `/workspace`