Contributing to GitLab & MCP: Lessons from a Week of Upstream Open-Source Engineering
Description and use
Adding note editing, exposing user events, consolidating pipeline creation, and fixing session leaks in GitLab’s MCP and language server improved AI assistant stability and CI reliability.
Problem
AI agents could not edit existing comments or refine feedback in-place in GitLab’s Model Context Protocol (MCP), leading to comment sprawl.
Outcome
All enhancements were merged with 100% green CI pipelines, improving MCP functionality, reducing API fragmentation, and eliminating stale state leaks in the language server.
Workflow
- Introduce
update_notemutation and schema changes - Add
list_user_eventsMCP tool and date type mapping - Consolidate merge‑request pipeline logic into
save_pipeline - Add
parent_iidtolist_work_itemsand improve validation errors - Wrap pending wake operations with session IDs in
gitlab-lsp - Run automated tests and CI to ensure 100% green pipelines
Evidence
The MCP save_note tool allowed AI agents to post comments, reply to discussion threads, and resolve discussions on merge requests and work items. However, agents could not edit their existing comments or refine feedback in-place, leading to comment sprawl.
We introduced the update_note method to save_note
Bound the endpoint as list_user_events in the :core toolset with pagination, action, and target-type filters.
Consolidated the merge request trigger directly into SavePipelineService using an optional merge_request_iid parameter.
Wrapped pending wake operations with session IDs and implemented await flushMicrotasks() during session teardown.
Achieved a 100% green CI pipeline across all 82 jobs.
- Record date: 2026-11-01T22:28:59.521Z