Skip to content

Commit de26188

Browse files
authored
Configure TypeScript and Python language servers in Serena container (#809)
Serena container's `.serena/project.yml` only configured Go, causing TypeScript and Python language server analysis to return empty results. ## Changes - **Initialization script**: Added `/usr/local/bin/serena-init.sh` that auto-generates `.serena/project.yml` with all three languages on container startup - **ENTRYPOINT**: Changed from direct `serena-mcp-server` execution to wrapper script - **Idempotent logic**: Script checks for each language individually with anchored patterns (`^- go$`, `^- typescript$`, `^- python$`) and only recreates config when any language is missing ```bash #!/bin/bash set -e mkdir -p /workspace/.serena if [ ! -f /workspace/.serena/project.yml ] || \ ! grep -q "^- go$" /workspace/.serena/project.yml || \ ! grep -q "^- typescript$" /workspace/.serena/project.yml || \ ! grep -q "^- python$" /workspace/.serena/project.yml; then printf "languages:\n- go\n- typescript\n- python\n" > /workspace/.serena/project.yml fi exec serena-mcp-server "$@" ``` Language servers (gopls, typescript-language-server, pyright) were already installed but not configured for project-level analysis. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[language-support] TypeScript and Python language servers not configured in Serena project</issue_title> > <issue_description>## Summary > > The language-support-tester workflow declares support for Go, TypeScript, and Python in the workflow configuration, but the Serena MCP server project is only configured with Go language support. This prevents TypeScript and Python code analysis from working. > > ## Test Results > > ### ✅ Go Language Support: **WORKING** > - Successfully found symbols using `find_symbol` > - Successfully analyzed Go files using `get_symbols_overview` > - Successfully found references using `find_referencing_symbols` > - Tested with: `main.go`, `version.go`, `main_test.go` > > ### ❌ TypeScript/JavaScript Language Support: **NOT WORKING** > - Created test TypeScript file with classes, interfaces, and functions > - `find_symbol` returned empty results `[]` > - `get_symbols_overview` returned empty object `{}` > - Language server not analyzing TypeScript/JavaScript files > > ### ❌ Python Language Support: **NOT WORKING** > - Created test Python file with classes and functions > - `find_symbol` returned empty results `[]` > - `get_symbols_overview` returned empty object `{}` > - Language server not analyzing Python files > > ## Root Cause > > The `.serena/project.yml` configuration file only includes Go: > > ``````yaml > languages: > - go > `````` > > However, the workflow configuration at `.github/workflows/language-support-tester.md` declares: > > ``````yaml > tools: > serena: ["go", "typescript", "python"] > `````` > > ## Expected Behavior > > The Serena project configuration should include all three languages: > > ``````yaml > languages: > - go > - typescript > - python > `````` > > ## Additional Issues > > The test sample directories referenced in the task specification do not exist: > - Missing: `/workspace/test/serena-mcp-tests/samples/js_project/` > - Missing: `/workspace/test/serena-mcp-tests/samples/python_project/` > > These directories should be created with representative test files for proper integration testing. > > ## Steps to Reproduce > > 1. Run the language-support-tester workflow > 2. Attempt to analyze TypeScript or Python files using Serena tools > 3. Observe that symbol finding and analysis return empty results > > ## Recommended Actions > > 1. Update `.serena/project.yml` to include TypeScript and Python in the `languages` list > 2. Create test sample directories with representative TypeScript and Python code > 3. Re-run the language support tests to verify all three languages work correctly > > > > > > AI generated by [Language Support Tester](https://github.com/github/gh-aw-mcpg/actions/runs/21778809095) > > - [x] expires <!-- gh-aw-expires: 2026-02-14T10:47:32.483Z --> on Feb 14, 2026, 10:47 AM UTC > > <!-- gh-aw-agentic-workflow: Language Support Tester, engine: copilot, run: https://github.com/github/gh-aw-mcpg/actions/runs/21778809095 --> > > <!-- gh-aw-workflow-id: language-support-tester --></issue_description> > > <agent_instructions>Fix the serena Dockerfile</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> > **Custom agent used: agentic-workflows** > GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #801 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
2 parents 2d08c6e + 797eab6 commit de26188

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

containers/serena-mcp-server/BUILD_NOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ The Serena MCP server container Dockerfile has been created with support for:
1010

1111
## Recent Fixes
1212

13+
### Multi-Language Configuration Script (2026-02-07)
14+
Added automatic project configuration for TypeScript and Python language servers:
15+
- **Problem**: The `.serena/project.yml` configuration only included Go, causing TypeScript and Python language server analysis to fail
16+
- **Solution**: Created initialization script (`serena-init.sh`) that automatically generates/updates `.serena/project.yml` with all three languages (Go, TypeScript, Python) on container startup
17+
- **Impact**: TypeScript and Python code analysis now works out-of-the-box without manual project configuration
18+
- **Implementation**:
19+
- Script checks if `project.yml` exists and contains all three required languages (Go, TypeScript, Python)
20+
- Automatically creates/updates configuration only when any language is missing
21+
- Uses anchored grep patterns for precise language detection
22+
- Runs via ENTRYPOINT before starting the Serena MCP server
23+
- **Testing**: Container successfully creates `.serena/project.yml` when mounting any workspace to `/workspace`
24+
1325
### Go Runtime Re-added (2026-02-05)
1426
Re-added Go runtime to the container to support Go code analysis:
1527
- **Problem**: The Dockerfile only installed `gopls` (Go LSP) but not the Go runtime itself

containers/serena-mcp-server/Dockerfile

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ RUN mkdir -p /workspace /tmp/serena-cache /root/.serena
5353
ENV SERENA_WORKSPACE=/workspace
5454
ENV SERENA_CACHE_DIR=/tmp/serena-cache
5555

56+
# Create a startup script that ensures multi-language support
57+
# This script will initialize the workspace with Go, TypeScript, and Python if not already configured
58+
RUN printf '#!/bin/bash\n\
59+
set -e\n\
60+
\n\
61+
# Ensure .serena directory exists in workspace\n\
62+
mkdir -p /workspace/.serena\n\
63+
\n\
64+
# Check if project.yml needs to be created or updated\n\
65+
# Create/update if: file does not exist, OR it is missing any of the three required languages\n\
66+
if [ ! -f /workspace/.serena/project.yml ] || \\\n\
67+
! grep -q "^- go$" /workspace/.serena/project.yml || \\\n\
68+
! grep -q "^- typescript$" /workspace/.serena/project.yml || \\\n\
69+
! grep -q "^- python$" /workspace/.serena/project.yml; then\n\
70+
echo "Initializing Serena project with Go, TypeScript, and Python support..."\n\
71+
printf "languages:\\n- go\\n- typescript\\n- python\\n" > /workspace/.serena/project.yml\n\
72+
fi\n\
73+
\n\
74+
# Start the Serena MCP server\n\
75+
exec serena-mcp-server "$@"\n\
76+
' > /usr/local/bin/serena-init.sh && chmod +x /usr/local/bin/serena-init.sh
77+
5678
# Create a dummy project to pre-warm Serena's LSP cache
5779
# Focus on Python, Go, and TypeScript for codex context
5880
RUN mkdir -p /tmp/dummy-project && \
@@ -72,7 +94,7 @@ RUN rm -rf /tmp/dummy-project
7294
# Expose the workspace directory as a volume mount point
7395
VOLUME ["/workspace"]
7496

75-
# Set default entrypoint to run Serena MCP server
76-
ENTRYPOINT ["serena-mcp-server"]
97+
# Set default entrypoint to run initialization script
98+
ENTRYPOINT ["/usr/local/bin/serena-init.sh"]
7799

78100
CMD []

0 commit comments

Comments
 (0)