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

# Devin MCP

> 如何在私有和公共代码仓库中使用官方 Devin MCP 服务器

Devin MCP 服务器为 Devin 平台在私有和公共代码仓库中的能力提供可编程访问。除了代码仓库文档和搜索之外，它还让任何兼容 MCP 的 AI Agent 或 IDE 都能完全访问会话管理、playbooks、knowledge 和计划安排。

<Info>
  任何 Devin 会话或兼容 MCP 的客户端都可以创建会话、管理 playbooks 和 knowledge、设置计划安排等。有关 Devin 能做什么的详细信息，请参阅 [高级功能](/zh/work-with-devin/advanced-capabilities)。
</Info>

<div id="what-is-mcp">
  ## 什么是 MCP？
</div>

[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP，模型上下文协议) 是一个开放标准，可让 AI 应用安全地连接到兼容 MCP 的数据源和工具。你可以将 MCP 类比为 AI 应用的 USB-C 接口——一种将 AI 应用连接到不同服务的标准化接口。

<div id="devin-mcp-server">
  ## Devin MCP Server
</div>

Devin MCP 服务器是一项经过身份验证的服务，可访问公共和私有代码仓库，并提供完整的平台管理功能。

**基础服务器 URL：** `https://mcp.devin.ai/`

<div id="authentication-required">
  ### 需要身份验证
</div>

要使用 Devin MCP 服务器，你需要一个 Devin API 密钥：

