Ts MCP Server

MCP server that renames/moves TypeScript files and updates all imports via tsserver

Local serverstdioTypeScript

What is the Ts MCP server?

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.

What you get

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

Setting it up

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.

What the assistant can call

Once Ts is connected, these are the calls the assistant has available:

  • 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
  • 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
  • extractFunction — 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 can
  • moveSymbol — Move top-level declarations (functions, classes, types, constants) to another file. All imports across the project are rewired automatically. If the
  • 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

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 13 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Ts.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the ts mcp server does with a few real requests.

Choosing this one

Plenty 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.

Available tools

ToolWhat it does
Formatformat a range of code according to TypeScript's formatting rules
renameRename a TypeScript/JavaScript symbol and update all references across the project.
renameFileOrDirectoryRename or move a TypeScript/JavaScript file or directory and update all import paths across the project.
referencesThe references tool exposed by this server.
getDiagnosticsGet all errors, warnings, and suggestions for a file. Returns semantic diagnostics and suggestion diagnostics as separate arrays.
organizeImportsThe organizeImports tool exposed by this server.
getCodeFixesGet 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.
getCombinedCodeFixGet 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
extractFunctionExtract 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
extractConstantExtract 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.
moveSymbolMove 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.
inlineVariableInline 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.
extractTypeExtract 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.

How to install the Ts MCP server

{
  "mcpServers": {
    "ts": {
      "command": "npx",
      "args": ["-y", "ts-mcp-server"]
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Example prompts to try

  • Use Ts to Format.
  • Use Ts to rename.
  • Use Ts to renameFileOrDirectory.

Frequently asked questions

It connects Ts to MCP-compatible AI assistants such as Claude and Cursor, exposing 13 tools (Format, rename, renameFileOrDirectory, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Ts directly.