Gitmoji Commit MCP

Gitmoji Commit MCP

An MCP server for creating, validating, and formatting Git commits with emojis following the conventional commit standard.

Category
访问服务器

README

Gitmoji Commit MCP

A Model Context Protocol (MCP) server for creating, validating, and formatting Git commits following the emoji-enhanced conventional commit standard.

Overview

This MCP server provides AI assistants with tools to help developers create well-formatted, meaningful commit messages with emojis. It implements a comprehensive commit convention that combines the clarity of conventional commits with the visual appeal of emojis.

Features

  • Automated Commit Formatting: Generate properly formatted commit messages with correct emojis
  • Type Suggestions: Analyze staged changes and suggest appropriate commit types
  • Message Validation: Validate commit messages against convention rules
  • Git Integration: Seamlessly create commits directly from the tools
  • TypeScript: Fully typed implementation for reliability
  • 16 Commit Types: Support for primary and extended commit types

Installation

Global Installation

npm install -g gitmoji-commit-mcp

Local Development

git clone <repository-url>
cd gitmoji-commit-mcp
npm install
npm run build

MCP Server Configuration

Add this server to your MCP client configuration:

Claude Desktop

Edit your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "git-emoji-commit": {
      "command": "npx",
      "args": ["-y", "gitmoji-commit-mcp"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "git-emoji-commit": {
      "command": "gitmoji-commit-mcp"
    }
  }
}

VSCode (Native MCP Support)

VSCode has native MCP support. Edit your VSCode MCP configuration file:

Location: %APPDATA%\Code\User\mcp.json (Windows) or ~/.config/Code/User/mcp.json (macOS/Linux)

{
  "servers": {
    "gitmoji-commit-mcp": {
      "command": "npx",
      "args": ["-y", "gitmoji-commit-mcp"]
    }
  }
}

Or if installed globally (via npm install -g or npm link):

{
  "servers": {
    "gitmoji-commit-mcp": {
      "command": "gitmoji-commit-mcp"
    }
  }
}

VSCode with Continue Extension

If you're using the Continue extension for VSCode, add to your Continue configuration:

Location: ~/.continue/config.json (macOS/Linux) or %USERPROFILE%\.continue\config.json (Windows)

{
  "mcpServers": {
    "git-emoji-commit": {
      "command": "npx",
      "args": ["-y", "gitmoji-commit-mcp"],
      "disabled": false
    }
  }
}

OpenAI Codex

For OpenAI Codex, edit your config file:

Location: ~/.codex/config.toml (macOS/Linux) or %USERPROFILE%\.codex\config.toml (Windows)

[mcp_servers.gitmoji-commit-mcp]
transport = "stdio"
command = "npx"
args = ["-y", "gitmoji-commit-mcp"]
description = "MCP server for creating Git commits with emojis following conventional commit standards"

Or if installed globally (via npm install -g or npm link):

[mcp_servers.gitmoji-commit-mcp]
transport = "stdio"
command = "gitmoji-commit-mcp"
description = "MCP server for creating Git commits with emojis following conventional commit standards"

Other MCP Clients

For any MCP-compatible client that supports the Model Context Protocol:

{
  "servers": {
    "git-emoji-commit": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "gitmoji-commit-mcp"]
    }
  }
}

Note: Configuration file location and format may vary by client. Refer to your specific MCP client's documentation.

Available Tools

1. git_format_message

Format a commit message according to the convention.

Parameters:

  • type (required): Commit type (feat, fix, docs, etc.)
  • title (required): Brief description in imperative mood
  • scope (optional): Context like #123, auth, api
  • description (optional): Detailed explanation
  • breaking (optional): Whether this is a breaking change

Example:

{
  "type": "feat",
  "scope": "auth",
  "title": "add OAuth2 authentication",
  "description": "Implemented OAuth2 flow with Google and GitHub providers.",
  "breaking": false
}

Output:

✨ feat(auth): add OAuth2 authentication

Implemented OAuth2 flow with Google and GitHub providers.

2. git_validate_message

Validate a commit message against the convention.

Parameters:

  • message (required): The commit message to validate

Example:

{
  "message": "✨ feat(auth): add OAuth2 authentication"
}

Output:

✅ Commit message is valid!

3. git_suggest_type

Analyze staged changes and suggest an appropriate commit type.

Parameters:

  • repo_path (optional): Path to the target git repository when MCP server runs outside project directory

Output:

Suggested commit type: ✨ feat

Confidence: high
Reason: Significant additions (245 lines added vs 12 deleted) suggest new feature

Type description: A new feature

4. git_commit

Create a git commit following the convention.

Parameters: Same as git_format_message, plus:

  • repo_path (optional): Path to the target git repository when MCP server runs outside project directory

Output:

✅ Commit created successfully!

Commit hash: abc123def456

Message:
✨ feat(auth): add OAuth2 authentication

Implemented OAuth2 flow with Google and GitHub providers.

Repository Context Resolution

Git tools (git_suggest_type, git_commit) resolve repository context in this order:

  1. repo_path argument from the tool call
  2. MCP request metadata (_meta, if client provides cwd/workspace info)
  3. Environment variables (GITMOJI_REPO_PATH, MCP_REPO_PATH, MCP_WORKSPACE_ROOT, MCP_WORKING_DIR, PROJECT_ROOT, INIT_CWD, PWD)
  4. process.cwd() of the MCP server

