
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@refaktor/mcp-server
Advanced tools
MCP (Model Context Protocol) server for Refaktor - smart case-aware search and replace
MCP (Model Context Protocol) server for Refaktor - enabling AI agents to perform smart, case-aware search and replace operations across codebases.
Refaktor CLI must be installed and available in your PATH:
# Download from GitHub releases or build from source
cargo install refaktor
Node.js 18+ is required
npm install -g @refaktor/mcp-server
Or use directly with npx:
npx @refaktor/mcp-server
Add to your MCP client configuration (e.g., for Claude Desktop or Cursor):
{
"mcpServers": {
"refaktor": {
"command": "npx",
"args": ["@refaktor/mcp-server"]
}
}
}
Or if installed globally:
{
"mcpServers": {
"refaktor": {
"command": "refaktor-mcp"
}
}
}
refaktor_plan
Create a refactoring plan to replace identifiers across a codebase with case-awareness.
Parameters:
old
(required): The old name/identifier to replacenew
(required): The new name/identifier to replace withincludes
: Array of glob patterns for files to includeexcludes
: Array of glob patterns for files to excludestyles
: Array of case styles to detect (snake, camel, pascal, kebab, etc.)previewFormat
: Output format - table
, diff
, json
, or summary
(default: summary)dryRun
: If true, only preview without creating plan filerenameFiles
: Whether to rename files (default: true)renameDirs
: Whether to rename directories (default: true)Example Usage (by AI agent):
Tool: refaktor_plan
Arguments: {
"old": "user_name",
"new": "customer_name",
"includes": ["src/**/*.ts"],
"excludes": ["node_modules/**"],
"styles": ["snake", "camel", "pascal"],
"previewFormat": "summary"
}
refaktor_apply
Apply a refactoring plan to make the actual changes.
Parameters:
planId
: Plan ID to apply (uses latest if not specified)planPath
: Path to plan fileatomic
: Apply changes atomically (default: true)commit
: Create a git commit after applying (default: false)Example Usage (by AI agent):
Tool: refaktor_apply
Arguments: {
"atomic": true,
"commit": true
}
refaktor_undo
Undo a previously applied refactoring.
Parameters:
id
(required): History ID to undoExample Usage (by AI agent):
Tool: refaktor_undo
Arguments: {
"id": "abc123def456"
}
refaktor_redo
Redo a previously undone refactoring.
Parameters:
id
(required): History ID to redorefaktor_history
Show refactoring history.
Parameters:
limit
: Number of history entries to show (default: 10)refaktor_status
Show current refaktor status and pending plans.
refaktor_preview
Preview a plan without applying it.
Parameters:
planId
: Plan ID to previewplanPath
: Path to plan file to previewformat
: Preview format - table
, diff
, json
, or summary
Note: The examples below show how AI agents call MCP tools through the MCP protocol. These are not JavaScript function calls - they represent the tool name and arguments that the AI agent sends to the MCP server.
Plan First, Apply Later
Always create a plan first to review changes:
1. Use refaktor_plan to see what will change
2. Review the summary carefully
3. Use refaktor_preview with different formats if needed
4. Only then use refaktor_apply
Use Appropriate Preview Formats
summary
: Best for AI agents - simple, structured outputdiff
: See exact line-by-line changestable
: Human-readable tabular formatjson
: Full structured data for processingSafety Features
Start with Dry Runs Always test first by using the dry run option:
Tool: refaktor_plan
Arguments: {
"old": "oldName",
"new": "newName",
"dryRun": true,
"previewFormat": "summary"
}
Use Specific Includes Target specific directories/files to avoid unintended changes:
Tool: refaktor_plan
Arguments: {
"old": "oldName",
"new": "newName",
"includes": ["src/**/*.ts", "lib/**/*.js"],
"excludes": ["**/*.test.ts", "node_modules/**"]
}
Check Status Before Applying Always check what's pending before applying changes:
Tool: refaktor_status
Arguments: {}
Then if everything looks good:
Tool: refaktor_apply
Arguments: {}
Handle Errors Gracefully
Tool: refaktor_plan
Arguments: {
"old": "UserProfile",
"new": "CustomerProfile",
"includes": ["src/**/*.tsx", "src/**/*.ts"],
"styles": ["pascal", "camel"],
"renameFiles": true
}
Tool: refaktor_plan
Arguments: {
"old": "user_accounts",
"new": "customer_accounts",
"includes": ["migrations/**/*.sql", "models/**/*.js"],
"styles": ["snake"],
"renameFiles": false
}
Note: renameFiles is false to preserve migration file names
Tool: refaktor_plan
Arguments: {
"old": "get-user",
"new": "get-customer",
"includes": ["api/**/*.js", "tests/**/*.js"],
"styles": ["kebab", "camel", "snake"]
}
npm run build
npm test
npm run dev
refaktor
binary is in your PATHrefaktor --version
atomic: false
to skip problematic filesMIT - See LICENSE file for details
Contributions are welcome! Please see the main Refaktor repository for contribution guidelines.
FAQs
MCP (Model Context Protocol) server for Refaktor - smart case-aware search and replace
We found that @refaktor/mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.