Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Connecting AI Agents to GitLab: How I Implemented MCP Resources in GitLab Core

Описание и применение

В GitLab Core реализованы эндпоинты MCP resources/list и resources/templates/list, что позволяет LLM‑агентам получать контекст репозитория. Добавлены ограничения enum для параметра поиска, предотвращая ошибки из‑за неверных вводов.

Задача

MCP clients could not access GitLab resources because the server did not advertise or implement the required endpoints, causing 404 errors and disabling context awareness.

Результат

Implemented MCP resources and templates endpoints in GitLab Core, resolving 404 errors and enabling AI agents to access project context. Added enum constraints to search scope, reducing hallucinations and server errors.

Рабочий процесс

  • 1. Identify missing MCP endpoints causing 404 errors.
  • 2. Update the server handshake to advertise resources capability.
  • 3. Implement ResourcesListHandler to return a list of available resources.
  • 4. Implement ResourceTemplatesListHandler to return URI templates for resources.
  • 5. Add enum constraints to the search scope JSON schema to prevent hallucinations.
  • 6. Verify handlers via GitLab CI pipelines (Danger Bot, RuboCop, Predictive RSpec).

Доказательства

Because GitLab's server had not implemented or advertised these endpoints, the server responded with: "Method not found: resources/list"

Источник

In the server's handshake responder, we registered the resources capability: ...

Источник

Next, we added request dispatchers for the resource endpoints: ...

Источник

In Merge Request !259119, we introduced explicit enum constraints to the JSON Schema: ...

Источник

  • Дата записи: 2026-10-16T03:41:20.909Z