If your client starts MCP servers outside your repository, pass repo_path explicitly:

{
  "type": "feat",
  "title": "add OAuth login",
  "repo_path": "C:/Users/Alex/Projects/my-repo"
}

Commit Types

Primary Types

Type Emoji Description
feat ✨ A new feature
fix 🐛 A bug fix
docs 📝 Documentation only changes
style 🎨 Code formatting (no logic change)
refactor ♻️ Code restructuring (no feature/fix)
perf ⚡ Performance improvements
test 🧪 Adding or updating tests
build 📦 Build system/dependencies
ci 👷 CI/CD configuration
chore 🔧 Maintenance tasks
revert ⏪ Revert previous commit

Extended Types

Type Emoji Description
security 🔒 Security fixes
deprecate ⚠️ Deprecation warnings
breaking 💥 Breaking changes
i18n 🌐 Internationalization
a11y ♿ Accessibility improvements
deps ⬆️ Dependency updates

Commit Message Format

<emoji> <type>(<scope>): <title>

<description>

Rules

Title:

  • Use imperative mood: "add feature" not "added feature"
  • Don't capitalize first letter
  • No period at the end
  • Maximum 50 characters

Description:

  • Separate from title with blank line
  • Wrap at 72 characters
  • Explain WHAT and WHY, not HOW

Usage Examples

With AI Assistant

User: "I added a new login feature with OAuth"

AI: Let me analyze your changes and create a commit.
[calls git_suggest_type]
This looks like a new feature. I'll create a commit for you.
[calls git_commit with type='feat', scope='auth', title='add OAuth login']

✅ Created commit: feat(auth): add OAuth login

Manual Tool Use

  1. Stage your changes:
git add src/auth/*
  1. Ask AI to suggest type:
"What type of commit should this be?"
  1. Create the commit:
"Create a commit with type feat, scope auth, and title 'add OAuth2 authentication'"

Development

Project Structure

gitmoji-commit-mcp/
├── src/
│   ├── index.ts          # MCP server entry point
│   ├── types.ts          # Type definitions and commit types
│   ├── utils.ts          # Formatting and validation
│   └── git.ts            # Git operations
├── dist/                 # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md

Build

npm run build

Watch Mode

npm run watch

Testing Locally

For local development without publishing to npm:

  1. Build the project:
npm run build
  1. Link globally (creates a symlink to your local development version):
npm link
  1. Test the server:
gitmoji-commit-mcp

The server communicates via stdio and expects MCP protocol messages.

After running npm link, you can use the simplified "installed globally" configuration in all MCP clients (see configuration examples above). The symlink ensures your local changes are reflected immediately after rebuilding - no need to republish or reinstall!

Integration

With Claude Desktop

Once configured, Claude can automatically use these tools when you ask questions like:

  • "Create a commit for my changes"
  • "What type of commit should this be?"
  • "Validate my commit message"
  • "Format a commit for adding authentication"

With VSCode (Continue Extension)

The Continue extension brings AI assistance directly into VSCode with MCP support. After configuration, you can:

  • Ask Continue to analyze your staged changes and suggest commit types
  • Request formatted commit messages directly in the editor
  • Validate commit messages before committing
  • Use natural language to create commits: "Commit these changes as a bug fix"

Usage: Press Cmd+L (macOS) or Ctrl+L (Windows/Linux) to open Continue, then interact with the MCP tools.

With Other MCP Clients

Any MCP-compatible client can use this server:

  • Zed Editor: Configure in MCP settings for AI-assisted commits
  • Custom MCP Clients: Use the stdio transport protocol
  • API Integrations: Connect via the Model Context Protocol specification

Add it to your client's server configuration with the appropriate command and args. The server uses stdio transport and follows the standard MCP protocol.

Validation Rules

The validator checks for:

  • Required Format: <emoji> <type>(<scope>): <title>
  • Valid Types: Must be one of the defined commit types
  • Emoji Match: Emoji must match the commit type
  • Title Length: Recommended max 50 characters
  • Title Case: Should start with lowercase
  • Title Period: Should not end with period
  • Imperative Mood: Basic check for common mistakes
  • Description Format: Blank line after title, 72 char lines

Type Suggestion Algorithm

The git_suggest_type tool analyzes:

  1. File Types: Documentation, tests, configs, CI files
  2. File Patterns: Build files, dependencies, source code
  3. Change Ratio: Additions vs deletions
  4. Change Volume: Total lines changed

Returns suggestion with confidence level (high/medium/low).

Error Handling

All tools provide clear error messages:

  • No staged changes for commit
  • Invalid commit type
  • Malformed commit message
  • Git operation failures

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT

Support

For issues, questions, or contributions, please visit the GitHub repository.

Changelog

1.0.0 (2025-02-06)

  • Initial release
  • Four MCP tools: format, validate, suggest, commit
  • Support for 16 commit types
  • TypeScript implementation
  • Git integration with simple-git
  • Comprehensive validation and formatting

Related


Made with ❤️ for better Git commits

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选