- Home
- MCP servers
- TS Refactor
TS Refactor
- typescript
0
GitHub Stars
typescript
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"schicks-ts-refactor-mcp": {
"command": "npx",
"args": [
"ts-refactor-mcp"
]
}
}
}You can use this MCP server to let AI coding agents move TypeScript files while automatically updating all related imports. It brings the same seamless import updates you get from the TypeScript language server into AI workflows, so moves happen in one atomic operation without broken references.
How to use
You interact with the server through an MCP client in your AI workflow. Use the available tools to move files or pre-load a project, and rely on atomic operations so all imports are updated consistently before the file is moved.
How to install
Prerequisites you need on your machine before installing this MCP server.
- Node.js 18.0.0 or newer
- A TypeScript project with tsconfig.json and TypeScript installed in node_modules
- A functioning MCP client to connect to the server
Install the MCP server package from npm (preferred method):
npm install ts-refactor-mcp
Or install from source and build locally:
git clone https://github.com/schicks/ts-refactor-mcp.git
cd ts-refactor-mcp
npm install
npm run build
Configure how your MCP client connects to the server. You have two explicit options shown below. Use the one that matches your setup.
{
"mcpServers": {
"ts-refactor": {
"command": "npx",
"args": ["ts-refactor-mcp"]
}
}
}
{
"mcpServers": {
"ts-refactor": {
"command": "node",
"args": ["/path/to/ts-refactor-mcp/dist/index.js"]
}
}
}
Additional configuration notes
The server exposes a stdio-based MCP endpoint you can run locally. If you installed via npm, you can rely on the npm script path; if you built from source, use the built JavaScript entry under dist.
Configuration examples
Move a TypeScript file and update all imports atomically using the moveFile tool. You can preview edits with a dry run before applying.
{
"projectRoot": "/home/user/my-project",
"oldPath": "/home/user/my-project/src/utils/helper.ts",
"newPath": "/home/user/my-project/src/lib/helper.ts",
"dryRun": false
}
Performance and usage notes
Initial warmup may take 5-30 seconds for large projects. After warmup, subsequent moves complete in roughly 10-100 milliseconds. The server keeps a persistent tsserver process to speed up repeated operations.
Project structure and environment
The server uses your project’s TypeScript version from node_modules and does not attempt to manage project-wide state beyond tsserver persistence.
Troubleshooting and tips
If you encounter sync issues, run warmup again to reinitialize the internal tsserver state. Remember that this MCP server is designed for single-project use at a time.
Notes on capabilities
This MCP server focuses on TypeScript-aware file moves and import updates. It does not yet support directory moves or JavaScript-only projects.
What you can automate with MCP tools
Two core capabilities are exposed as tools: moveFile moves a TS file and updates imports atomically, and warmup preloads a TypeScript project to speed up later requests.
Available tools
moveFile
Move a TypeScript file and update all imports automatically.
warmup
Pre-load a TypeScript project to speed up subsequent operations.