mcp

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mcp 把 monkey-deck 的 MCP server 配置(store.McpServer)转成 ACP 线上的 acp.McpServer,并提供从 harness 配置文件(opencode opencode.json / OMP .mcp.json) 一次性导入的解析器。

设计边界(AGENTS.md §2.1):本包是「配置 ↔ ACP 线格式」的纯转换层,不碰 harness 子进程、 不碰 SQLite 连接(只依赖 store 的数据类型)。注入实际发生在 internal/acp(NewSession/Resume)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAcpServers

func ToAcpServers(servers []store.McpServer, caps acp.McpCapabilities) ([]acp.McpServer, []string)

ToAcpServers 把 catalog 里选中的 server 转成 ACP 注入用的 []acp.McpServer。

传输协商:stdio 是协议基线(所有 agent MUST 支持),免协商直接转; http/sse 需 agent 在 Initialize 声明对应 mcpCapability,不支持就丢弃并在 skipped 里记名 (调用方可据此提示用户「X 因 harness 不支持 http 已跳过」)。返回的切片非 nil(空也合法)。

Types

type ImportReport

type ImportReport struct {
	Imported []string // 成功解析的 server 名(待 Create;是否真入库看调用方去重)
	Warnings []string // 字段丢失 / 可能失败的告警(per-server)
	Errors   []string // 完全无法解析的 server(per-server + 原因)
}

ImportReport 汇总一次导入的结果(给人话呈现,§4.4)。

func ImportAuto

func ImportAuto(data []byte) ([]store.McpServer, ImportReport, error)

ImportAuto 自动识别格式并解析。顶层有 "mcp" → opencode;有 "mcpServers" → OMP;都没有 → 报错。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL