Skip to content

uni-flow 公开 API(中文注解)


uni-flow 公开 API(中文注解) / McpAdapter

Class: McpAdapter ​

Defined in: adapters/mcp-adapter.ts:30

MCP 骨架 RuntimeAdapter:把 Unit 执行委托给可注入的 callFn。

未配置 callFn 时调用 execute 会抛错;便于测试时 Mock。

Implements ​

Constructors ​

Constructor ​

new McpAdapter(config): McpAdapter

Defined in: adapters/mcp-adapter.ts:37

Parameters ​

config ​

McpAdapterConfig

服务端 URL 与可选 callFn

Returns ​

McpAdapter

Properties ​

type ​

readonly type: "mcp"

Defined in: adapters/mcp-adapter.ts:31

适配器类型标签。

Implementation of ​

RuntimeAdapter.type

Methods ​

cancel() ​

cancel(): void

Defined in: adapters/mcp-adapter.ts:70

请求取消。

Returns ​

void

Implementation of ​

RuntimeAdapter.cancel


execute() ​

execute(input, ctx): Promise<AgentOutput>

Defined in: adapters/mcp-adapter.ts:46

调用 config.callFn 并派发 start/end 事件。

Parameters ​

input ​

AgentInput

Agent 输入

ctx ​

ExecutionContext

执行上下文

Returns ​

Promise<AgentOutput>

Agent 输出

Implementation of ​

RuntimeAdapter.execute


followUp() ​

followUp(_content): void

Defined in: adapters/mcp-adapter.ts:61

MCP 适配器暂不支持 followUp(空操作)。

Parameters ​

_content ​

string

Returns ​

void

Implementation of ​

RuntimeAdapter.followUp


frameworkInfo() ​

frameworkInfo(): object

Defined in: adapters/mcp-adapter.ts:72

框架名称与版本,供可观测性使用。

Returns ​

object

name ​

name: string

version ​

version: string

Implementation of ​

RuntimeAdapter.frameworkInfo


steer() ​

steer(_content): void

Defined in: adapters/mcp-adapter.ts:59

MCP 适配器暂不支持 steer(空操作)。

Parameters ​

_content ​

string

Returns ​

void

Implementation of ​

RuntimeAdapter.steer


subscribe() ​

subscribe(handler): Unsubscribe

Defined in: adapters/mcp-adapter.ts:63

订阅生命周期事件。

Parameters ​

handler ​

RuntimeEventHandler

Returns ​

Unsubscribe

Implementation of ​

RuntimeAdapter.subscribe

MIT Licensed