1. 在 [Devin.ai](https://devin.ai/) 注册 Devin 账户
2. 在你的[账户设置](/zh/api-reference/authentication)中生成 API 密钥
3. 在 MCP 客户端配置中加入该 API 密钥

MCP 服务器支持与 [Devin API](/zh/api-reference/authentication) 相同的身份验证方式：

| 令牌类型            | 前缀     | 组织解析                   |
| --------------- | ------ | ---------------------- |
| **组织作用域服务用户密钥** | `cog_` | 自动——从服务用户解析 org\_id    |
| **企业级服务用户密钥**   | `cog_` | 需要 `X-Org-Id` 标头 (见下文) |
| **个人访问令牌**      | `cog_` | 需要 `X-Org-Id` 标头 (见下文) |

<Note>
  Devin MCP 服务器**不支持**旧版 API 密钥 (前缀为 `apk_` / `apk_user_`) 。请改用[服务用户 API 密钥](/zh/api-reference/authentication#service-users-recommended-for-automation)。
</Note>

<div id="enterprise-accounts-x-org-id-header">
  #### 企业账户：`X-Org-Id` 标头
</div>

企业级服务用户密钥和 PAT 的作用域是账户级，而不是某个特定组织。由于 MCP 工具操作的是组织级资源 (会话、playbooks、Knowledge 等) ，因此你必须通过传递 `X-Org-Id` 标头来告知服务器应将哪个组织作为目标：

```json theme={null}
{
  "mcpServers": {
    "devin": {
      "serverUrl": "https://mcp.devin.ai/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>",
        "X-Org-Id": "<YOUR_ORG_ID>"
      }
    }
  }
}
```

<Tip>
  你可以在 **Settings > Service users** 页面找到你的组织 ID，或使用你的 API 密钥 调用 [GET /v3/self](/zh/api-reference/v3/self/self) 端点。
</Tip>

具有组织作用域的服务用户密钥不需要这个标头——系统会自动解析组织信息。

<div id="available-tools">
  ## 可用工具
</div>

<div id="repository-documentation">
  ### 代码仓库文档
</div>

这些工具可让你浏览和查询任意 GitHub 代码仓库 (公共代码仓库，或经身份验证可访问的私有代码仓库) 的文档：

| Tool                       | 描述                                              |
| -------------------------- | ----------------------------------------------- |
| **`read_wiki_structure`**  | 获取 GitHub 代码仓库的文档主题列表                           |
| **`read_wiki_contents`**   | 查看 GitHub 代码仓库的完整文档                             |
| **`ask_question`**         | 就一个或多个代码仓库 (最多 10 个) 提出任意问题，并获得由 AI 生成、基于上下文的回答 |
| **`list_available_repos`** | 列出你的 Devin 账户中所有可供查询的代码仓库                       |

<div id="session-management">
  ### 会话管理
</div>

以编程方式创建、搜索、查看和控制 Devin 会话：

| 工具                           | 描述                                                      |
| ---------------------------- | ------------------------------------------------------- |
| **`devin_session_create`**   | 创建一个或多个 Devin 会话。每个会话都可以包含提示、标题、playbook、标签和 ACU 限制     |
| **`devin_session_search`**   | 按标签、playbook、来源、计划、用户或创建/更新时间搜索和筛选会话                    |
| **`devin_session_interact`** | 与会话交互——获取状态、发送消息、休眠、终止、归档、读取消息和附件，或管理标签                 |
| **`devin_session_events`**   | 查看会话中的事件——列出摘要、获取完整事件详情，或按文本搜索事件内容                      |
| **`devin_session_gather`**   | 在返回前等待多个会话进入稳定状态 (已完成、出错、休眠或等待) 。适用于并行创建会话后使用，而不是在循环中轮询 |

<div id="playbook-management">
  ### Playbook 管理
</div>

创建和管理 playbooks，以规范 Devin 执行任务的方式：

| Tool                        | 描述                                              |
| --------------------------- | ----------------------------------------------- |
| **`devin_playbook_manage`** | 列出、查询、创建、更新或删除 playbooks。支持自动化宏 (如 `!my_macro`) |

<div id="knowledge-management">
  ### Knowledge 管理
</div>

维护你的组织的 Knowledge 库，供 Devin 用作上下文：

| Tool                         | Description                                                                                                                |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **`devin_knowledge_manage`** | 对 Knowledge notes 执行完整的 CRUD 操作——列出、查询、创建、更新、删除，以及浏览文件夹结构。还可管理 knowledge suggestions——列出、查看和忽略待处理的建议。支持按 repo、文件夹和搜索查询进行筛选 |

<div id="schedule-management">
  ### 计划管理
</div>

设置周期性或一次性的 Devin 计划会话：

| 工具                          | 描述                                                           |
| --------------------------- | ------------------------------------------------------------ |
| **`devin_schedule_manage`** | 列出、查询、创建、更新或删除计划。支持对周期性计划使用 cron 表达式，也支持一次性计划、通知偏好和 Agent 选择 |

<div id="integration-management">
  ### 集成管理
</div>

查看并管理你的组织的原生集成和 MCP 服务器：

| 工具                      | 描述                                                                        |
| ----------------------- | ------------------------------------------------------------------------- |
| **`list_integrations`** | 列出所有原生集成 (例如 GitHub、Jira、Slack) 和 MCP 服务器，以及它们的安装状态和设置 URL。可按已安装、未安装或全部筛选 |

<div id="wire-protocols">
  ## 传输协议
</div>

Devin MCP 服务器支持 Streamable HTTP：

* **URL：** `https://mcp.devin.ai/mcp`
* 可与兼容 HTTP 的客户端配合使用
* **推荐用于所有集成**

<Note>旧版 SSE (`/sse`) 端点已弃用。请改用 `/mcp` 端点。</Note>

<div id="key-differences-from-deepwiki-mcp">
  ## 与 DeepWiki MCP 的主要差异
</div>

| Feature                 | DeepWiki MCP                | Devin MCP                    |
| ----------------------- | --------------------------- | ---------------------------- |
| **身份验证**                | 无需身份验证                      | 需要 API key                   |
| **Repository Access**   | 仅限公共代码仓库                    | 公共和私有代码仓库                    |
| **Platform Management** | 不提供                         | 会话、playbooks、knowledge、计划、集成 |
| **基础 URL**              | `https://mcp.deepwiki.com/` | `https://mcp.devin.ai/`      |
| **Cost**                | 免费                          | 需要 Devin 账户                  |

<div id="setup-instructions">
  ## 设置说明
</div>

服务器 URL 的字段名取决于客户端：Devin Desktop 使用 `serverUrl`，而大多数其他客户端使用标准的 `url` 字段。使用错误的字段名会导致 MCP 服务器被悄然忽略。

<div id="for-devin-desktop">
  ### 对于 Devin Desktop：
</div>

```json theme={null}
{
  "mcpServers": {
    "devin": {
      "serverUrl": "https://mcp.devin.ai/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}
```

<div id="for-most-other-clients-eg-cursor">
  ### 对于大多数其他客户端 (如 Cursor) ：
</div>

```json theme={null}
{
  "mcpServers": {
    "devin": {
      "url": "https://mcp.devin.ai/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}
```

<div id="for-claude-code">
  ### 适用于 Claude Code：
</div>

```bash theme={null}
claude mcp add -s user -t http devin https://mcp.devin.ai/mcp -H "Authorization: Bearer <API_KEY>"
```

<div id="related-resources">
  ## 相关资源
</div>

* **[高级功能](/zh/work-with-devin/advanced-capabilities)** — Devin 高级功能概览
* **[Devin 的 MCP Marketplace](/zh/work-with-devin/mcp)**
* **[将远程 MCP 服务器连接到 Claude](https://support.anthropic.com/en/articles/11175166-about-custom-integrations-using-remote-mcp)**
* **[OpenAI 关于使用 MCP 服务器的文档](https://platform.openai.com/docs/guides/tools-remote-mcp)**
* **[DeepWiki MCP](/zh/work-with-devin/deepwiki-mcp)** — 仅适用于公共代码仓库
* **[DeepWiki](/zh/work-with-devin/deepwiki)**
* **[Ask Devin](/zh/work-with-devin/ask-devin)**
