MCP server that renames/moves TypeScript files and updates all imports via tsserver
Ts MCP server is a locally run integration for AI assistants that speak the Model Context Protocol. MCP server that renames/moves TypeScript files and updates all imports via tsserver.
A lightweight Model Context Protocol (MCP) server for TypeScript and JavaScript refactoring and code intelligence. Every tool maps directly to a tsserver protocol command — the output is the raw, unmodified response from TypeScript's compiler. Rename symbols, extract functions, move declarations between files, reorganize imports, navigate type hierarchies, explore call graphs, search symbols across your workspace, map AI-generated code into the right locations, discover which error codes have automatic fixes, and more — with every import, require, re-export, and
The server ships on npm as ts-mcp-server, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.
Once Ts is connected, these are the calls the assistant has available:
Format — format a range of code according to TypeScript's formatting rulesrename — Rename a TypeScript/JavaScript symbol and update all references across the projectrenameFileOrDirectory — Rename or move a TypeScript/JavaScript file or directory and update all import paths across the projectreferences — The references tool exposed by this servergetDiagnostics — Get all errors, warnings, and suggestions for a file. Returns semantic diagnostics and suggestion diagnostics as separate arraysorganizeImports — The organizeImports tool exposed by this servergetCodeFixes — Get available code fixes for specific error codes at a range in a file. Use getDiagnostics first to discover error codes and ranges, then pass themgetCombinedCodeFix — Get a combined code fix that applies all instances of a fix across a file in one action. Returns the full set of file edits as a CombinedCodeActionsextractFunction — Extract a selected code range into a new function. TypeScript auto-detects parameters and return type. The response includes renameFilename /extractConstant — Extract a selected expression into a named constant. TypeScript infers the type. The response includes renameFilename / renameLocation so you canmoveSymbol — Move top-level declarations (functions, classes, types, constants) to another file. All imports across the project are rewired automatically. If theinlineVariable — Inline a variable — replace all references with the variable's initializer and delete the declaration. Position must be on the variable name in itsPlenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Ts's toolset — Format, rename, renameFileOrDirectory and 10 more — is a fair guide to whether it matches your workflow. It is maintained by andyliner13; worth a glance at recent repository activity before you build anything load-bearing on it.
We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.
| Tool | What it does |
|---|---|
| Format | format a range of code according to TypeScript's formatting rules |
| rename | Rename a TypeScript/JavaScript symbol and update all references across the project. |
| renameFileOrDirectory | Rename or move a TypeScript/JavaScript file or directory and update all import paths across the project. |
| references | The references tool exposed by this server. |
| getDiagnostics | Get all errors, warnings, and suggestions for a file. Returns semantic diagnostics and suggestion diagnostics as separate arrays. |
| organizeImports | The organizeImports tool exposed by this server. |
| getCodeFixes | Get available code fixes for specific error codes at a range in a file. Use getDiagnostics first to discover error codes and ranges, then pass them here. |
| getCombinedCodeFix | Get a combined code fix that applies all instances of a fix across a file in one action. Returns the full set of file edits as a CombinedCodeActions response. Use getCodeFixes first to discover available fixId values, th |
| extractFunction | Extract a selected code range into a new function. TypeScript auto-detects parameters and return type. The response includes renameFilename / renameLocation so you can follow up with rename to give the function a meaning |
| extractConstant | Extract a selected expression into a named constant. TypeScript infers the type. The response includes renameFilename / renameLocation so you can follow up with rename to give the constant a meaningful name. |
| moveSymbol | Move top-level declarations (functions, classes, types, constants) to another file. All imports across the project are rewired automatically. If the target file doesn't exist, tsserver creates it. |
| inlineVariable | Inline a variable — replace all references with the variable's initializer and delete the declaration. Position must be on the variable name in its declaration or any usage. |
| extractType | Extract an inline type annotation into a named type alias. Select the type span to extract. The response includes renameFilename / renameLocation so you can follow up with rename to give the type a meaningful name. |
{
"mcpServers": {
"ts": {
"command": "npx",
"args": ["-y", "ts-mcp-server"]
}
}
}Add to claude_desktop_config.json, then restart Claude Desktop.
Kill hallucinated APIs — version-accurate, up-to-date library documentation injected straight into context.
Microsoft's official browser automation server — drive a real browser through the accessibility tree, no screenshots needed.
GitHub's official server — repos, issues, pull requests, Actions and code security, straight from your assistant.
Issue tracking at the speed of conversation — Linear's official hosted server with OAuth and zero install.
Local repository surgery — status, diffs, commits, branches and history for any repo on disk.
Timezone sanity for AI — current time anywhere and correct conversions, without the model doing date math.