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

mcpserver

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mcpserver exposes the public API operations as MCP tools: one tool per endpoint, with the same names, arguments, descriptions and hints as the remote server at https://api.postatron.com/mcp (cmd/api/v1/mcp.go in the backend). Change both together.

Index

Constants

View Source
const (
	ToolCreatePost     = "create_post"
	ToolListPosts      = "list_posts"
	ToolGetPost        = "get_post"
	ToolDeletePost     = "delete_post"
	ToolDeletePosts    = "delete_posts"
	ToolUpdatePost     = "update_post"
	ToolRetryPost      = "retry_post"
	ToolListEvents     = "list_events"
	ToolConnectAccount = "connect_account"
	ToolListAccounts   = "list_accounts"
	ToolListProfiles   = "list_profiles"
	ToolListQueues     = "list_queues"
	ToolCreateQueue    = "create_queue"
	ToolUpdateQueue    = "update_queue"
	ToolDeleteQueue    = "delete_queue"
	ToolGetUsage       = "get_usage"
	ToolGetAnalytics   = "get_analytics"
	ToolCreateUpload   = "create_upload"
	ToolGetUpload      = "get_upload"
)

Tool names, kept identical to the CLI commands (with underscores).

Variables

View Source
var Version = "1.0.0"

Version is reported to MCP clients in serverInfo. Overridden at release time with -ldflags "-X ...mcpserver.Version=v1.2.3".

Functions

func New

func New(ops apiv1.Operations) *mcp.Server

New builds an MCP server whose tools call ops.

func Run

func Run(ctx context.Context, ops apiv1.Operations) error

Run serves the tools over stdio until the client disconnects.

Types

type AnalyticsInput added in v1.1.0

type AnalyticsInput struct {
	Range     string `json:"range,omitempty" jsonschema:"One of 7d, 30d, 90d or 365d. Defaults to 30d."`
	Platform  string `` /* 129-byte string literal not displayed */
	AccountID string `json:"account_id,omitempty" jsonschema:"Only this connected account (an id from list_accounts)."`
	Profile   string `json:"profile,omitempty" jsonschema:"Only accounts in this profile (a name or id from list_profiles)."`
	Source    string `json:"source,omitempty" jsonschema:"all (default) or postatron, to count only posts published with Postatron."`
}

AnalyticsInput is the get_analytics tool input.

type ConnectAccountInput added in v1.5.0

type ConnectAccountInput struct {
	Platform  string `` /* 201-byte string literal not displayed */
	Profile   string `` /* 130-byte string literal not displayed */
	AccountID string `` /* 142-byte string literal not displayed */
}

ConnectAccountInput is the connect_account tool input.

type CreatePostInput

type CreatePostInput struct {
	Content     string                  `json:"content" jsonschema:"The post text."`
	AccountIDs  []string                `json:"account_ids,omitempty" jsonschema:"Social account ids from list_accounts or list_profiles."`
	Platforms   []string                `` /* 154-byte string literal not displayed */
	Profile     string                  `` /* 228-byte string literal not displayed */
	ScheduledAt string                  `json:"scheduled_at,omitempty" jsonschema:"RFC 3339 timestamp to publish at. Omit to publish now."`
	Queue       string                  `` /* 254-byte string literal not displayed */
	MediaURLs   []string                `` /* 135-byte string literal not displayed */
	MediaIDs    []string                `` /* 218-byte string literal not displayed */
	X           *apiv1.XOptions         `` /* 426-byte string literal not displayed */
	Instagram   *apiv1.InstagramOptions `` /* 266-byte string literal not displayed */
	TikTok      *apiv1.TikTokOptions    `` /* 868-byte string literal not displayed */
	YouTube     *apiv1.YouTubeOptions   `` /* 504-byte string literal not displayed */
	Pinterest   *apiv1.PinterestOptions `` /* 527-byte string literal not displayed */
}

CreatePostInput is the create_post tool input.

type CreateQueueInput added in v1.8.0

type CreateQueueInput struct {
	Name     string            `json:"name" jsonschema:"What to call it, e.g. Weekday mornings."`
	Profile  string            `json:"profile,omitempty" jsonschema:"The profile (name or id from list_profiles) it posts for. Omit for Default."`
	Timezone string            `json:"timezone" jsonschema:"IANA timezone the slot times are in, e.g. Europe/London. Ask the person if you do not know it."`
	Slots    []apiv1.QueueSlot `` /* 133-byte string literal not displayed */
	Paused   bool              `json:"paused,omitempty" jsonschema:"Create it paused, taking no posts until resumed."`
}

CreateQueueInput is the create_queue tool input.

type CreateUploadInput added in v1.1.0

type CreateUploadInput struct {
	Purpose string `` /* 153-byte string literal not displayed */
}

CreateUploadInput is the create_upload tool input.

type DeletePostsInput added in v1.8.0

type DeletePostsInput struct {
	IDs []string `json:"post_ids" jsonschema:"Up to 100 post ids."`
}

DeletePostsInput is the delete_posts tool input.

type EmptyInput

type EmptyInput struct{}

EmptyInput is used by tools that take no arguments.

type ListEventsInput added in v1.11.0

