* Build the `mcp` section of OpenCode's `opencode.json` from the * `{ kind: 'mcp' }` skills, resolving every header value (SecretRef / bearer * / string). Returns `undefined` when there are no MCP skills so the caller * can skip the write.
( skills: Array<WorkspaceSkill>, resolveSecret: (ref: SecretRef) => string, )
| 81 | * can skip the write. |
| 82 | */ |
| 83 | function buildMcpSection( |
| 84 | skills: Array<WorkspaceSkill>, |
| 85 | resolveSecret: (ref: SecretRef) => string, |
| 86 | ): Record<string, OpencodeMcpServer> | undefined { |
| 87 | const mcp: Record<string, OpencodeMcpServer> = {} |
| 88 | let count = 0 |
| 89 | for (const skill of skills) { |
| 90 | if (skill.kind !== 'mcp') continue |
| 91 | count += 1 |
| 92 | const headers: Record<string, string> = {} |
| 93 | const rawHeaders = skill.config.headers ?? {} |
| 94 | for (const [name, value] of Object.entries(rawHeaders)) { |
| 95 | headers[name] = resolveHeaderValue(value, resolveSecret) |
| 96 | } |
| 97 | const rawUrl = skill.config['url'] |
| 98 | const url = typeof rawUrl === 'string' ? rawUrl : '' |
| 99 | mcp[skill.name] = { type: 'remote', url, enabled: true, headers } |
| 100 | } |
| 101 | return count > 0 ? mcp : undefined |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Write (or merge-update) `opencode.json` at the workspace root with the |
no test coverage detected