npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@imenam/refactoring-mcp

v3.4.1

Published

MCP server to copy or move code blocks between files, with optional directory confinement.

Readme

@imenam/refactoring-mcp

An MCP (Model Context Protocol) server that lets AI agents copy or move blocks of code between files, with optional directory confinement for safety.

Tools

move_or_copy_code

Copies or moves a range of lines from a source file to a destination file.

| Parameter | Type | Required | Description | |---|---|---|---| | sourceFile | string | ✅ | Absolute path to the source file | | startLine | number | ✅ | Start line of the block (1-indexed) | | endLine | number | ✅ | End line of the block, inclusive (1-indexed) | | operationType | "copy" \| "cut" | ✅ | copy keeps the source intact, cut removes the lines | | destinationFile | string | ✅ | Absolute path to the destination file (created automatically if it doesn't exist) | | destinationLine | number | ❌ | Line at which to insert in the destination (appended at end by default) |

get_file_outline

Returns the list of top-level symbols in a file (functions, classes, interfaces, types, constants, methods) with their start and end line numbers. Useful for identifying the exact coordinates of a code block before moving it.

| Parameter | Type | Required | Description | |---|---|---|---| | filePath | string | ✅ | Absolute path to the file to analyse |

compare_code_sections

Compares two code sections from two files (delimited by line numbers) and returns a unified diff in git format. Useful for verifying that a block of code was correctly copied from one file to another. Leading and trailing blank lines in each section are ignored to avoid false positives from positioning differences.

| Parameter | Type | Required | Description | |---|---|---|---| | fileA | string | ✅ | Absolute path to the first file | | startLineA | number | ✅ | Start line of the section in file A (1-indexed) | | endLineA | number | ✅ | End line of the section in file A, inclusive (1-indexed) | | fileB | string | ✅ | Absolute path to the second file | | startLineB | number | ✅ | Start line of the section in file B (1-indexed) | | endLineB | number | ✅ | End line of the section in file B, inclusive (1-indexed) |

Returns "Les sections sont identiques." when no differences are found, or a unified diff with real file line numbers otherwise.

Configuration

All file paths must be absolute. Relative paths are rejected.

To restrict operations to a specific directory, set the REFACTORING_ALLOWED_DIR environment variable. Any attempt to access a file outside that directory will be blocked.

# .env
REFACTORING_ALLOWED_DIR=C:/Users/you/my-project

Installation

npm install -g @imenam/refactoring-mcp

Or use it directly with npx:

{
  "refactoring-mcp": {
    "command": "npx",
    "args": ["-y", "@imenam/refactoring-mcp"]
  }
}

Or point to a local build:

{
  "refactoring-mcp": {
    "command": "node",
    "args": ["/absolute/path/to/refactoring-mcp/dist/index.js"],
    "env": {
      "REFACTORING_ALLOWED_DIR": "/absolute/path/to/your/project"
    }
  }
}

License

MIT