Thank you for your interest in contributing to GitLab MCP Server!
- Node.js >= 24.0.0
- Yarn 4+
- A GitLab instance with API access (for integration tests)
# Clone the repository
git clone https://github.com/structured-world/gitlab-mcp.git
cd gitlab-mcp
# Install dependencies
yarn install
# Build the project
yarn build# stdio mode (with .env.test auto-loaded)
yarn dev:stdio
# SSE/HTTP mode
yarn dev:sse| Command | Description |
|---|---|
yarn test |
Unit tests only (fast, safe default) |
yarn test <pattern> |
Unit tests matching pattern |
yarn test:cov |
Unit tests with coverage report |
yarn test:integration |
Integration tests (needs .env.test) |
yarn test:all |
Full suite (unit + integration) |
yarn test:env-gating |
Test environment variable gating |
Integration tests run against a real GitLab instance. Create .env.test:
GITLAB_TOKEN=your_test_token
GITLAB_API_URL=https://your-gitlab-instance.com
# Add other required variablesThen run:
yarn test:integrationTest individual MCP tools directly:
./scripts/test_mcp.sh '{"name": "browse_work_items", "arguments": {"action": "list", "namespace": "test"}}'The script automatically:
- Loads environment from
.env.test - Sends proper MCP initialization sequence
- Executes the tool call with JSON-RPC formatting
- 200+ integration tests running against real GitLab instance
- Data lifecycle pattern — Creates test infrastructure once, shared across dependent tests
- Schema validation — All schemas validated against real API responses
- Dependency chain — Tests run in proper order using
--runInBand
For detailed testing documentation, see TESTING.md.
- Strict TypeScript with no
anytypes - All code must pass
yarn lintwith zero errors - ESM modules with
.jsextensions in imports - Zod schemas for all external data validation
Follow Conventional Commits:
feat(entity): add new capability
fix(oauth): resolve token refresh issue
docs: update installation guide
chore(deps): update dependencies
yarn lint— Zero errorsyarn test— All tests passyarn build— Builds successfully
Each GitLab entity (projects, merge requests, etc.) follows:
src/entities/<entity>/
├── registry.ts # Tool definitions and schemas
├── handlers.ts # Request handlers
├── types.ts # TypeScript interfaces
└── __tests__/ # Unit tests
Tools use Command Query Responsibility Segregation:
browse_*— Read-only query operationsmanage_*— Write/command operations
Each tool has a discriminated union schema with an action parameter.
- Create a feature branch from
main - Make your changes following code standards
- Ensure all tests pass
- Submit a PR with a clear description
- Address review feedback
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.