
stefan-nitu/mcp-refactor-typescript
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
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:
インストール
npx -y mcp-refactor-typescript設定
{
"mcpServers": {
"mcp-refactor-typescript": {
"command": "npx",
"args": ["-y", "mcp-refactor-typescript"]
}
}
}