Help us shape the future of Go! Take the 2026 Go Developer Survey

mcpserver

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCurrentNovel = errors.New("当前没有打开的小说")

ErrNoCurrentNovel 表示 Goink 界面当前没有打开的小说。

Functions

This section is empty.

Types

type CurrentNovel

type CurrentNovel struct {
	ID    int64
	Title string
}

CurrentNovel 是每次 MCP 调用看到的当前小说快照。

type CurrentNovelFunc

type CurrentNovelFunc func(context.Context) (CurrentNovel, error)

CurrentNovelFunc 在请求开始时读取当前小说,不使用上次打开的历史设置。

type Endpoint

type Endpoint struct {
	URL   string
	Token string
}

Endpoint 是显式启动本地服务后返回的连接信息。Token 只在启动时返回。

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server 将明确选中的 Goink 工具提供为本地 MCP 协议端点。

func New

func New(registry *mcp_tools.Registry, db *gorm.DB, current CurrentNovelFunc, logger *slog.Logger, allowed []string) *Server

New 构建默认不监听的服务。allowed 只包含明确允许对外调用的工具名。

func (*Server) Start

func (s *Server) Start() (Endpoint, error)

Start 显式启动回环地址上的 Streamable HTTP 服务,并生成本次运行的令牌。

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop 停止接收新请求,等待在途调用结束;超时后强制关闭连接。

Jump to

Keyboard shortcuts

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