mcpserver

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mcpserver exposes muster's daemon operations as MCP tools over stdio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context) error

Run builds the muster MCP server, registers all tools, and serves over stdio. It blocks until the client disconnects or ctx is cancelled.

Types

type AgentView

type AgentView struct {
	Alias        string `json:"alias" jsonschema:"the agent's addressable alias"`
	Role         string `json:"role" jsonschema:"the agent's role (producer, consumer, reviewer, ...)"`
	ModelType    string `json:"model_type" jsonschema:"the agent's model (claude or codex)"`
	SessionName  string `json:"session_name" jsonschema:"the tmux session the agent runs in"`
	RegisteredAt int64  `json:"registered_at" jsonschema:"when the agent first registered (unix ms)"`
	LastSeen     int64  `json:"last_seen" jsonschema:"when the agent was last active (unix ms)"`
}

AgentView is the tool-facing shape of a registered agent. Field tags match the daemon's JSON case-insensitively.

type EntryIDOut

type EntryIDOut struct {
	EntryID int64 `json:"entry_id" jsonschema:"the created entry's id"`
}

EntryIDOut is the output of reply.

type EntryView

type EntryView struct {
	ID           int64  `json:"id" jsonschema:"the entry id"`
	ThreadID     int64  `json:"thread_id" jsonschema:"the parent thread id"`
	FromAgent    string `json:"from_agent" jsonschema:"who wrote this entry"`
	Body         string `json:"body" jsonschema:"the entry text"`
	StatusChange string `json:"status_change" jsonschema:"the status this entry set, if any"`
	CreatedAt    int64  `json:"created_at" jsonschema:"when the entry was written (unix ms)"`
}

EntryView is one append-only entry within a thread.

type GetInboxIn

type GetInboxIn struct {
	Alias string `json:"alias" jsonschema:"the agent whose inbox to read"`
}

GetInboxIn is the input to get_inbox.

type GetInboxOut

type GetInboxOut struct {
	Threads []ThreadView `json:"threads" jsonschema:"threads that concern the agent: addressed to it, its role, broadcast, or originated by it"`
}

GetInboxOut is the output of get_inbox.

type GetThreadIn

type GetThreadIn struct {
	ThreadID int64 `json:"thread_id" jsonschema:"the thread to fetch"`
}

GetThreadIn is the input to get_thread.

type GetThreadOut

type GetThreadOut struct {
	Thread  ThreadView  `json:"thread" jsonschema:"the thread"`
	Entries []EntryView `json:"entries" jsonschema:"the thread's entries in order"`
}

GetThreadOut is the output of get_thread.

type KVGetIn

type KVGetIn struct {
	Key string `json:"key" jsonschema:"the fact key to read"`
}

KVGetIn is the input for the kv_get tool.

type KVGetOut

type KVGetOut struct {
	Found     bool   `json:"found" jsonschema:"whether the key exists"`
	Value     string `json:"value" jsonschema:"the stored value (empty if not found)"`
	UpdatedBy string `json:"updated_by" jsonschema:"who last set the value"`
	UpdatedAt int64  `json:"updated_at" jsonschema:"when it was last set (unix ms)"`
}

KVGetOut is the output of the kv_get tool.

type KVSetIn

type KVSetIn struct {
	Key   string `json:"key" jsonschema:"the fact key, e.g. api.base or schema.version"`
	Value string `json:"value" jsonschema:"the value to store"`
	By    string `json:"by" jsonschema:"the alias setting the value"`
}

KVSetIn is the input for the kv_set tool.

type ListAgentsIn

type ListAgentsIn struct{}

ListAgentsIn has no fields; list_agents takes no arguments.

type ListAgentsOut

type ListAgentsOut struct {
	Agents []AgentView `json:"agents" jsonschema:"the registered agents"`
}

ListAgentsOut wraps the agent list (Out must be a struct, not a bare slice).

type OKOut

type OKOut struct {
	OK     bool   `json:"ok" jsonschema:"whether the operation succeeded"`
	Detail string `json:"detail,omitempty" jsonschema:"optional human-readable detail"`
}

OKOut is a simple success acknowledgement for void operations.

type RegisterAgentIn

type RegisterAgentIn struct {
	Alias       string `json:"alias" jsonschema:"a short addressable name for this agent, e.g. backend"`
	Role        string `json:"role" jsonschema:"this agent's role: producer, consumer, reviewer, ..."`
	ModelType   string `json:"model_type" jsonschema:"the model backing this agent: claude or codex"`
	SessionName string `json:"session_name,omitempty" jsonschema:"optional tmux session name for display"`
}

