Using Serena | GitHub Agentic Workflows
Skip to main content Using Serena Serena is an MCP server that enhances AI agents with IDE-like tools for semantic code analysis and manipulation. It supports 30+ programming languages through Language Server Protocol (LSP) integration, enabling agents to find symbols, navigate code relationships, and edit at the symbol level — ideal for navigating and editing large, well-structured codebases. Quick Start Section titled “Quick Start” Recommended: Import shared workflow Section titled “Recommended: Import shared workflow” The preferred way to add Serena is to copy the file shared/mcp/serena.md into your repo and import it into your workflow, which configures the complete MCP server automatically: --- on : issues engine : copilot permissions : contents : read # NOTE: first copy `shared/mcp/serena.md` into your repository before importing it imports : - uses : shared/mcp/serena.md with : languages : [ " go " , " typescript " ] --- For Go-only workflows, use the convenience wrapper (copy shared/mcp/serena-go.md into your repository before importing it): --- on : issues engine : copilot permissions : contents : read # NOTE: first copy `shared/mcp/serena-go.md` into your repository before importing it imports : - shared/mcp/serena-go.md --- The Go wrapper installs pinned gopls v0.22.0 in the runner tool cache and exposes it to Serena through a read-only mount.
Before the agent starts, Serena’s native project health check exercises semantic symbol analysis in the configured container. Installation errors, language-server startup failures, and a four-minute health-check timeout fail preflight with an explicit error. Example: Code Analysis Section titled “Example: Code Analysis” --- engine : copilot permissions : contents : read imports : - uses : shared/mcp/serena.md with : languages : [ " go " ] tools : github : toolsets : [ default ] --- # Code Quality Analyzer Analyze Go code for quality improvements: 1.
Find all exported functions and check for missing documentation 2. Identify code patterns and suggest improvements Language Support Section titled “Language Support” Serena supports 30+ programming languages through Language Server Protocol (LSP): Category Languages Systems C, C++, Rust, Go, Zig JVM Java, Kotlin, Scala, Groovy (partial) Web JavaScript, TypeScript, Dart, Elm Dynamic Python, Ruby, PHP, Perl, Lua Functional Haskell, Elixir, Erlang, Clojure, OCaml Scientific R, Julia, MATLAB, Fortran Shell Bash, PowerShell Other C#, Swift, Nix, Markdown, YAML, TOML Available Tools Section titled “Available Tools” Serena provides semantic code tools organized into three categories: Category Tools Symbol Navigation find_symbol , find_referencing_symbols , get_symbol_definition , list_symbols_in_file Code Editing replace_symbol_body , insert_after_symbol , insert_before_symbol , delete_symbol Project Analysis find_files , get_project_structure , analyze_imports These tools enable agents to work at the symbol level rather than the file level, making code operations more precise and context-aware.
Usage Examples Section titled “Usage Examples” Find Unused Functions Section titled “Find Unused Functions” --- engine : copilot imports : - shared/mcp/serena-go.md tools : github : toolsets : [ default ] --- # Find Unused Code 1. Configure memory: `mkdir -p /tmp/gh-aw/cache-memory/serena` 2. Use `find_symbol` and `find_referencing_symbols` to identify unused exports 3. Report findings Best Practices Section titled “Best Practices” Pre-create the cache directory ( mkdir -p /tmp/gh-aw/cache-memory/serena ) for faster operations — Serena reuses language server indexes across runs.
Pin the key with tools.cache-memory.key: serena-analysis in frontmatter to persist it. Prefer symbol-level operations ( replace_symbol_body ) over file-level edits. Combine Serena with other tools like github , edit , and bash for complete workflows. For large codebases, start with targeted analysis of specific packages before expanding scope. Troubleshooting Section titled “Troubleshooting” Language server not found: For Go, use shared/mcp/serena-go.md to install gopls and check semantic readiness before the agent starts.
Inspect the Expose Go to Serena container and Check Serena Go semantic analysis step logs for installation or startup errors. Other language servers may require additional dependencies. Memory permission issues: Ensure cache directory exists with proper permissions: mkdir -p /tmp/gh-aw/cache-memory/serena && chmod 755 /tmp/gh-aw/cache-memory/serena Slow initial analysis: Expected behavior as language servers build indexes.
Subsequent runs use cached data. Learn More Section titled “Learn More” Imports Reference - Full imports and import-schema syntax Using MCPs - General MCP server configuration Tools Reference - Complete tools configuration Serena GitHub Repository — official repo and documentation Language Support - Supported languages and dependencies Serena Tools Reference - Complete tool documentation