Filter tools on MCP server

Problem to solve

As a developer working with gitlab projects, I want to be able to filter the MCP tools exposed by the glab mcp serve command, so I can limit the amount of tools for my agents.

With the current approach, all commands and subcommands are exposed. This has the benefit of simplicity, but can bloat the number of tools for an agent. There is no built in way to filter these tools.

Proposal

Add an extra filter (exclude/include) option in the glab mcp serve command. This would receive a comma separated list of top level cli commands to filter.

Further details

Examples:

glab mcp serve --include=ci,changelog,mr
glab mcp serve --exclude=opentofu,api,ssh-key

I'm interested in implementing this feature and can submit a merge request once the approach is validated by maintainers.

Links / references

Edited by Pablo San José