MCP ExplorerExplorer

Typescript Migrator Mcp

@LiangYingCon 12 days ago
1 MIT
FreeCommunity
AI Systems
An AI assistance tool that converts JavaScript files to TypeScript while preserving code logic and following best practices.

Overview

What is Typescript Migrator Mcp

typescript-migrator-mcp is an AI assistance tool designed to intelligently convert JavaScript files to TypeScript while preserving the original code logic and adhering to best practices.

Use cases

Common use cases include converting existing JavaScript projects to TypeScript, enhancing code quality through type annotations, and maintaining legacy code while adopting modern TypeScript practices.

How to use

To use typescript-migrator-mcp, configure it within your AI coding assistant (like Cursor) and then request the conversion of JavaScript files to TypeScript by providing specific commands.

Key features

Key features include automatic conversion from JavaScript to TypeScript, smart type inference based on context, preservation of original code logic and comments, support for custom conversion rules, multi-language support, and handling of complex type definitions and module imports.

Where to use

typescript-migrator-mcp can be used in software development environments where JavaScript codebases need to be migrated to TypeScript for improved type safety and maintainability.

Content

TypeScript Migrator MCP

This MCP server let you easily converts JavaScript files to TypeScript with AI agent.

Setup

Add the following configuration to your MCP settings JSON:

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

Usage

Once configured, your AI agent can convert JavaScript files to TypeScript by calling the conversion tool with a file path:

Convert @test/myFile.js to TypeScript

The tool will:

  1. Analyze the JavaScript file and its dependencies
  2. Generate appropriate TypeScript types and interfaces
  3. Preserve original logic while adding type safety
  4. Ensure lint and type errors are fixed
  5. Summarize the work of AI

Configuration

Custom Rules

To add your own conversion rules, create a custom markdown file with your rules and specify its path in the environment configuration:

{
  "mcpServers": {
    "typescript-migrator-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "typescript-migrator-mcp"
      ],
      "env": {
        "CUSTOM_RULES_MD_FILE_PATH": "/path/to/your/custom-rules.md"
      }
    }
  }
}

License

Apache 2.0

Tools

No tools

Comments