Quick setup
Run the bootstrap command from anywhere:Manual MCP setup
Manual MCP setup
If you prefer to configure MCP yourself:For Cursor IDE:
- Open your IDE MCP settings.
- Add the following MCP server entry:
- Open Cursor Settings
- Navigate to MCP & Integrations
- Click New MCP Server under MCP Tools
Available tools
The Codemod MCP server provides these operational tools for AI assistants:dump_ast- Dump AST nodes in an AI-friendly format for given source code and languageget_node_types- Get compressed tree-sitter node types for specific programming languagesrun_jssg_tests- Run tests for JSSG codemods with test casesvalidate_codemod_package- Validate whether a codemod package is still a starter scaffold or incomplete
Available resources
The Codemod MCP server provides these guidance resources for AI assistants:jssg-instructions- Docs-backed JSSG guidance for creating and testing transformation scriptsjssg-gotchas- Highest-priority JSSG gotchas before implementing transformsast-grep-gotchas- Highest-priority ast-grep gotchas before implementing transformsjssg-utils-instructions- Docs-backed import utility guidance forgetImport,addImport, andremoveImportjssg-runtime-capabilities-instructions- Runtime and capability guidance for LLRT/Node APIs and multi-file JSSG workcodemod-cli-instructions- Docs-backed CLI, package, and workflow guidancecodemod-creation-workflow-instructions- Docs-backed codemod authoring workflow guidance with a small local supplementcodemod-troubleshooting-instructions- Troubleshooting guidance for common Codemod CLI failurescodemod-maintainer-monorepo-instructions- Maintainer guidance for codemod monorepos and version-hop workspacessharding-instructions- Docs-backed sharding guidance
codemod-creation-workflow-instructions, then read jssg-gotchas and ast-grep-gotchas before writing source-transform code.
When registry discovery does not find an exact package, agents should scaffold with direct codemod init. In non-interactive flows, agents should pass only values supplied by the user or task and rely on the CLI defaults/auth-derived author handling for optional metadata.
Why use Codemod MCP?
Codemod MCP democratizes code transformation by integrating robust deterministic engines into AI-powered development workflows:- Individual Developers: Take care of repetitive refactors without manual effort
- Accessibility: Makes tackling tech debt more approachable for developers of all skill levels
- AI Integration: Seamlessly integrates deterministic code transformation engines into AI IDE workflows
Best practices
When working with AI assistants through Codemod MCP, follow these guidelines for better results:Be specific about output format
Tell the AI exactly what type of codemod you want:
- jssg: TypeScript-based transformation scripts (codemods) that operate on ASTs generated by ast-grep, allowing you to transform code in any supported language.
- ast-grep YAML rule: general-purpose transformations
- shell workflow: complex multi-step migrations
Provide clear requirements
Describe your transformation in plain language with concrete examples:
- Show before/after code snippets
- Specify edge cases to handle or avoid
- Include any constraints or special conditions
Anonymous platform feedback
Codemod AI and MCP can submit short anonymous platform feedback when the user has explicitly consented. Agents must ask before enabling or submitting feedback. After the user consents, submit categorized feedback with:jssg: JSSG feature requests, runtime gaps, or transform-authoring frictionworkflow: workflow feature requests or workflow authoring frictionai-docs: AI docs resources that should be added, clarified, or reorganizedmcp: MCP tool, resource, or server behavior feedbackcli: CLI command or setup feedbackregistry: registry discovery or package metadata feedbackpackage-validation: package validation checks that should be added or refinedother: feedback that does not fit the categories above
Troubleshooting
Server won't start
Server won't start
If the MCP server fails to start:
- Ensure you have Node.js 16.0.0 or higher installed
- Try running
npx codemod@latest mcpmanually to test
Tools not available
Tools not available
If MCP tools aren’t showing up:
- Restart your AI client after adding the MCP server
- Check the MCP server logs for error messages
- Verify the JSON configuration syntax is correct
- Ensure your AI client supports Model Context Protocol
Performance issues
Performance issues
For slow performance:
- More complex transformations may take longer to build
- Consider using specific file patterns to limit analysis scope
- Check system resources and network connectivity
- Use faster models if available