RegisterAgentIn is the input to register_agent. socket_path/pane_id are NOT input — they are captured from the process environment ($TMUX, $TMUX_PANE), which the agent's MCP server inherits from its tmux pane.

type ReplyIn

type ReplyIn struct {
	ThreadID int64  `json:"thread_id" jsonschema:"the thread to reply to"`
	From     string `json:"from" jsonschema:"the replying agent's alias"`
	Body     string `json:"body" jsonschema:"the reply text"`
}

ReplyIn is the input to reply.

type SendMessageIn

type SendMessageIn struct {
	From     string `json:"from" jsonschema:"the sending agent's alias"`
	ToKind   string `json:"to_kind" jsonschema:"agent, role, or broadcast"`
	ToTarget string `` /* 206-byte string literal not displayed */
	Subject  string `json:"subject" jsonschema:"a short subject line"`
	Ref      string `json:"ref,omitempty" jsonschema:"optional pointer to the work (repo/branch/endpoint/file)"`
	Body     string `json:"body" jsonschema:"the message body"`
	Intent   string `` /* 211-byte string literal not displayed */
}

SendMessageIn is the input to send_message.

type TaskClaimIn

type TaskClaimIn struct {
	ThreadID int64  `json:"thread_id" jsonschema:"the task thread to claim"`
	By       string `json:"by" jsonschema:"the alias of the agent claiming the task"`
}

TaskClaimIn is the input to task_claim.

type TaskCreateIn

type TaskCreateIn struct {
	From     string `json:"from" jsonschema:"the requesting agent's alias"`
	ToKind   string `json:"to_kind" jsonschema:"agent, role, or broadcast"`
	ToTarget string `` /* 144-byte string literal not displayed */
	Subject  string `json:"subject" jsonschema:"a short task title"`
	Ref      string `json:"ref,omitempty" jsonschema:"optional pointer to the work (repo/branch/endpoint/file)"`
	Body     string `json:"body" jsonschema:"task details"`
	Intent   string `` /* 257-byte string literal not displayed */
}

TaskCreateIn is the input to task_create.

type TaskTransitionIn

type TaskTransitionIn struct {
	ThreadID int64  `json:"thread_id" jsonschema:"the task thread to update"`
	By       string `json:"by" jsonschema:"the alias making the change"`
	Status   string `json:"status" jsonschema:"new status: open, claimed, needs_info, blocked, completed, declined, or cancelled"`
	Note     string `json:"note,omitempty" jsonschema:"optional note recorded with the status change"`
}

TaskTransitionIn is the input to task_transition.

type ThreadIDOut

type ThreadIDOut struct {
	ThreadID int64 `json:"thread_id" jsonschema:"the created thread's id"`
}

ThreadIDOut is the output of send_message and task_create.

type ThreadView

type ThreadView struct {
	ID         int64  `json:"id" jsonschema:"the thread id"`
	Kind       string `json:"kind" jsonschema:"message or task"`
	FromAgent  string `json:"from_agent" jsonschema:"who created the thread"`
	ToKind     string `json:"to_kind" jsonschema:"agent, role, or broadcast"`
	ToTarget   string `json:"to_target" jsonschema:"the addressed alias or role"`
	Subject    string `json:"subject" jsonschema:"the thread subject"`
	Ref        string `json:"ref" jsonschema:"a pointer to the work (repo/branch/endpoint/file)"`
	Status     string `json:"status" jsonschema:"task status, empty for messages"`
	CreatedAt  int64  `json:"created_at" jsonschema:"creation time (unix ms)"`
	UpdatedAt  int64  `json:"updated_at" jsonschema:"last-update time (unix ms)"`
	LastFrom   string `json:"last_from" jsonschema:"who wrote the thread's most recent entry"`
	LastAt     int64  `json:"last_at" jsonschema:"when the most recent entry was written (unix ms)"`
	EntryCount int    `json:"entry_count" jsonschema:"total entries in the thread"`
	Unread     int    `json:"unread" jsonschema:"entries after your last read that you didn't write yourself; 0 means you've seen everything"`
}

ThreadView is the tool-facing shape of a message/task thread. LastFrom, LastAt, EntryCount, and Unread are query-time annotations the daemon's get_inbox (and get_thread, for its own thread) populate from store.Thread — zero-valued when a surface doesn't compute them, so they're additive fields, not a breaking change to existing callers.

Jump to

Keyboard shortcuts

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