mcpserver

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddr = "127.0.0.1:9551"

DefaultAddr is the default MCP server listen address.

Variables

This section is empty.

Functions

func LoadOrCreateToken

func LoadOrCreateToken(dataDir string) (string, error)

LoadOrCreateToken reads the bearer token from <dataDir>/mcp-token. If missing, generates a 32-byte hex token and persists it.

Types

type Config

type Config struct {
	Store    FlowReader
	Proxy    ProxyInfo
	Scripts  ScriptManager
	Throttle ThrottleController
	Addr     string // listen address (default "127.0.0.1:9551")
	Token    string // bearer token for auth
}

Config holds dependencies for the MCP server.

type FlowReader

type FlowReader interface {
	List(filter store.Filter, offset, limit int) ([]store.FlowMeta, int)
	Get(id store.FlowID) (*store.FlowMeta, *store.FlowData, error)
}

FlowReader is the read-only port for accessing captured flows.

type ProxyInfo

type ProxyInfo interface {
	Addr() string
}

ProxyInfo exposes proxy status.

type ScriptManager

type ScriptManager interface {
	Scripts() []scripting.ScriptInfo
	ScriptByID(id string) (scripting.ScriptInfo, bool)
	Toggle(filePath string) error
	Delete(filePath string) error
	CreateNew() (string, error)
	QuickAddMapLocal(pattern, localPath string) (string, error)
	ScriptDir() string
	Reload()
}

ScriptManager exposes script operations.

type Server

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

Server is the MCP server that exposes httpmon tools to LLM agents.

func New

func New(cfg Config) *Server

New creates an MCP server with the given config.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the full listen address.

func (*Server) Port

func (s *Server) Port() int

Port returns the actual port the server is listening on.

func (*Server) Running

func (s *Server) Running() bool

Running reports whether the server is active.

func (*Server) Start

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

Start begins serving on the configured address.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the MCP server.

type ThrottleController

type ThrottleController interface {
	SetThrottle(bps int64, latency time.Duration)
	GetThrottleBPS() int64
	GetThrottleLatency() time.Duration
}

ThrottleController manages bandwidth throttling.

Jump to

Keyboard shortcuts

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