> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigmodel.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 开源仓库 MCP

开源仓库 MCP Server（ZRead MCP）是智谱为 GLM Coding Plan 用户开发的专属 Remote MCP Server，基于模型上下文协议（Model Context Protocol）和 [zread.ai](https://zread.ai) 能力，可为 Claude Code、Cline 等兼容 MCP 的客户端提供开源仓库知识文档、代码结构与文件内容访问能力。

## 功能特性

> [card] 文档搜索
>
> GitHub 代码仓库检索文档、代码与注释

> [card] 仓库结构
>
> 获取 GitHub 仓库的目录结构和文件列表，快速掌握项目布局

> [card] 代码读取
>
> 读取 GitHub 仓库中指定文件的完整代码内容，深入分析实现细节

## 支持的工具

该服务器实现了模型上下文协议，可与任何兼容 MCP 的客户端一起使用。目前提供以下工具：

* **`search_doc`** - 搜索 GitHub 仓库的对应的知识文档，快速了解仓库知识，新闻，最近的 issue pr 和贡献者等。
* **`get_repo_structure`** - 获取 GitHub 仓库的目录结构和文件列表，了解项目模块拆分和目录组织方式。
* **`read_file`** - 读取 GitHub 仓库中指定文件的完整代码内容，深入文件代码的实现细节。

## 示例场景

> [accordion] 快速上手开源库
>
> 通过搜索文档和获取仓库结构，快速了解开源库的核心概念、安装步骤和代码组织方式，加速学习曲线。

> [accordion] 排查 Issue 和历史记录
>
> 在遇到问题时，搜索仓库的 Issue 和 Commit 历史，查找是否有类似问题的解决方案或修复记录。

> [accordion] 深入源码分析
>
> 直接读取核心文件的代码内容，分析实现逻辑，辅助进行二次开发或 Debug。

> [accordion] 依赖库调研
>
> 在引入新的依赖库之前，通过查看其仓库结构和文档，评估其活跃度、代码质量和维护情况。

## 安装与使用

### 快速开始

**1. 获取访问令牌**

* 个人版套餐（或领取体验卡）的用户，通过 [个人编程套餐 > 套餐概览](https://bigmodel.cn/apikey/coding-plan-per)，新建 API Key
* 团队版套餐的成员，通过 [团队编程套餐 > 我的套餐](https://bigmodel.cn/apikey/coding-plan-team)，新建 API Key

**2. 配置 MCP 服务器**

根据您使用的客户端 **参考下方** 选择相应的配置方式

### 支持的客户端

> [tab] Claude Code
>
> **一键安装命令**
>
> 注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key
>
> ```bash theme={null}
> claude mcp add -s user -t http zread https://open.bigmodel.cn/api/mcp/zread/mcp --header "Authorization: Bearer YOUR_API_KEY"
> ```
>
> **手动配置**
>
> 编辑 Claude Code 的配置文件, 位于用户目录下 `.claude.json` 的 MCP 部分：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "zread": {
>       "type": "http",
>       "url": "https://open.bigmodel.cn/api/mcp/zread/mcp",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```

> [tab] Cline (VS Code)
>
> 在 Cline 扩展设置中添加 MCP 服务器配置：
>
> 注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "zread": {
>       "type": "streamableHttp",
>       "url": "https://open.bigmodel.cn/api/mcp/zread/mcp",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> 若老版本 Cline 不支持 StreamableHttp 类型的 MCP 服务器，可以使用 SSE 类型的配置：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "zread": {
>       "type": "sse",
>       "url": "https://open.bigmodel.cn/api/mcp/zread/sse?Authorization=YOUR_API_KEY"
>     }
>   }
> }
> ```

> [tab] OpenCode
>
> 在 OpenCode 设置中添加 MCP 服务器配置：
>
> 参考 [OpenCode MCP 文档](https://opencode.ai/docs/mcp-servers)
>
> 注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key
>
> ```json theme={null}
> {
>     "$schema": "https://opencode.ai/config.json",
>     "mcp": {
>         "zread": {
>             "type": "remote",
>             "url": "https://open.bigmodel.cn/api/mcp/zread/mcp",
>             "headers": {
>                 "Authorization": "Bearer YOUR_API_KEY"
>             }
>         }
>     }
> }
> ```

> [tab] Crush
>
> 在 Crush 设置中添加 MCP 服务器配置：
>
> 注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key
>
> ```json theme={null}
> {
>     "$schema": "https://charm.land/crush.json",
>     "mcp": {
>         "zread": {
>             "type": "http",
>             "url": "https://open.bigmodel.cn/api/mcp/zread/mcp",
>             "headers": {
>                 "Authorization": "Bearer YOUR_API_KEY"
>             }
>         }
>     }
> }
> ```

> [tab] Goose
>
> 暂时 Goose 不支持，详见 [Issue](https://github.com/block/goose/issues/6576)
>
> 在 Goose 设置中添加 MCP 服务器配置：
>
> 点击 `Extensions` -> `Add custom extension`
>
> 配置 Extension Name 为 `zread`，Type 选择 `HTTP`，Endpoint 填写如下 URL：
>
> ```
> https://open.bigmodel.cn/api/mcp/zread/mcp
> ```
>
> 配置 Request Headers 添加 `Authorization` : `YOUR_API_KEY`
>
> 最后点击底部 `Add Extension` 即可，注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key

> [tab] Roo Code, Kilo Code 其它
>
> 对于 Roo Code, Kilo Code 等其它支持 MCP 协议的客户端，参考以下通用配置：
>
> 注意替换里面的 `YOUR_API_KEY` 为您上一步获取到的 API Key
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "zread": {
>       "type": "streamable-http",
>       "url": "https://open.bigmodel.cn/api/mcp/zread/mcp",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```

## 故障排除

> [accordion] 访问令牌无效
>
> **问题：** 收到访问令牌无效的错误
>
> **解决方案：**
>
> 1. 确认访问令牌是否正确复制
> 2. 检查访问令牌是否已激活
> 3. 确认访问令牌是否有足够的余额
> 4. 检查 Authorization header 格式是否正确

> [accordion] 连接超时
>
> **问题：** MCP 服务器连接超时
>
> **解决方案：**
>
> 1. 检查网络连接
> 2. 确认防火墙设置
> 3. 验证服务器 URL 是否正确
> 4. 增加超时时间设置

> [accordion] 仓库访问失败
>
> **问题：** 无法搜索或读取指定仓库内容
>
> **解决方案：**
>
> 1. 确认仓库是否存在且为开源（公开）仓库
> 2. 检查仓库名称拼写是否正确 (owner/repo)
> 3. 访问 zread.ai 搜索此开源仓库是否被收纳支持

## 相关资源

* [模型上下文协议 (MCP) 官方文档](https://modelcontextprotocol.io/)
* [Claude Code MCP 配置指南](https://docs.anthropic.com/en/docs/claude-code/mcp)
* [MCP 使用额度说明](https://docs.bigmodel.cn/cn/coding-plan/overview.md#%E4%B8%93%E5%B1%9E-mcp)
* [GLM Coding Plan 介绍](https://docs.bigmodel.cn/cn/coding-plan/overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.