Skip to main content

Add fetch Gitlab code tool to Gitlab connector.

Hi there

Patrick Codrington says:Request to Runbear Support: GitLab Repository Files API Integration Issue​: Ask_Sam is currently unable to retrieve file contents from GitLab repositories due to SAML SSO authentication blocking direct URL fetches. This prevents the agent from accessing authoritative production code, which is critical for accurate analytics responses. Current Limitation​: • Direct URL fetches to https://gitlab.com/minted/analytics/* return SAML authentication pages • Example blocked URL: https://gitlab.com/minted/analytics/managed-airflow/-/raw/main/dags/bi/snowflake/workflows/update_orders_pipeline_daily/AN__bi_order_po/build.sql Required GitLab API Methods​: Based on GitLab's Repository Files API documentation, we need the following endpoints: 1. ​Get File from Repository​ (Primary Need) • ​Endpoint​: GET /projects/:id/repository/files/:file_path • ​Purpose​: Retrieve file metadata and Base64-encoded content • ​Example​: GET https://gitlab.com/api/v4/projects/47981211/repository/files/dags%2Fbi%2Fsnowflake%2Fworkflows%2Fupdate_orders_pipeline_daily%2FAN__bi_order_po%2Fbuild.sql?ref=main • ​Authentication​: Requires PRIVATE-TOKEN header 2. ​Get Raw File from Repository​ (Alternative - Preferred) • ​Endpoint​: GET /projects/:id/repository/files/:file_path/raw • ​Purpose​: Retrieve raw file contents directly (not Base64-encoded) • ​Example​: GET https://gitlab.com/api/v4/projects/47981211/repository/files/dags%2Fbi%2Fsnowflake%2Fworkflows%2Fupdate_orders_pipeline_daily%2FAN__bi_order_po%2Fbuild.sql/raw?ref=main • ​Authentication​: Requires PRIVATE-TOKEN header Parameters Needed​: • project_id (e.g., 47981211 for managed-airflow) • file_path (URL-encoded file path) • ref (branch name, default: main) Authentication Requirements​: • GitLab Personal Access Token or Project Access Token • Token scopes needed: api or read_api • Token should be configured at the assistant/workspace level for persistent access Use Case​: Analytics team members frequently request code lineage, table definitions, and ETL logic. Currently, Ask_Sam must rely on potentially outdated Confluence/Slack references. With GitLab API access, Ask_Sam can provide authoritative, production-accurate code directly from the source repository. Expected Behavior After Implementation​: When a user provides a GitLab file URL or requests code from a specific file, Ask_Sam should: 1. Extract the project ID and file path 2. Call the GitLab API endpoint with proper authentication 3. Return the actual file contents to the user Priority​: High - This is blocking accurate responses for code-related analytics questions, which are a primary use case for Ask_Sam.

Status: Completed3 comments

Log in to comment and vote

Comments3

  • Shuwn Jung

    •

    Dec 14, 2025

    Hi Patrick,

    This is Shuwn from the Runbear team.

    I really appreciate your patience.


    I wanted to share an update regarding the GitLab integration and outline the available options.

    At the moment, GitLab’s official MCP / API functionality is still in beta and is not available to all users.

    Access is currently limited to accounts with an active GitLab Duo subscription.

    To double-check our options, we also reached out to Pipedream. Their response confirmed that:

    • There is no officially supported public API for this functionality yet, and

    • The same GitLab Duo subscription requirement applies.

    Because of this, we’re unable to provide this integration natively in Runbear at this time, and a Pipedream- based workaround is also not possible.(Pipedream is the MCP-Provider that we are using)

    That said, if you already have a GitLab Duo subscription, we can support this use case through a Custom MCP setup.

    Could you please let us know:
    👉 Are you currently using GitLab Duo?

    For reference, here’s the related GitLab issue tracking this limitation:
    https://gitlab.com/gitlab-org/gitlab/-/work_items/580377

    Looking forward to your confirmation, and we’ll help move things forward from there.

    Best regards,
    Shuwn
    Runbear