如何将 GitLab 远程 MCP 连接到 OpenAI Codex CLI

约 1 分钟即可把 GitLab 的远程 MCP 服务端接入 OpenAI Codex CLI。如需排查 OAuth / 401 问题,可先用 OAuth 2.1 调试器体检端点。

🛡️ Official✓ VerifiedStreamable HTTPOAuth 2.1🛡️ A+~659 tok22 tools
Streamable HTTPhttps://gitlab.com/api/v4/mcp

Add to ~/.codex/config.toml — Codex reads remote HTTP servers from [mcp_servers.*] tables:

[mcp_servers.gitlab]
url = "https://gitlab.com/api/v4/mcp"

接入步骤

  1. 编辑 TOML 配置 — 打开 ~/.codex/config.toml,加入 [mcp_servers.gitlab] 与 url = "https://gitlab.com/api/v4/mcp"。
  2. 配置凭据 — 首次调用时客户端会打开 GitLab 的 OAuth 授权页面——点击允许后工具即可用。
  3. 验证 — 在 在线 Inspector 中粘贴 https://gitlab.com/api/v4/mcp 并运行 initialize + tools/list 验证连通性。

🧰 工具预览(22)

ToolSafetyDescriptionParameters
mcp_search
~34 tok
🟢 ReadSearch GitLab projects, issues and merge requests.—
get_project
~30 tok
🟢 ReadGet details of a GitLab project.—
list_projects
~28 tok
🟢 ReadList GitLab projects.—
get_file_contents
~31 tok
🟢 ReadRead a file from a repository.—
get_issue
~26 tok
🟢 ReadGet a GitLab issue.—
list_issues
~28 tok
🟢 ReadList issues of a project.—
create_issue
~28 tok
🟠 WriteCreate a GitLab issue.—
create_issue_note
~29 tok
🟠 WriteAdd a note to an issue.—
get_merge_request
~29 tok
🟢 ReadGet a merge request.—
list_merge_requests
~32 tok
🟢 ReadList merge requests of a project.—
create_merge_request
~30 tok
🟠 WriteCreate a merge request.—
create_merge_request_note
~33 tok
🟠 WriteAdd a note to a merge request.—
get_pipeline
~28 tok
🟢 ReadGet a CI/CD pipeline.—
list_pipelines
~30 tok
🟢 ReadList pipelines of a project.—
get_job
~26 tok
🟢 ReadGet a pipeline job.—
get_milestone
~29 tok
🟢 ReadGet a project milestone.—
list_milestones
~29 tok
🟢 ReadList project milestones.—
get_commit
~25 tok
🟢 ReadGet a commit.—
list_branches
~29 tok
🟢 ReadList repository branches.—
create_branch
~29 tok
🟠 WriteCreate a repository branch.—
list_tags
~27 tok
🟢 ReadList repository tags.—
run_pipeline
~29 tok
🟠 WriteTrigger a CI/CD pipeline.—

更多连接指南