Skip to content

seolcu/commit-renamer-mcp

Repository files navigation

Commit Renamer MCP

An MCP (Model Context Protocol) server that enables AI agents to safely rename Git commit messages.

NPM Version License: MIT

Quick Start

No local installation needed:

npx @seolcu/commit-renamer-mcp

Installation

One-Click Installation (Recommended)

Install in VS Code Install in VS Code Insiders Install in Cursor Install in Windsurf

Manual Installation

Claude Desktop

Edit your config file:

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

Cursor

Edit ~/.cursor/mcp_settings.json:

{
  "mcpServers": {
    "commit-renamer": {
      "command": "npx",
      "args": ["-y", "@seolcu/commit-renamer-mcp"]
    }
  }
}

VSCode / VSCode Insiders

Edit your settings:

  • VSCode: ~/.vscode/mcp_settings.json
  • VSCode Insiders: ~/.vscode-insiders/mcp_settings.json
{
  "mcpServers": {
    "commit-renamer": {
      "command": "npx",
      "args": ["-y", "@seolcu/commit-renamer-mcp"],
      "type": "stdio"
    }
  }
}

Windsurf

Edit ~/.windsurf/mcp_settings.json:

{
  "mcpServers": {
    "commit-renamer": {
      "command": "npx",
      "args": ["-y", "@seolcu/commit-renamer-mcp"]
    }
  }
}

Cline (VSCode Extension)

Edit VSCode settings (settings.json):

{
  "cline.mcpServers": {
    "commit-renamer": {
      "command": "npx",
      "args": ["-y", "@seolcu/commit-renamer-mcp"]
    }
  }
}

Gemini CLI

Add to your Gemini CLI config:

gemini mcp add commit-renamer npx -y @seolcu/commit-renamer-mcp

OpenCode

Edit ~/.opencode/mcp_settings.json:

{
  "mcpServers": {
    "commit-renamer": {
      "command": "npx",
      "args": ["-y", "@seolcu/commit-renamer-mcp"]
    }
  }
}

Global Installation

npm install -g @seolcu/commit-renamer-mcp

From Source

git clone https://github.com/seolcu/commit-renamer-mcp.git
cd commit-renamer-mcp
npm install
npm run build

Features

This MCP server provides the following tools:

list_commits

List recent commits in the repository.

Parameters:

  • count (number, optional): Number of commits to list (1-100, default: 10)
  • cwd (string, optional): Working directory (default: current directory)

Returns:

{
  "commits": [
    {
      "hash": "full commit hash",
      "shortHash": "short hash",
      "message": "commit message",
      "author": "author name",
      "date": "commit date"
    }
  ]
}

get_repo_status

Check the current repository status.

Parameters:

  • cwd (string, optional): Working directory

Returns:

{
  "branch": "current branch name",
  "isClean": true,
  "hasUncommittedChanges": false,
  "isRebaseInProgress": false
}

preview_rename

Preview commit message changes without actually applying them.

Parameters:

  • commit_hash (string, required): Commit hash to rename (full or short)
  • new_message (string, required): New commit message
  • cwd (string, optional): Working directory

Returns:

{
  "commit": {
    "hash": "commit hash",
    "shortHash": "short hash",
    "currentMessage": "current message",
    "newMessage": "new message",
    "author": "author",
    "date": "date"
  },
  "canProceed": true,
  "warnings": ["warning messages"]
}

rename_commit

Actually rename a commit message. Warning: This rewrites Git history!

Parameters:

  • commit_hash (string, required): Commit hash to rename
  • new_message (string, required): New commit message
  • force (boolean, optional): Bypass safety checks (default: false)
  • cwd (string, optional): Working directory

Returns:

{
  "success": true,
  "oldHash": "old hash",
  "newHash": "new hash",
  "newMessage": "new message",
  "warnings": ["warning messages"]
}

undo_rename

Undo the last commit message change using git reflog.

Parameters:

  • cwd (string, optional): Working directory

Returns:

{
  "success": true,
  "message": "Successfully reverted to previous state using reflog"
}

Safety Features

This tool provides several safety mechanisms:

  1. Working Directory Check: Refuses to operate if there are uncommitted changes
  2. Rebase Status Check: Refuses to operate if a rebase is in progress
  3. Remote Push Check: By default, prevents changing commits that have been pushed to remote (can be bypassed with force=true)
  4. Preview Feature: See what will happen before making actual changes
  5. Undo Feature: Revert changes using reflog if you make a mistake

Important Warnings

Renaming commits rewrites Git history!

  • Only use on branches you work on alone
  • Rewriting history on shared branches can cause serious problems
  • After changing pushed commits, you'll need git push --force
  • Always use preview_rename first to verify changes

Development

Build and Run

# Run in development mode
npm run dev

# Build
npm run build

# Start production
npm start

Quality Checks

# Run all quality checks (typecheck + lint + format + test)
npm run quality

# Individual checks
npm run typecheck     # TypeScript type checking
npm run lint          # ESLint checking
npm run format        # Prettier formatting
npm test              # Run tests

See CONTRIBUTING.md for more details.

Quality Assurance

  • TypeScript Strict Mode: Type safety guaranteed
  • ESLint: Automated code quality checks
  • Prettier: Consistent code style
  • Vitest: 13 unit tests (100% passing)
  • Production Ready: All quality checks passing

License

MIT

Contributing

Issues and PRs are always welcome! See Contributing Guide for details.

About

MCP server for safely renaming Git commit messages with AI agent support

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published