Skip to content

Instantly share code, notes, and snippets.

@jadatkins
Created September 16, 2025 11:57
Show Gist options
  • Select an option

  • Save jadatkins/cbcfa38418bb0cbbf3eee95a40403f81 to your computer and use it in GitHub Desktop.

Select an option

Save jadatkins/cbcfa38418bb0cbbf3eee95a40403f81 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh -ex
# Check that current working directory is inside a git project, and cd to the root directory
git rev-parse --verify HEAD > /dev/null
cd "$(git rev-parse --show-toplevel)"
# Add project to Rails MCP server configuration if not already present
project_name="${PWD:t}"
grep "^${project_name}:" "$HOME/.config/rails-mcp/projects.yml" || echo "${project_name}: \"$(pwd)\"" >> "$HOME/.config/rails-mcp/projects.yml"
# Add the Serena MCP server to Claude Code configuration for this project
if ! claude mcp list | grep serena
then
claude mcp add --scope local Serena -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project "$(pwd)"
fi
# Tell Serena to index the project
uvx --from git+https://github.com/oraios/serena serena project index
# Tell Claude to explore the repository and populate Serena's memories
claude --print "Switch to Rails project '$project_name' using mcp__Rails__switch_project, and then perform onboarding with Serena, using mcp__Rails__project_info and mcp__Serena__onboarding." --verbose --allowedTools 'mcp__Serena,mcp__Rails'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment