﻿---
title: "技能缺 MCP 时，在 agents/openai.yaml 声明依赖"
summary: "features.skill_mcp_dependency_install 默认开。声明只负责装上工具，工作流仍要写进 SKILL.md。"
category: skills
level: intermediate
surfaces: [cli, app]
tags: ["Skills", "MCP", "openai.yaml"]
canonical: /tips/skill-declare-mcp-in-openai-yaml/
---

# 技能缺 MCP 时，在 agents/openai.yaml 声明依赖

features.skill_mcp_dependency_install 默认开。声明只负责装上工具，工作流仍要写进 SKILL.md。

技能目录里放 `agents/openai.yaml`：

```yaml
interface:
  display_name: "Docs lookup"
  short_description: "Search OpenAI developer docs"

policy:
  allow_implicit_invocation: true

dependencies:
  tools:
    - type: "mcp"
      value: "openaiDeveloperDocs"
      description: "OpenAI Docs MCP server"
      transport: "streamable_http"
      url: "https://developers.openai.com/mcp"
```

`value` 是服务器名。默认会提示安装缺失依赖；不想弹窗：

```toml
[features]
skill_mcp_dependency_install = false
```

依赖不会替代技能正文。SKILL.md 仍要写清用哪个工具、顺序、结果缺失怎么办。禁隐式调用把 `allow_implicit_invocation` 设成 `false`，`$` 显式调用仍然可用。

## 来源

- [OpenAI · Build skills](https://learn.chatgpt.com/docs/build-skills)
- [OpenAI · Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
