mcp

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 29 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 mcp 提供 pixiv mcp 命令,启动统一的 Pixiv/FANBOX MCP server。

包的组成:New 组装命令树,Request 记录监听地址与代理覆盖。 stdio 与 HTTP runtime 由 github.com/FlanChanXwO/pixiv-cli/internal/mcpserver 实现。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitAuth

func InitAuth(ctx context.Context, reset bool) (string, error)

InitAuth 初始化 HTTP MCP 的 owner 与 OAuth grant。

func New

func New(env environment.Env, run func(context.Context, Request) error, initAuth func(context.Context, bool) (string, error)) *cobra.Command

New 构造 Pixiv MCP 入口;run 启动 stdio 或 HTTP runtime,initAuth 初始化 HTTP owner。

Types

type Request

type Request struct {
	HTTPSProxyOverride  *string
	ListenAddr, BaseURL *string
}

Request 保存 mcp 命令解析 flags 后的本地请求值。

type Runtime

type Runtime struct {
	In        io.Reader
	Out       io.Writer
	ErrOut    io.Writer
	Logger    func() *slog.Logger
	Settings  settings.RuntimeConfig
	Downloads downloader.DownloadService
	// Local 提供 Pixiv 重放执行、只读会话与本地账号摘要。
	Local *session.Local
	// Fanbox 返回执行内共享账号库的 FANBOX 会话;每次调用只新建租约。
	Fanbox func() (*session.Fanbox, error)
	// ReverseSearch 是启动时固定配置的反向搜图端口。
	ReverseSearch pixivmcpserver.ReverseSearchPorts
	// PixivAccounts 延迟打开账号与登录服务,供 HTTP 登录接力复用。
	PixivAccounts func() (*account.Service, account.LoginService, error)
	// CloseState 登记 MCP 打开的反向搜图 client。
	CloseState *lifecycle.CloseState
}

Runtime 是组合根交给 MCP 命令的生产依赖。

本地账号、只读会话、反向搜图与配置快照都由 root.go 构造;本包只把它们接到 mcpserver 的 stdio 或 HTTP runtime,不打开账号库或读取配置。

func (Runtime) Run

func (r Runtime) Run(ctx context.Context, request Request) error

Run 启动 stdio 或 HTTP runtime;request.ListenAddr 为 nil 时使用 stdio。

Jump to

Keyboard shortcuts

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