Skip to content

Use numerical project ID when fetch file content from gitlab #1615

@kool79

Description

@kool79

While gitlab allows to use URL-encoded project path to fetch file content, it has a many bugs with that approach, especially for repositories inside groups.
I tried to use MCP to get a file content from the repo. While my agent successfully fetched list of files, it fails when I tries to get content form any file inside folders. For some reason, it successfully retrieve and analyse only the files which are located in a project root.

I investigated, that agent tries to use URL-encoded project path as the repo ID. I tried to use the same requests from postman, and found that:

  • When I request a file inside any folder, gitlab returns "404 File not found" error (for some reason, files in a repository root are fetched successfully)
  • When I use any branch name (ref=...) (except HEAD), I have the error "404 Commit not found".

When I changed project ID to numerical one, everything works OK. Logs below:

Image

It is possible to configure MCP for gitlab to use numerical IDs for repos? Because when I use URL-encoded path for repo inside nested project group, MCP fetched only the files from project root of the default branch (HEAD). I understand, that it is the issue, related to gitlab itself, but maybe we can have workaround for that.

P.S. I did not tested all the configurations, but my is:

  • hosted gitlab CE v17.3.7
  • private project
  • token with all possible permissions
  • project is located in nested 2nd-level subgroup , i.e: TA-Projects/<project-name>/<repo-name>.git

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions