Skip to content

Two API Issues: get_latest_pipeline 403 Forbidden and get_branches Parameter Validation

🐛 Multiple API Issues Discovered

Issue #1 (closed): get_latest_pipeline Returns 403 Forbidden with Branch Reference

Problem

The get_latest_pipeline function returns a 403 Forbidden error when called with a branch reference parameter, but works correctly without the ref parameter or with ref: "main".

Reproduction Steps

  1. Call get_latest_pipeline with a feature branch reference:
    get_latest_pipeline(project_id: "john/mcp-server-gitlab", ref: "fix/issue-33-version-flag")
  2. Result: MCP error -32603: GitLab API error: 403 Forbidden

Expected Behavior

The function should return the latest pipeline for the specified branch, similar to how it works for the main branch.

Working Cases

  • get_latest_pipeline(project_id: "john/mcp-server-gitlab") - Works (returns main branch pipeline)
  • get_latest_pipeline(project_id: "john/mcp-server-gitlab", ref: "main") - Works
  • get_latest_pipeline(project_id: "john/mcp-server-gitlab", ref: "fix/issue-33-version-flag") - 403 Forbidden

Possible Causes

  1. Permissions Issue: The API might require different permissions for branch-specific pipeline queries
  2. Branch Reference Format: The branch name format might need URL encoding or different formatting
  3. GitLab API Limitation: GitLab might restrict pipeline access for feature branches
  4. MCP Server Bug: The server might not be handling branch references correctly in the API call

Issue #2 (closed): get_branches Function Parameter Validation Error

Problem

The get_branches function consistently returns an "Invalid arguments: project_id: Invalid input" error, even when the same project_id format works perfectly for other functions.

Reproduction Steps

  1. Call get_branches with the same project_id that works for other functions:
    get_branches(project_id: "john/mcp-server-gitlab")
  2. Result: MCP error -32603: Invalid arguments: project_id: Invalid input

Expected Behavior

The function should return a list of branches for the project, similar to how other functions work with the same project_id.

Working Comparison

  • get_pipelines(project_id: "john/mcp-server-gitlab") - Works perfectly
  • get_latest_pipeline(project_id: "john/mcp-server-gitlab") - Works perfectly
  • get_pipeline_jobs(project_id: "john/mcp-server-gitlab", pipeline_id: 1054) - Works perfectly
  • get_branches(project_id: "john/mcp-server-gitlab") - Parameter validation error

Possible Causes

  1. Schema Validation Bug: The function might have incorrect parameter validation that's more strict than other functions
  2. Required Parameters: There might be additional required parameters not documented
  3. Project ID Format: The function might expect a different project_id format (numeric vs string)

Environment Information

  • MCP Server Version: 1.3.0 (latest)
  • GitLab Instance: git.haley.io (self-hosted)
  • Project: john/mcp-server-gitlab (project_id: 34)
  • Context: Discovered while implementing CLI argument parsing features

Impact

  • Issue #1 (closed): Prevents monitoring CI pipelines for feature branches, requiring workarounds
  • Issue #2 (closed): Completely blocks branch listing functionality

Suggested Investigation

  1. For Issue #1 (closed):

    • Check GitLab API permissions for pipeline access on feature branches
    • Verify URL encoding of branch names
    • Test with different branch naming patterns
  2. For Issue #2 (closed):

    • Review parameter validation schema for get_branches
    • Compare with working functions like get_pipelines
    • Test with numeric project_id format

Workarounds Used

  • Issue #1 (closed): Used get_pipelines with branch filtering instead of get_latest_pipeline
  • Issue #2 (closed): Used git commands locally to verify branch existence

Both issues should be investigated to ensure the MCP server provides consistent and reliable GitLab API access.