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.
npx agentmods add instructions/ffpy/gitlab-mcp-code-review/claude-mdgit clone --depth 1 https://github.com/ffpy/gitlab-mcp-code-reviewWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01145 | $0.01145 |
| Opus 5 | $0.00573 | $0.00573 |
| Sonnet 5 | $0.00229 | $0.00229 |
| Haiku 4.5 | $0.00114 | $0.00114 |
Grade A, and why
gitlab-mcp-code-review CLAUDE.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.
How it starts
The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
项目概述
这是一个 MCP (Model Context Protocol) 服务器,用于将 AI 助手与 GitLab 的合并请求集成。它允许 AI 助手通过 GitLab API 直接审查代码变更、添加评论和管理审批流程。
核心架构
主要文件
server.py: MCP 服务器的主入口文件,包含所有工具定义和 GitLab API 集成逻辑config.toml: 配置文件,定义代码审查时需要忽略的文件模式pyproject.toml: Python 项目配置,包含依赖和工具配置
关键组件
- FastMCP 服务器: 使用
mcp.server.fastmcp.FastMCP创建 MCP 服务器 - GitLab 客户端: 通过
python-gitlab库与 GitLab API 交互 - 生命周期管理: 使用
gitlab_lifespan异步上下文管理器管理 GitLab 连接
MCP 工具列表
服务器暴露以下工具(位于 server.py):
fetch_merge_request: 获取合并请求的完整信息(包括变更、提交和讨论)compare_versions: 比较两个提交/分支/标签之间的差异add_merge_request_comment: 添加常规评论到合并请求add_merge_request_discussion: 在文件特定位置添加讨论reply_to_merge_request_discussion: 回复讨论resolve_merge_request_discussion: 解决或取消解决讨论delete_merge_request_discussion: 删除讨论approve_merge_request: 批准合并请求unapprove_merge_request: 取消批准合并请求get_project_merge_requests: 获取项目的合并请求列表search_projects: 按名称搜索 GitLab 项目fetch_code_review_rules: 通过 SSH 从远程服务器获取团队的代码审查规范
数据过滤机制
fetch_merge_request 工具实现了智能数据过滤:
- 使用
config.toml中的exclude_patterns过滤不需要审查的文件 - 精简 API 响应数据,只返回必要字段,减少 token 使用
- 支持通配符模式和目录模式匹配(见
is_path_excluded函数)
环境变量
必需的环境变量(可以在 .env 文件中设置):
GITLAB_HOST: GitLab 实例的主机名(默认: gitlab.com)GITLAB_TOKEN: GitLab 个人访问令牌(必需,需要 api 和 read_api 权限)
可选的环境变量(用于代码审查规范功能):
CODE_REVIEW_SSH_HOST: SSH 服务器地址CODE_REVIEW_SSH_PORT: SSH 端口(默认: 22)CODE_REVIEW_SSH_USERNAME: SSH 用户名CODE_REVIEW_SSH_PASSWORD: SSH 密码CODE_REVIEW_RULE_FILE: 规范文件在服务器上的绝对路径
常用命令
运行服务器
uv run server.py
安装依赖
uv sync
开发依赖(可选)
uv sync --extra dev
修改代码时的注意事项
- 添加新的 MCP 工具: 使用
@mcp.tool()装饰器,第一个参数必须是ctx: Context - 访问 GitLab 客户端: 通过
ctx.request_context.lifespan_context获取 GitLab 客户端实例 - 数据精简: 当从 GitLab API 获取数据时,应该只返回必要的字段以减少响应大小
- 文件过滤: 修改
config.toml中的exclude_patterns来调整忽略的文件类型 - 错误处理: 使用 logger 记录错误,遵循现有的日志模式
- 返回类型: 所有工具函数都应该返回可序列化的 Dict 或 List
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.
- 2d ago First seen · 102 lines · 1,145 tokens per session scan A ebaede9ff504
gitlab-mcp-code-review CLAUDE.md is an instructions file published in the GitHub repository ffpy/gitlab-mcp-code-review (4 stars, last pushed 9mo ago), licensed MIT. It adds 1,145 tokens to every session, about $0.0057 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.
Other instructions, from other repositories
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.