SN

stefan-nitu/mcp-refactor-typescript

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

13 stars 8 forks 품질 80 트렌드 34MIT

An MCP server that gives MCP clients TypeScript's own refactorings: rename symbols, move files and declarations, extract functions and constants, organize imports and apply quick fixes.

개요

An MCP server that gives MCP clients TypeScript's own refactorings: rename symbols, move files and declarations, extract functions and constants, organize imports and apply quick fixes. It drives tsserver, the TypeScript language service editors use, so TypeScript computes every edit; the server writes the edits to disk and reports each one. - Renames and moves update imports and references across the project. - Every operation that edits files accepts preview: true, which returns the edits without writing them. - Each response lists the changed files and every edit: line, column, old text, new text. This installs the mcp-refactor-typescript command. You can also run the server through npx without installing it (see Quick Start). The server runs on Node.js 18 or later. Developing it needs Bun 1.3.8 or later. Your project does not need TypeScript installed: the server ships TypeScript 6.0.

README

원문 README의 일부입니다. 원문 보기.

MCP Refactor TypeScript

An MCP server that gives MCP clients TypeScript’s own refactorings: rename symbols, move files and declarations, extract functions and constants, organize imports and apply quick fixes. It drives tsserver, the TypeScript language service editors use, so TypeScript computes every edit; the server writes the edits to disk and reports each one.

  • Renames and moves update imports and references across the project.
  • Every operation that edits files accepts preview: true, which returns the edits without writing them.
  • Each response lists the changed files and every edit: line, column, old text, new text.

Installation

npm install -g mcp-refactor-typescript

This installs the mcp-refactor-typescript command. You can also run the server through npx without installing it (see Quick Start).

From source:

git clone https://github.com/Stefan-Nitu/mcp-refactor-typescript.git
cd mcp-refactor-typescript
bun install
bun run build

The server runs on Node.js 18 or later. Developing it needs Bun 1.3.8 or later.

Which TypeScript it uses

Your project does not need TypeScript installed: the server ships TypeScript 6.0. When a typescript package resolves from the directory the server was launched in, that copy is used instead, so edits match the version the project compiles with; TypeScript 4.9 and later work. TypeScript 7 no longer ships tsserver, so a project on 7 gets the bundled 6.0.

The project should have a tsconfig.json: tsserver uses it to know which files belong to the project.

Quick Start

Claude Desktop

Add the server to Claude Desktop’s configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "mcp-refactor-typescript": {
      "command": "npx",
      "args": ["-y", "mcp-refactor-typescript"]
    }
  }
}

If you installed it globally:

{
  "mcpServers": {
    "mcp-refactor-typescript": {
      "command": "mcp-refactor-typescript"
    }
  }
}

Restart Claude Desktop to load it.

MCP Inspector

Try the tools interactively in the MCP Inspector:

npx @modelcontextprotocol/inspector npx -y mcp-refactor-typescript

If you installed it globally:

GitHub에서 전체 README 보기

설치

npx -y mcp-refactor-typescript
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "mcp-refactor-typescript": { "command": "npx", "args": ["-y", "mcp-refactor-typescript"] } } }