mcpserver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: GPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver 用官方 go-sdk 构建 sctl 的 stdio MCP server:把 protocol.json 定义的 bridge action 暴露成 MCP 工具(第 1 期的方法一方法一工具,之后的浏览器领域按领域合并成一个工具),并在 调用等待期间周期发送 progress 通知(支持的客户端可借此续期工具超时;哪些调用、从何时开始发见 progressFor)。

扁平信任:接入(enrollment)建立可信通道后,MCP agent 继承信任、无需各自配对,故 tools/list 暴露全部工具;权威授权仍在扩展侧(写操作审批 / 源码披露闸门)。

stdout 由 MCP 协议独占:本包绝不向 stdout 写任何东西,日志走全局 stderr/文件 logger。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(d Deps) *mcp.Server

New 按依赖构建 MCP server,注册 protocol.json 里定义的非内部逐方法工具、按领域合并的工具、page_* 页面工具、 debug_* 调试工具、cdp_* 原始 CDP 工具以及 browsers_list。方法是否是浏览器方法、是否汇总多实例、是否等待人工决定,都取自 protocol.json 的 peer、mergeField 与 blocking,不按方法名推断。

Types

type BridgeCaller

type BridgeCaller interface {
	Call(ctx context.Context, action string, target control.Target, input json.RawMessage, onPending func()) (control.CallResult, error)
	Page(ctx context.Context, req control.PageRequest) (control.CallResult, error)
	CDP(ctx context.Context, path string, req control.CDPRequest) (control.CallResult, error)
	Browsers(ctx context.Context) ([]control.BrowserInfo, error)
}

BridgeCaller 抽象「向 daemon 转发 bridge action 调用、页面动作、原始 CDP 端点请求与查询浏览器列表」,便于测试注入桩。 Call 的 target 只为浏览器方法填 Browser、只为 scripts.* 填 ScriptCat(见 control.Target)。

type Deps

type Deps struct {
	Name    string
	Version string
	Proto   *protocol.Protocol
	Caller  BridgeCaller
}

Deps 是构建 MCP server 所需依赖。扁平信任下不再按客户端 scope 过滤:注册 protocol.json 中 定义了的全部工具。

Jump to

Keyboard shortcuts

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