mcpserver

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 12 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 exposes postsleuth over the Model Context Protocol (stdio). Every tool is read-only unless the server was started with mutations enabled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(env *doctor.Env, o Options) *mcp.Server

New builds the MCP server.

Types

type ActionOut

type ActionOut struct {
	Ran []string `json:"ran"`
}

ActionOut reports what was run.

type CategoriesOut

type CategoriesOut struct {
	Categories []reason.Category `json:"categories"`
}

CategoriesOut lists classification categories.

type ConfigOut

type ConfigOut struct {
	Settings map[string]string `json:"settings"`
	Note     string            `json:"note"`
}

ConfigOut is the result.

type DNSIn

type DNSIn struct {
	Domain    string   `json:"domain,omitempty" jsonschema:"sending domain (default: myorigin/mydomain from postconf)"`
	IPs       []string `` /* 150-byte string literal not displayed */
	Selectors []string `json:"selectors,omitempty" jsonschema:"DKIM selectors (default: taken from opendkim log lines, else common names are probed)"`
}

DNSIn are arguments.

type DoctorIn

type DoctorIn struct {
	Since   string   `json:"since,omitempty" jsonschema:"log window (default 24h)"`
	Domain  string   `json:"domain,omitempty" jsonschema:"sending domain for DNS checks"`
	IPs     []string `json:"ips,omitempty" jsonschema:"sending IPs"`
	SkipDNS bool     `json:"skip_dns,omitempty" jsonschema:"do not run DNS checks"`
}

DoctorIn are arguments.

type FlushIn

type FlushIn struct {
	QueueIDs []string `json:"queue_ids,omitempty" jsonschema:"retry these queue IDs now (postqueue -i)"`
	Site     string   `json:"site,omitempty" jsonschema:"retry everything queued for this destination domain (postqueue -s)"`
	All      bool     `json:"all,omitempty" jsonschema:"retry the whole deferred queue (postqueue -f); avoid while a receiver is throttling you"`
	Confirm  bool     `json:"confirm" jsonschema:"must be true; confirms the operator asked for this change"`
}

FlushIn are arguments.

type IDsIn

type IDsIn struct {
	QueueIDs []string `json:"queue_ids" jsonschema:"explicit queue IDs (bulk ALL is not supported)"`
	Confirm  bool     `json:"confirm" jsonschema:"must be true; confirms the operator asked for this change"`
}

IDsIn are arguments for mutating tools.

type LogStatsIn

type LogStatsIn struct {
	Since  string `json:"since,omitempty" jsonschema:"time window, e.g. 1h, 24h (default), 7d, or all"`
	Domain string `json:"domain,omitempty" jsonschema:"only this recipient domain (leading dot = include subdomains)"`
	Top    int    `json:"top,omitempty" jsonschema:"max entries per list (default 15)"`
}

LogStatsIn are arguments.

type LogTrendIn added in v0.2.0

type LogTrendIn struct {
	Since  string `json:"since,omitempty" jsonschema:"time window, e.g. 1h, 24h (default), 7d, or all"`
	Domain string `json:"domain,omitempty" jsonschema:"only this recipient domain (leading dot = include subdomains)"`
	Bucket string `json:"bucket,omitempty" jsonschema:"bucket size, e.g. 15m, 1h, 4h, 12h, 1d (default: auto from window)"`
	Top    int    `json:"top,omitempty" jsonschema:"max destinations (default 15)"`
}

LogTrendIn are arguments.

type Options

type Options struct {
	Version        string
	AllowMutations bool
}

Options configure the server.

type PlaybookIn added in v0.2.1

type PlaybookIn struct {
	Reply    string `` /* 224-byte string literal not displayed */
	Domain   string `` /* 142-byte string literal not displayed */
	ID       string `json:"id,omitempty" jsonschema:"return this one playbook, e.g. gmail-4.7.28, microsoft-s3150, yahoo-deferred (see available)"`
	Provider string `json:"provider,omitempty" jsonschema:"only this provider when scanning the server: gmail, microsoft or yahoo"`
	Since    string `json:"since,omitempty" jsonschema:"log window when scanning the server, e.g. 1h, 24h (default), 7d, or all"`
}

