Skip to content

Configure TypeScript and Python language servers in Serena container#809

Merged
lpcox merged 5 commits intomainfrom
copilot/configure-typescript-python-support
Feb 7, 2026
Merged

Configure TypeScript and Python language servers in Serena container#809
lpcox merged 5 commits intomainfrom
copilot/configure-typescript-python-support

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

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
#!/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.

Original prompt

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:

languages:
- go

However, the workflow configuration at .github/workflows/language-support-tester.md declares:

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

Expected Behavior

The Serena project configuration should include all three languages:

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

  • expires on Feb 14, 2026, 10:47 AM UTC

<agent_instructions>Fix the serena Dockerfile</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing


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

Copilot AI and others added 4 commits February 7, 2026 16:43
…port

- 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>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
- 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>
- 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>
Copilot AI changed the title [WIP] Add TypeScript and Python language support to Serena project Configure TypeScript and Python language servers in Serena container Feb 7, 2026
Copilot AI requested a review from lpcox February 7, 2026 16:47
@lpcox lpcox marked this pull request as ready for review February 7, 2026 17:20
Copilot AI review requested due to automatic review settings February 7, 2026 17:20
@lpcox lpcox merged commit de26188 into main Feb 7, 2026
3 checks passed
@lpcox lpcox deleted the copilot/configure-typescript-python-support branch February 7, 2026 17:20
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 updates the serena-mcp-server container startup behavior to ensure Serena’s workspace configuration enables Go, TypeScript, and Python language-server analysis (previously only Go was configured), aligning container behavior with the repo’s language-support workflows.

Changes:

  • Adds a container startup wrapper (/usr/local/bin/serena-init.sh) that ensures .serena/project.yml includes go, typescript, and python.
  • Switches the container ENTRYPOINT from serena-mcp-server to the initialization wrapper script.
  • Documents the change in BUILD_NOTES.md.

Reviewed changes

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

File Description
containers/serena-mcp-server/Dockerfile Adds an init script that (re)creates .serena/project.yml and updates the entrypoint to run it before starting the server.
containers/serena-mcp-server/BUILD_NOTES.md Notes the multi-language initialization behavior and its intended impact.

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

Comment on lines +64 to +71
# 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\
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

When any required language is missing, the script overwrites project.yml entirely. This discards any existing configuration the user may have in that file. Consider updating only the languages: list (preserving other keys) or appending missing languages without clobbering the whole file.

Suggested change
# 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\
PROJECT_FILE="/workspace/.serena/project.yml"\n\
\n\
# If project.yml does not exist, create it with the required languages\n\
if [ ! -f "$PROJECT_FILE" ]; then\n\
echo "Creating new Serena project with Go, TypeScript, and Python support..."\n\
printf "languages:\\n- go\\n- typescript\\n- python\\n" > "$PROJECT_FILE"\n\
else\n\
echo "Ensuring Serena project has Go, TypeScript, and Python language support..."\n\
NEED_UPDATE=false\n\
\n\
grep -q "^- go$" "$PROJECT_FILE" || NEED_UPDATE=true\n\
grep -q "^- typescript$" "$PROJECT_FILE" || NEED_UPDATE=true\n\
grep -q "^- python$" "$PROJECT_FILE" || NEED_UPDATE=true\n\
\n\
if [ "$NEED_UPDATE" = true ]; then\n\
echo "Appending missing language entries to existing Serena project.yml..."\n\
{\n\
echo ""\n\
echo "# The following languages were added automatically by Serena init:"\n\
echo "languages:"\n\
grep -q "^- go$" "$PROJECT_FILE" || echo "- go"\n\
grep -q "^- typescript$" "$PROJECT_FILE" || echo "- typescript"\n\
grep -q "^- python$" "$PROJECT_FILE" || echo "- python"\n\
} >> "$PROJECT_FILE"\n\
fi\n\

Copilot uses AI. Check for mistakes.
- 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`
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

This note says the container “successfully creates .serena/project.yml when mounting any workspace to /workspace”, but the documented configuration mounts /workspace read-only (:ro), in which case the init script cannot write the file. Update the notes to clarify the workspace (or at least /workspace/.serena) must be writable, or that the script skips initialization on read-only mounts.

Suggested change
- **Testing**: Container successfully creates `.serena/project.yml` when mounting any workspace to `/workspace`
- **Testing**: Container successfully creates `.serena/project.yml` when mounting a **writable** workspace to `/workspace`; when `/workspace` is mounted read-only (e.g., with `:ro`), the init script cannot write `.serena/project.yml` and initialization is skipped

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +63
# Ensure .serena directory exists in workspace\n\
mkdir -p /workspace/.serena\n\
\n\
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The entrypoint script creates /workspace/.serena and may write /workspace/.serena/project.yml. In the documented usage for this image, /workspace is commonly mounted read-only (:ro), which will cause the container to exit due to set -e when it cannot create/write these paths. Consider detecting a non-writable workspace (and warning + skipping init), or adjusting the image/docs to mount a writable volume specifically at /workspace/.serena (or make /workspace writable).

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +71
# Ensure .serena directory exists in workspace\n\
mkdir -p /workspace/.serena\n\
\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\
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The init script hardcodes /workspace paths instead of using SERENA_WORKSPACE (which is set just above and can be overridden by users). Using the env var (with a default) would keep behavior consistent if the workspace location changes.

Suggested change
# Ensure .serena directory exists in workspace\n\
mkdir -p /workspace/.serena\n\
\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\
# Determine workspace directory (allow override via SERENA_WORKSPACE)\n\
WORKSPACE="${SERENA_WORKSPACE:-/workspace}"\n\
\n\
# Ensure .serena directory exists in workspace\n\
mkdir -p "$WORKSPACE/.serena"\n\
\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\

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[language-support] TypeScript and Python language servers not configured in Serena project

2 participants