---
name: igit-mcp-preflight
description: iGit MCP Environment Preflight & Configuration Guide
---

# iGit MCP Preflight Skill

This skill provides environment detection, installation guidance, and configuration validation for `@epfe/igit-mr-mcp`.

## Usage Scenarios

All `igit-mr-*` workflows should reference this skill for environment preflight checks before execution.

---

## Preflight Steps

### Step 1: Check MCP Server Status

Verify that the `igit-mr-mcp` MCP server is enabled in the IDE:

1. Check the list of currently available MCP tools
2. Confirm the following tools are available:
   - `mcp_igit-mr-mcp_get_projects`
   - `mcp_igit-mr-mcp_list_open_merge_requests`
   - Other `igit-mr-mcp`-related tools

**If tools are available**: Skip to [Step 4](#step-4-preflight-passed)

**If tools are unavailable**: Continue to Step 2

---

### Step 2: Check Package Installation Status

Run the following command to check whether `@epfe/igit-mr-mcp` is installed globally:

```bash
npm list -g @epfe/igit-mr-mcp --depth=0 2>/dev/null || echo "NOT_INSTALLED"
```

**If installed**: Skip to [Step 3](#step-3-guide-mcp-configuration)

**If not installed**: Prompt the user to install:

```bash
# Global installation (recommended)
npm install --global --registry http://ires.58corp.com/repository/58npm/ @epfe/igit-mr-mcp

# Verify installation
igit-mr-mcp --version
```

---

### Step 3: Guide MCP Configuration

If the package is installed but MCP tools are unavailable, the MCP server has not been configured in the IDE.

Show the user the following configuration guide:

> [!IMPORTANT]
> **MCP Server Configuration Required**
>
> Add the following to your IDE MCP configuration:

```json
{
  "mcpServers": {
    "igit-mr-mcp": {
      "command": "npx",
      "args": ["-y", "@epfe/igit-mr-mcp"],
      "env": {
        "npm_config_registry": "http://ires.58corp.com/repository/58npm/",
        "MR_MCP_GITLAB_TOKEN": "your_gitlab_access_token",
        "MR_MCP_GITLAB_HOST": "https://igit.58corp.com",
        "MR_MCP_MIN_ACCESS_LEVEL": "30",
        "MR_MCP_PROJECT_SEARCH_TERM": "ep-fe"
      }
    }
  }
}
```

> [!CAUTION]
> **A GitLab Personal Access Token is required**
>
> Before use, apply for a personal access token at the following address:
>
> 🔗 https://igit.58corp.com/-/profile/personal_access_tokens
>
> **Required scopes**: `read_api`, `read_repository`

After configuration, reload the MCP plugin in your IDE.

---

### Step 4: Preflight Passed

✅ Environment check passed. You may proceed with the workflow.

**Available tools** (from `igit-mr-mcp`):

| Tool Name | Function |
|-----------|----------|
| `get_projects` | Search projects to obtain a project_id |
| `list_open_merge_requests` | List open MRs |
| `get_merge_request_details` | Get MR details |
| `get_merge_request_diff` | Get MR code diff |
| `get_merge_request_comments` | Get MR comments |
| `add_merge_request_comment` | Add an MR comment |
| `generate_and_add_standardized_review` | Generate a standardized code review report |
| `commit_review_report_to_git` | Generate and commit a report to Git |
| `get_reliable_project_mr_review_stats` | Get MR review statistics |

---

## Troubleshooting

If you encounter issues, see [troubleshooting.md](./resources/troubleshooting.md)