PlaybookIn are arguments.

type PlaybookOut added in v0.2.1

type PlaybookOut struct {
	Mode      string                 `json:"mode" jsonschema:"server (queue and log were scanned), reply (one reply was looked up) or id (one playbook by id)"`
	Server    *doctor.PlaybookResult `` /* 166-byte string literal not displayed */
	Lookup    *doctor.ReplyLookup    `` /* 139-byte string literal not displayed */
	Playbook  *provider.Playbook     `json:"playbook,omitempty" jsonschema:"mode id: the playbook"`
	Available []PlaybookSummary      `json:"available,omitempty" jsonschema:"every built-in playbook id; included when nothing matched"`
}

PlaybookOut is the result; which field is set depends on mode.

type PlaybookSummary added in v0.2.1

type PlaybookSummary struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
	Codes    string `json:"codes"`
	Title    string `json:"title"`
}

PlaybookSummary names one built-in playbook.

type QueueListIn

type QueueListIn struct {
	Queue          string `json:"queue,omitempty" jsonschema:"queue name filter, e.g. deferred"`
	Domain         string `json:"domain,omitempty" jsonschema:"recipient domain; a leading dot matches subdomains too"`
	Sender         string `json:"sender,omitempty" jsonschema:"substring of the envelope sender"`
	ReasonContains string `json:"reason_contains,omitempty" jsonschema:"case-insensitive substring of the delay reason"`
	Category       string `json:"category,omitempty" jsonschema:"reason category id, e.g. rate_limit, auth, ptr, timeout"`
	MinAge         string `json:"min_age,omitempty" jsonschema:"only messages older than this, e.g. 2h or 3d"`
	Limit          int    `json:"limit,omitempty" jsonschema:"max messages returned (default 50)"`
}

QueueListIn are arguments.

type QueueListOut

type QueueListOut struct {
	Matched  int             `json:"matched"`
	Returned int             `json:"returned"`
	Messages []queue.Message `json:"messages"`
}

QueueListOut is the result.

type QueueMessageIn added in v0.2.2

type QueueMessageIn struct {
	QueueID string `json:"queue_id" jsonschema:"one Postfix queue ID, e.g. 4F2A1C3B9D (short) or 4bNqJx2rG9z1Hk (long), from postfix_queue_list"`
}

QueueMessageIn are arguments. There is deliberately no option to turn redaction off over MCP.

type QueueSummaryIn

type QueueSummaryIn struct {
	Queue string `json:"queue,omitempty" jsonschema:"only this queue: active, deferred, hold, incoming, maildrop or corrupt (default all)"`
	Top   int    `json:"top,omitempty" jsonschema:"max entries per list (default 10)"`
}

QueueSummaryIn are arguments.

type ShapeIn

type ShapeIn struct {
	Queue string `json:"queue,omitempty" jsonschema:"queue to shape (default deferred; 'all' for every queue)"`
	By    string `json:"by,omitempty" jsonschema:"recipient (default) or sender domain"`
	Top   int    `json:"top,omitempty" jsonschema:"max domains (default 20)"`
}

ShapeIn are arguments.

type ShapeOut

type ShapeOut struct {
	queue.Shape
	Text string `json:"text"`
}

ShapeOut wraps the matrix with a text rendering.

type TraceIn

type TraceIn struct {
	Query string `json:"query" jsonschema:"a queue ID (e.g. 4F2A1C3B9) or an email address"`
	Since string `json:"since,omitempty" jsonschema:"time window (default 7d)"`
	Limit int    `json:"limit,omitempty" jsonschema:"max messages (default 20, newest kept)"`
}

TraceIn are arguments.

type TraceOut

type TraceOut struct {
	Source   string                  `json:"source"`
	Messages []maillog.TracedMessage `json:"messages"`
}

TraceOut is the result.

Jump to

Keyboard shortcuts

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