Documentation
¶
Overview ¶
Package mcp provides MCP (Model Context Protocol) server functionality for pagent. It exposes pagent's agent orchestration capabilities as MCP tools.
Index ¶
- Constants
- Variables
- type AgentInfo
- type AgentStatus
- type GetStatusInput
- type GetStatusOutput
- type Handlers
- func (h *Handlers) GetStatus(_ context.Context, input GetStatusInput) GetStatusOutput
- func (h *Handlers) ListAgents(_ context.Context, _ ListAgentsInput) ListAgentsOutput
- func (h *Handlers) RunAgent(ctx context.Context, input RunAgentInput) RunAgentOutput
- func (h *Handlers) RunPipeline(ctx context.Context, input RunPipelineInput) (RunPipelineOutput, error)
- func (h *Handlers) SendMessage(_ context.Context, input SendMessageInput) SendMessageOutput
- func (h *Handlers) StopAgents(_ context.Context, input StopAgentsInput) StopAgentsOutput
- func (h *Handlers) WithConfigPath(path string) *Handlers
- func (h *Handlers) WithVerbose(verbose bool) *Handlers
- type ListAgentsInput
- type ListAgentsOutput
- type OAuthConfig
- type RunAgentInput
- type RunAgentOutput
- type RunPipelineInput
- type RunPipelineOutput
- type SendMessageInput
- type SendMessageOutput
- type Server
- type ServerConfig
- type StopAgentsInput
- type StopAgentsOutput
Constants ¶
const ( // ServerName is the MCP server name. ServerName = "pagent" // ServerVersion is the MCP server version. ServerVersion = "1.0.0" )
const ServerInstructions = `` /* 759-byte string literal not displayed */
ServerInstructions provides usage guidance for LLMs.
Variables ¶
var AgentDescriptions = map[string]string{
"architect": "Analyzes PRD and creates technical architecture document",
"qa": "Creates comprehensive test plan based on architecture",
"security": "Performs security assessment and threat modeling",
"implementer": "Implements the code based on architecture and security specs",
"verifier": "Verifies implementation against test plan and requirements",
}
AgentDescriptions maps agent names to their descriptions.
Functions ¶
This section is empty.
Types ¶
type AgentInfo ¶
type AgentInfo struct {
Name string `json:"name"`
Output string `json:"output"`
DependsOn []string `json:"depends_on"`
Description string `json:"description"`
}
AgentInfo describes an available agent.
type AgentStatus ¶
type AgentStatus struct {
Name string `json:"name"`
Port int `json:"port"`
Status string `json:"status"` // "running" or "stable"
StartedAt string `json:"started_at,omitempty"`
}
AgentStatus describes the status of a running agent.
type GetStatusInput ¶
type GetStatusInput struct {
AgentName string `json:"agent_name,omitempty" jsonschema:"Specific agent to check (empty for all running agents)"`
}
GetStatusInput defines parameters for getting agent status.
type GetStatusOutput ¶
type GetStatusOutput struct {
Agents []AgentStatus `json:"agents"`
}
GetStatusOutput contains agent status information.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers provides the business logic for MCP tool handlers. It can be used standalone or injected into the MCP server.
func (*Handlers) GetStatus ¶
func (h *Handlers) GetStatus(_ context.Context, input GetStatusInput) GetStatusOutput
GetStatus returns the status of running agents.
func (*Handlers) ListAgents ¶
func (h *Handlers) ListAgents(_ context.Context, _ ListAgentsInput) ListAgentsOutput
ListAgents returns all available agents.
func (*Handlers) RunAgent ¶
func (h *Handlers) RunAgent(ctx context.Context, input RunAgentInput) RunAgentOutput
RunAgent executes a single agent.
func (*Handlers) RunPipeline ¶
func (h *Handlers) RunPipeline(ctx context.Context, input RunPipelineInput) (RunPipelineOutput, error)
RunPipeline executes the full agent pipeline.
func (*Handlers) SendMessage ¶
func (h *Handlers) SendMessage(_ context.Context, input SendMessageInput) SendMessageOutput
SendMessage sends a message to a running agent.
func (*Handlers) StopAgents ¶
func (h *Handlers) StopAgents(_ context.Context, input StopAgentsInput) StopAgentsOutput
StopAgents stops running agents.
func (*Handlers) WithConfigPath ¶
WithConfigPath sets the config file path.
func (*Handlers) WithVerbose ¶
WithVerbose enables verbose logging.
type ListAgentsInput ¶
type ListAgentsInput struct{}
ListAgentsInput defines parameters for listing agents.
type ListAgentsOutput ¶
type ListAgentsOutput struct {
Agents []AgentInfo `json:"agents"`
}
ListAgentsOutput contains available agents.
type OAuthConfig ¶
type OAuthConfig struct {
Provider string // okta, google, azure, hmac
Issuer string
Audience string
ServerURL string // Base URL for OAuth callbacks (e.g., https://example.com:8080)
}
OAuthConfig holds OAuth-specific configuration.
type RunAgentInput ¶
type RunAgentInput struct {
PRDPath string `json:"prd_path" jsonschema:"Absolute path to the PRD or requirements file"`
AgentName string `json:"agent_name" jsonschema:"Name of the agent to run (architect/qa/security/implementer/verifier)"`
OutputDir string `json:"output_dir,omitempty" jsonschema:"Output directory for generated files (default: ./outputs)"`
Persona string `json:"persona,omitempty" jsonschema:"Implementation style: minimal/balanced/production (default: balanced)"`
Verbose bool `json:"verbose,omitempty" jsonschema:"Enable verbose debug output"`
}
RunAgentInput defines parameters for running a single agent.
type RunAgentOutput ¶
type RunAgentOutput struct {
Agent string `json:"agent"`
OutputPath string `json:"output_path"`
Duration string `json:"duration"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
RunAgentOutput contains the result of running an agent.
type RunPipelineInput ¶
type RunPipelineInput struct {
PRDPath string `json:"prd_path" jsonschema:"Absolute path to the PRD or requirements file"`
Agents []string `json:"agents,omitempty" jsonschema:"Specific agents to run (default: all agents in dependency order)"`
OutputDir string `json:"output_dir,omitempty" jsonschema:"Output directory for generated files (default: ./outputs)"`
Persona string `json:"persona,omitempty" jsonschema:"Implementation style: minimal/balanced/production (default: balanced)"`
Sequential bool `json:"sequential,omitempty" jsonschema:"Run agents sequentially instead of parallel-by-level"`
Verbose bool `json:"verbose,omitempty" jsonschema:"Enable verbose debug output"`
}
RunPipelineInput defines parameters for running the full agent pipeline.
type RunPipelineOutput ¶
type RunPipelineOutput struct {
Results []RunAgentOutput `json:"results"`
TotalAgents int `json:"total_agents"`
Successful int `json:"successful"`
Failed int `json:"failed"`
TotalDuration string `json:"total_duration"`
}
RunPipelineOutput contains the results of running the pipeline.
type SendMessageInput ¶
type SendMessageInput struct {
AgentName string `json:"agent_name" jsonschema:"Name of the running agent to message"`
Message string `json:"message" jsonschema:"Message content to send to the agent"`
}
SendMessageInput defines parameters for sending a message to a running agent.
type SendMessageOutput ¶
type SendMessageOutput struct {
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
SendMessageOutput contains the result of sending a message.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MCP server with all components.
func NewServer ¶
func NewServer(cfg *ServerConfig) *Server
NewServer creates a new MCP server instance with all components.
func (*Server) ServeHTTPWithOAuth ¶
ServeHTTPWithOAuth starts the MCP server with OAuth 2.1 authentication.
func (*Server) ServeStdio ¶
ServeStdio starts the MCP server with STDIO transport.
type ServerConfig ¶
type ServerConfig struct {
Name string
Version string
Instructions string
Logger *slog.Logger
Handlers *Handlers
// Transport settings
Port int
SessionTimeout time.Duration
// OAuth settings (optional)
OAuth *OAuthConfig
}
ServerConfig holds configuration for creating an MCP server.
func DefaultServerConfig ¶
func DefaultServerConfig() *ServerConfig
DefaultServerConfig returns a ServerConfig with sensible defaults.
type StopAgentsInput ¶
type StopAgentsInput struct {
AgentName string `json:"agent_name,omitempty" jsonschema:"Specific agent to stop (empty to stop all)"`
}
StopAgentsInput defines parameters for stopping agents.
type StopAgentsOutput ¶
type StopAgentsOutput struct {
Stopped []string `json:"stopped"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
StopAgentsOutput contains the result of stopping agents.