type ListEventsInput struct {
	Range    string `json:"range,omitempty" jsonschema:"How far back, ending now: 24h, 7d, 30d or 90d. Defaults to 7d; events are kept 90 days."`
	Status   string `json:"status,omitempty" jsonschema:"ok, warning or error; several separated by commas."`
	Type     string `json:"type,omitempty" jsonschema:"posts, accounts or api; several separated by commas."`
	Platform string `json:"platform,omitempty" jsonschema:"Only events about an account on this platform, e.g. instagram."`
	Limit    int    `json:"limit,omitempty" jsonschema:"How many to return, 1 to 100 (default 25)."`
	Cursor   string `json:"cursor,omitempty" jsonschema:"next_cursor from a previous call."`
}

ListEventsInput is the list_events tool input.

type ListPostsInput

type ListPostsInput struct {
	Status   string `json:"status,omitempty" jsonschema:"One of draft, scheduled, pending, processing, published, failed, partial."`
	Platform string `json:"platform,omitempty" jsonschema:"Only posts to this platform, e.g. x or instagram."`
	Profile  string `json:"profile,omitempty" jsonschema:"Only posts to accounts in this profile (a name or id from list_profiles)."`
	From     string `json:"from,omitempty" jsonschema:"RFC 3339 start of the range (scheduled time for scheduled posts, creation time otherwise)."`
	To       string `json:"to,omitempty" jsonschema:"RFC 3339 end of the range."`
	Limit    int    `json:"limit,omitempty" jsonschema:"How many to return, 1 to 100 (default 25)."`
	Cursor   string `json:"cursor,omitempty" jsonschema:"next_cursor from a previous call."`
}

ListPostsInput is the list_posts tool input.

type PostIDInput

type PostIDInput struct {
	PostID string `json:"post_id,omitempty" jsonschema:"The post id."`
	ID     string `json:"id,omitempty" jsonschema:"The same as post_id, the name older clients send."`
}

PostIDInput is shared by get_post and delete_post. post_id is the remote server's name; id is the name this server took before, still accepted.

type QueueInput added in v1.8.0

type QueueInput struct {
	Queue string `json:"queue" jsonschema:"The queue's name or id from list_queues."`
}

QueueInput is the delete_queue tool input.

type RetryPostInput added in v1.11.0

type RetryPostInput struct {
	PostID     string   `json:"post_id" jsonschema:"The id of a failed or partial post, from list_posts or get_post."`
	AccountIDs []string `` /* 130-byte string literal not displayed */
}

RetryPostInput is the retry_post tool input.

type UpdatePostInput added in v1.5.0

type UpdatePostInput struct {
	PostID           string                  `json:"post_id" jsonschema:"The id of a draft or scheduled post, from create_post or list_posts."`
	Content          string                  `json:"content,omitempty" jsonschema:"New text for the post. Omit to keep it."`
	ScheduledAt      string                  `` /* 149-byte string literal not displayed */
	PublishNow       bool                    `json:"publish_now,omitempty" jsonschema:"Publish the post now, after the other changes. Not with scheduled_at."`
	AddPlatforms     []string                `json:"add_platforms,omitempty" jsonschema:"Platforms to add: the account on each in profile, e.g. [\"instagram\"]."`
	AddAccountIDs    []string                `json:"add_account_ids,omitempty" jsonschema:"Specific connected account ids to add, from list_accounts."`
	RemoveAccountIDs []string                `json:"remove_account_ids,omitempty" jsonschema:"Account ids to take off the post. At least one must remain."`
	Profile          string                  `json:"profile,omitempty" jsonschema:"A profile name or id from list_profiles, saying which brand add_platforms means."`
	X                *apiv1.XOptions         `json:"x,omitempty" jsonschema:"Replaces the post's X options as a whole (see create_post); {} clears them."`
	Instagram        *apiv1.InstagramOptions `json:"instagram,omitempty" jsonschema:"Replaces the post's Instagram options as a whole; {} clears them."`
	TikTok           *apiv1.TikTokOptions    `json:"tiktok,omitempty" jsonschema:"Replaces the post's TikTok settings as a whole; {} clears them."`
	YouTube          *apiv1.YouTubeOptions   `json:"youtube,omitempty" jsonschema:"Replaces the post's YouTube options as a whole; {} clears them."`
	Pinterest        *apiv1.PinterestOptions `` /* 196-byte string literal not displayed */
}

UpdatePostInput is the update_post tool input.

type UpdateQueueInput added in v1.8.0

type UpdateQueueInput struct {
	Queue    string             `json:"queue" jsonschema:"The queue's name or id from list_queues."`
	Name     *string            `json:"name,omitempty" jsonschema:"A new name."`
	Profile  *string            `json:"profile,omitempty" jsonschema:"Move the queue to another profile."`
	Timezone *string            `json:"timezone,omitempty" jsonschema:"A new IANA timezone."`
	Slots    *[]apiv1.QueueSlot `json:"slots,omitempty" jsonschema:"Weekly slots; this replaces every slot."`
	Active   *bool              `json:"active,omitempty" jsonschema:"false pauses the queue, true resumes it."`
	// MovePosts moves the queue's upcoming posts onto new slots.
	MovePosts bool `` /* 241-byte string literal not displayed */
}

UpdateQueueInput is the update_queue tool input.

type UploadIDInput added in v1.1.0

type UploadIDInput struct {
	ID string `json:"upload_id" jsonschema:"The id from create_upload."`
}

UploadIDInput is the get_upload tool input.

Jump to

Keyboard shortcuts

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