ts-morph Refactoring Tools

ts-morph Refactoring Tools is an MCP server that provides AST-based refactoring operations for TypeScript and JavaScript projects using the ts-morph library. It connects MCP-compatible AI clients to the TypeScript compiler API and ts-morph AST engine, allowing developers and automated agents to execute precise codebase modifications while maintaining overall project integrity. The server provides tools to safely rename symbols across all references, rename files and directories while automatically updating import and export statements, and move individual declarations between files along with their internal dependencies. It also enables checking inferred types at specific positions, altering function signatures across all calling sites, replacing path aliases with relative paths, and auditing codebases for unused exports. By relying on compiler-level abstract syntax tree analysis rather than naive text replacements, ts-morph Refactoring Tools allows software engineers and coding assistants to carry out complex architectural migrations and structural cleanups safely without breaking project references or introducing syntax issues.

Category: Developer Tools & Code Intelligence

Tags: code analysis, javascript, refactoring, ts-morph, typescript

Visit ts-morph Refactoring Tools

How to install and configure ts-morph Refactoring Tools

  1. Ensure you have Node.js and an MCP-compatible client installed. 2. Open your client configuration file (such as mcp.json). 3. Add the server under the mcpServers block using npx: json { "mcpServers": { "mcp-tsmorph-refactor": { "command": "npx", "args": ["-y", "@sirosuzume/mcp-tsmorph-refactor"], "env": {} } } } 4. Optional: Configure logging by adding LOG_LEVEL (e.g., debug), LOG_OUTPUT (console or file), and LOG_FILE_PATH to the env object. 5. Restart your MCP client to load the tools.

What you can do with ts-morph Refactoring Tools

  • Renaming symbols across an entire project while keeping all import statements and usages synchronized using AST-level analysis. - Moving functions, classes, or interfaces to separate files along with internal dependencies while rewriting import and export paths. - Changing function signatures across an entire codebase by adding, removing, or reordering parameters and updating all caller arguments. - Renaming multiple files or directories and converting module import paths or path aliases to correct relative paths. - Finding unused exports and inspecting inferred TypeScript types at specific code coordinates without manually running the TypeScript compiler.

Key facts

  • Open Source
  • https://github.com/SiroSuzume/mcp-ts-morph
  • Developer Tools & Code Intelligence
  • code analysis, javascript, refactoring, ts-morph, typescript

Part of MCP Servers

Related MCP servers

  • MCP LaTeX Server — MCP LaTeX Server is an MCP server that provides tools for creating, editing, validating, and compiling LaTeX documents directly through…
  • MCP JSON — MCP JSON is an MCP server collection that bundles tools for file system operations, Google search, browser-based web automation, and…
  • MCP Jupyter Complete — MCP Jupyter Complete is an MCP server that provides tools for manipulating Jupyter notebook files through position-based cell operations and…
  • MCP LSP Go — MCP LSP Go is an MCP server that connects AI assistants to the official Go Language Server Protocol implementation, gopls,…
  • MCP Manager — MCP Manager is an MCP server management tool that connects directly to your Claude Desktop environment, enabling users to discover,…
  • MCP Lab — MCP Lab is an MCP server development environment designed for building, testing, and debugging custom Model Context Protocol servers integrated…

How do I install ts-morph Refactoring Tools?

You can add it directly to your MCP client configuration file, such as mcp.json, under the mcpServers property. Set the command to npx and pass the arguments -y and @sirosuzume/mcp-tsmorph-refactor. No manual global installation is required.

What can ts-morph Refactoring Tools do?

It provides tools to refactor TypeScript and JavaScript code using ts-morph. You can rename symbols, rename files and directories, move declarations between files, update function call signatures, inspect inferred types at specific locations, convert path aliases to relative paths, and scan for unused exports.

Which MCP clients work with ts-morph Refactoring Tools?

It works with any MCP-compliant client that supports standard I/O server configurations. This includes Claude Desktop, Cursor, and developer debugging tools like MCP Inspector.

Is ts-morph Refactoring Tools open source?

Yes, ts-morph Refactoring Tools is an open source project available on GitHub under the repository SiroSuzume/mcp-ts-morph.

Does ts-morph Refactoring Tools require a tsconfig.json file?

Yes, every tool provided by this MCP server requires the path to your project tsconfig.json file so that the ts-morph engine can accurately parse the abstract syntax tree and resolve type definitions across the codebase.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories