# iGit MCP Troubleshooting Guide

## Common Issues

### 1. MCP Tools Unavailable

**Symptom**: Running an igit workflow reports that the tool does not exist

**Solution**:
1. Confirm the MCP plugin is enabled in the IDE
2. Verify the MCP configuration is correct
3. Restart the IDE or reload the MCP plugin

---

### 2. GitLab Token Invalid

**Symptom**: Tool calls return a 401 or 403 error

**Solution**:
1. Visit https://igit.58corp.com/-/profile/personal_access_tokens
2. Create a new access token with the following scopes:
   - `read_api`
   - `read_repository`
3. Update `MR_MCP_GITLAB_TOKEN` in your MCP configuration
4. Reload the MCP plugin

---

### 3. Report Generation Failed (invalid character 'å')

**Symptom**: A JSON parsing error occurs when running `/igit-mr-report`

**Solution**:
1. Make sure you are using the latest version of `@epfe/igit-mr-mcp`
2. Update the package:
   ```bash
   npm update -g @epfe/igit-mr-mcp --registry http://ires.58corp.com/repository/58npm/
   ```
3. Kill stale processes:
   ```bash
   ps aux | grep igit-mr-mcp | grep -v grep | awk '{print $2}' | xargs kill -9
   ```

---

### 4. Project Search Returns No Results

**Symptom**: `get_projects` returns an empty list

**Solution**:
1. Confirm `MR_MCP_PROJECT_SEARCH_TERM` is configured correctly
2. Confirm your GitLab account has access to the target project
3. Try searching with a more precise project name

---

### 5. npx Execution Times Out

**Symptom**: MCP tool calls are unresponsive for a long time

**Solution**:
1. Check network connectivity
2. Confirm the npm registry is accessible:
   ```bash
   npm ping --registry http://ires.58corp.com/repository/58npm/
   ```
3. Consider installing globally to avoid downloading on each npx invocation:
   ```bash
   npm install -g --registry http://ires.58corp.com/repository/58npm/ @epfe/igit-mr-mcp
   ```

---

## Environment Configuration Checklist

- [ ] Node.js version >= 16
- [ ] npm registry is accessible
- [ ] GitLab Token obtained and valid
- [ ] IDE MCP plugin enabled
- [ ] MCP configuration added and correctly formatted

---

## Support

If the issue persists, submit an issue at:
https://igit.58corp.com/ep-fe/agent-workflows/issues
