Borrowing it
Nothing to install: this file belongs to ffpy/gitlab-mcp-code-review. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/ffpy/gitlab-mcp-code-review/main/CLAUDE.mdgit clone --depth 1 https://github.com/ffpy/gitlab-mcp-code-reviewWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/ffpy/gitlab-mcp-code-review/claude-md)<a href="https://agentmods.dev/instructions/ffpy/gitlab-mcp-code-review/claude-md"><img src="https://agentmods.dev/badge/instructions/ffpy/gitlab-mcp-code-review/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/ffpy/gitlab-mcp-code-review/claude-md"><img src="https://agentmods.dev/badge/instructions/ffpy/gitlab-mcp-code-review/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01145 | $0.01145 |
| Opus 5.5 | $0.00458 | $0.00458 |
| Sonnet 5.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 2mo 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.
- 2mo 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 11mo ago), licensed MIT. It adds 1,145 tokens to every session, about $0.0046 per session on Opus 5.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
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).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
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 copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.