mcp-gitlab AGENTS.md

A project guide for mcp-gitlab, a server that lets AI assistants use tools to work with GitLab, a platform for hosting code and managing software projects. It documents the server's structure, tool rules, errors, permissions, and tests.

In plain words
What is it for?
Use it when developing or reviewing GitLab API tools, resources, prompts, configuration, error handling, or unit tests in this project.
Why use it?
It helps contributors add or change GitLab operations consistently while respecting read-only settings and the server's response and testing conventions.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/vish288/mcp-gitlab/agents-md
Clone the repo
git clone --depth 1 https://github.com/vish288/mcp-gitlab

Made for: Codex, OpenCode.

Per session 1,637 This file is loaded in full into every session.
When invoked 1,637 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01637 $0.01637
Opus 5 $0.00818 $0.00818
Sonnet 5 $0.00327 $0.00327
Haiku 4.5 $0.00164 $0.00164

Measured 2d ago against content hash a34ad5149363, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-gitlab AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mcp-gitlab — Agent Context

MCP server providing 83 tools for the GitLab REST API v4.

Architecture

  • Entry point: src/mcp_gitlab/__init__.py — click CLI, loads env, runs FastMCP server
  • Client: src/mcp_gitlab/client.py — async httpx client with all GitLab API methods
  • Tools: src/mcp_gitlab/servers/gitlab.py — all FastMCP tool registrations
  • Resources: src/mcp_gitlab/servers/resources.py — 6 MCP resources (workflow guides)
  • Prompts: src/mcp_gitlab/servers/prompts.py — 5 MCP prompts (multi-tool workflows)
  • Config: src/mcp_gitlab/config.pyGitLabConfig dataclass from env vars
  • Exceptions: src/mcp_gitlab/exceptions.pyGitLabApiError, GitLabAuthError, etc.
  • Tests: tests/unit/test_tools.py — 120+ tool-level tests via FastMCP test client

Patterns

  • All tools are async def returning JSON strings
  • Error handling: try/except wrapping every tool, returning {"error": ...} JSON
  • Write access control: _check_write(ctx) raises GitLabWriteDisabledError when GITLAB_READ_ONLY=true
  • Tags: every tool tagged with {"gitlab", "<category>", "read"|"write"}
  • Parameters use Annotated[type, Field(description=...)]
  • Client uses httpx with PRIVATE-TOKEN header auth
  • Project/group IDs can be numeric or URL-encoded paths

MCP Compliance Rules

Tool Annotations (MANDATORY)

Every tool MUST have annotations={} with at minimum readOnlyHint.

  • Read tools: annotations={"readOnlyHint": True, "idempotentHint": True}
  • Non-destructive write tools: annotations={"readOnlyHint": False}
  • Destructive write tools: annotations={"destructiveHint": True, "readOnlyHint": False}
  • Idempotent writes (PUT/update): add idempotentHint: True

Tool Descriptions

  • 1-2 sentences. Front-load what it does AND what it returns.
  • Bad: "This tool gets a merge request."
  • Good: "Get merge request details. Returns title, state, branches, author, diff_refs."

Error Handling

  • Every tool MUST wrap in try/except and return _err(e) — never raise.
  • Error text MUST be actionable: include what went wrong and suggest a fix.
  • Never return concatenated JSON strings — always a single valid JSON object.
  • Never expose stack traces, tokens, or internal paths.

Read the full file on GitHub · 125 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 125 lines · 1,637 tokens per session scan A a34ad5149363

Subscribe to this mod's changes

mcp-gitlab AGENTS.md is an instructions file published in the GitHub repository vish288/mcp-gitlab (6 stars, last pushed 10d ago), licensed MIT. It adds 1,637 tokens to every session, about $0.0082 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.