Contributing to Unity MCP Server
January 27, 2026 · View on GitHub
English | 日本語
Thank you for your interest in contributing to Unity MCP Server! This document provides guidelines and instructions for contributing to the project.
Table of Contents
- Development Setup
- Git Workflow
- Commit Message Format
- Git Hooks (Husky)
- Test-Driven Development (TDD)
- Pull Request Process
- Code Guidelines
Development Setup
Prerequisites
- Unity 2020.3 LTS or newer
- Node.js 18.x / 20.x / 22.x LTS (23+ not supported)
- Git
Quick Start
# Clone the repository
git clone https://github.com/akiojin/unity-mcp-server.git
cd unity-mcp-server
# Enable Corepack (recommended) or install pnpm manually
corepack enable
# corepack prepare pnpm@9.15.4 --activate
# Install dependencies (pnpm is required; see packageManager in package.json)
pnpm install --frozen-lockfile
# Run tests
pnpm -C mcp-server test
# Verify installation
node mcp-server/bin/unity-mcp-server --version
Developer Setup (C# LSP)
End users do not need .NET. The MCP server auto-provisions a self-contained C# LSP by tag. As a contributor, you can build it locally if needed:
# Requires .NET 9 SDK
dotnet publish csharp-lsp/Server.csproj -c Release -r <rid> --self-contained true -p:PublishSingleFile=true -o out/<rid>
# Copy to tools directory
cp out/<rid>/server ~/.unity/tools/csharp-lsp/<rid>/server
Git Workflow
This project follows a feature branch workflow with develop as the integration branch:
Branch Naming
| Pattern | Purpose |
|---|---|
feature/* | New features |
bugfix/* | Bug fixes |
hotfix/* | Critical fixes |
Workflow
-
Create a feature branch from
develop:git checkout develop git pull origin develop git checkout -b feature/your-feature-name -
Make changes following TDD (tests first)
-
Commit using Conventional Commits format
-
Push and create a Pull Request to
develop
Commit Message Format
This project uses Conventional Commits for automated versioning and changelog generation:
Format
<type>(<scope>): <subject>
<body>
<footer>
Types and Version Impact
| Type | Description | Version Impact |
|---|---|---|
feat | New feature | Minor (2.16.3 → 2.17.0) |
fix | Bug fix | Patch (2.16.3 → 2.16.4) |
perf | Performance improvement | Patch |
docs | Documentation only | None |
style | Code style (formatting) | None |
refactor | Code refactoring | None |
test | Tests | None |
chore | Build/tooling | None |
ci | CI configuration | None |
Breaking Changes
Use either method:
# Method 1: Footer
git commit -m "feat: change API signature
BREAKING CHANGE: captureScreenshot now requires workspaceRoot parameter"
# Method 2: ! suffix
git commit -m "feat!: remove deprecated API"
Examples
# Good examples
git commit -m "feat(screenshot): add explorer mode capture"
git commit -m "fix(connection): resolve timeout issue"
git commit -m "docs: update installation instructions"
git commit -m "test(script): add refs_find tests"
# Bad examples
git commit -m "Update hooks" # Missing type
git commit -m "feat: change files" # Too vague
git commit -m "fix stuff" # Non-descriptive
Git Hooks (Husky)
This project uses Husky to enforce code quality:
Active Hooks
| Hook | Action |
|---|---|
commit-msg | Validates Conventional Commits format (commitlint) |
pre-commit | Runs ESLint, Prettier, markdownlint on staged files |
pre-push | Executes test suite before pushing |
post-merge | Notifies when dependencies need updating |
Configuration Files
| File | Purpose |
|---|---|
.commitlintrc.json | Conventional Commits rules |
.eslintrc.json | JavaScript code style |
.prettierrc.json | Code formatting |
.markdownlint.json | Markdown rules |
Bypassing Hooks (Emergency Only)
git commit --no-verify -m "emergency fix"
git push --no-verify
Warning: Use sparingly. Hooks prevent CI failures and maintain code quality.
Test-Driven Development (TDD)
This project strictly enforces TDD:
Red-Green-Refactor Cycle
- RED: Write a failing test first
- GREEN: Write minimal code to pass the test
- REFACTOR: Clean up while keeping tests green
Test Categories
| Category | Coverage Requirement |
|---|---|
| Unit tests | 80%+ coverage |
| Integration tests | 100% critical paths |
| E2E tests | Major user workflows |
Running Tests
# All tests
npm test --workspace=mcp-server
# With coverage
npm run test:coverage --workspace=mcp-server
# Watch mode
npm run test:watch --workspace=mcp-server
# Specific file
npm test --workspace=mcp-server -- tests/unit/handlers/script/ScriptRefsFindToolHandler.test.js
Pull Request Process
Before Creating PR
- All tests pass locally
- Code follows style guidelines
- Commit messages follow Conventional Commits
- Documentation updated if needed
PR Requirements
- Target:
developbranch (nevermaindirectly) - Title: Clear description of changes
- Description: What changed and why
Required CI Checks
| Check | Description |
|---|---|
Test & Coverage | All tests pass |
Markdown, ESLint & Formatting | Code style validation |
Commit Message Lint | Conventional Commits format |
Package | npm package builds successfully |
Review Process
- At least one approval required
- All CI checks must pass
- No merge conflicts
Code Guidelines
JavaScript/TypeScript
- Use ES6+ features
- Follow ESLint configuration
- Format with Prettier
- Add JSDoc comments for public APIs
- No
console.login production code
Unity C#
- Follow Unity's coding conventions
- Add XML documentation for public methods
- Use meaningful names
- Handle exceptions appropriately
Markdown
- Follow markdownlint rules
- Use fenced code blocks with language
- Keep line length reasonable
Reporting Issues
- Use GitHub Issues for bugs and features
- Include Unity version and OS
- Provide reproduction steps for bugs
- Include relevant error logs
Questions?
Feel free to open an issue for any questions!
日本語
Unity MCP Server への貢献
Unity MCP Server への貢献にご興味を持っていただきありがとうございます。
開発環境セットアップ
git clone https://github.com/akiojin/unity-mcp-server.git
cd unity-mcp-server
npm ci --workspace=mcp-server
npm test --workspace=mcp-server
コミットメッセージ形式
Conventional Commits を使用:
| タイプ | 説明 | バージョン影響 |
|---|---|---|
feat | 新機能 | マイナー ↑ |
fix | バグ修正 | パッチ ↑ |
docs | ドキュメント | なし |
test | テスト | なし |
Gitフック
| フック | アクション |
|---|---|
commit-msg | Conventional Commits検証 |
pre-commit | ESLint/Prettier実行 |
pre-push | テスト実行 |
TDD(必須)
- RED: テストを先に書く(失敗を確認)
- GREEN: テストを通す最小限のコード
- REFACTOR: リファクタリング
PRプロセス
- 対象:
developブランチ - 全テスト通過必須
- CIチェック通過必須
詳細は docs/development.md を参照してください。