Contributions are welcome. Please follow the guidelines below to keep the codebase consistent and the review process smooth.
Prerequisites
- Node.js 20 or later
- pnpm 10 or later
- Git 2.38 or later (for
--format=...options used in tests)
Setup
bash
git clone https://github.com/selfagency/git-mcp.git
cd git-mcp
pnpm install
pnpm buildStart the development server with hot reload:
bash
pnpm devBefore Submitting a PR
Run the full gate:
bash
pnpm typecheck # TypeScript strict checks
pnpm lint # oxlint
pnpm format:check # oxfmt
pnpm test # vitestAll four must pass. CI runs the same checks.
Code Style
Formatter
Use oxfmt for all TypeScript and Markdown files:
bash
pnpm format # format everything
pnpm format:check # check without writingDo not use Prettier. Do not introduce ESLint.
Linter
Use oxlint:
bash
pnpm lint # check
pnpm lint:fix # fix auto-fixable issuesTypeScript
strict: true— no exceptions- No
any— useunknownand narrow immediately if truly needed - Explicit return types on all exported functions
- Prefer
readonlyandas constwhere appropriate async/awaitconsistently — no.then()/.catch()chains
Architecture rules
- Tools delegate to services. No Git logic in tool handlers.
- Services delegate to the git adapter. No
simple-gitcalls in services. - Config is read from
src/config.ts, not fromprocess.envdirectly. - Shared Zod schemas live in
src/schemas/.
Adding a New Tool
- Add Zod schema in
src/schemas/(if new shared params are needed) - Add service function in the relevant
src/services/*.service.ts - Register tool in the relevant
src/tools/*.tools.ts - Update
src/index.tsif a new tool file is added - Write tests in
src/services/__tests__/ - Document in the corresponding
docs/tools/*.mdpage
Follow the naming convention: git_<verb>_<noun> in snake_case.
Commit Messages
Use Conventional Commits:
text
feat: add git_cherry_pick tool
fix: handle detached HEAD in git_status
docs: add LFS prerequisites section
test: add edge cases for git_reset hard mode
chore: upgrade simple-git to 3.27Types: feat, fix, docs, test, chore, refactor, perf, ci
Pull Request Process
- Fork the repository and create a branch from
main - Make your changes following the guidelines above
- Run the full gate (
typecheck,lint,format:check,test) - Open a PR with a clear description of what changed and why
- Link any related issues in the PR description
PRs that fail CI, introduce any, skip tests, or bypass the formatter will not be merged until fixed.
Reporting Issues
Use GitHub Issues. Include:
- git-mcp version (
npx @selfagency/git-mcp --version) - Node.js version (
node --version) - Git version (
git --version) - OS and architecture
- Minimal reproduction steps
- Actual vs. expected behaviour