Documentation
¶
Overview ¶
Package mcp defines the expression types used to represent MCP server configuration during Goa design evaluation. These types are populated during DSL execution and form the schema used for MCP protocol code generation.
Package mcp defines the expression types used to represent MCP server configuration during Goa design evaluation. These types are populated during DSL execution and form the schema used for MCP protocol code generation.
Index ¶
- Constants
- type CapabilitiesExpr
- type DynamicPromptExpr
- type IconExpr
- type MCPExpr
- type MessageExpr
- type NotificationExpr
- type OAuthExpr
- type PromptExpr
- type ResourceExpr
- type RootExpr
- func (r *RootExpr) DependsOn() []eval.Root
- func (r *RootExpr) EvalName() string
- func (r *RootExpr) GetMCP(svc *expr.ServiceExpr) *MCPExpr
- func (r *RootExpr) HasMCP(svc *expr.ServiceExpr) bool
- func (r *RootExpr) Packages() []string
- func (r *RootExpr) RegisterDynamicPrompt(svc *expr.ServiceExpr, prompt *DynamicPromptExpr)
- func (r *RootExpr) RegisterMCP(svc *expr.ServiceExpr, mcp *MCPExpr)
- func (r *RootExpr) ServiceMCP(service, toolset string) *MCPExpr
- func (r *RootExpr) Validate() error
- func (r *RootExpr) WalkSets(walk eval.SetWalker)
- type RuntimePromptExpr
- type ScopeExpr
- type SkillDirectoryExpr
- type SubscriptionExpr
- type SubscriptionMonitorExpr
- type ToolExpr
- type ToolSearchExpr
- type ToolSearchWeightsExpr
Constants ¶
const ( // ToolSearchExactMatchNarrow suppresses weaker matches when a query exactly // matches a tool name or title. ToolSearchExactMatchNarrow = "narrow" // ToolSearchExactMatchBoost ranks exact matches highly but keeps lower // confidence matches eligible. ToolSearchExactMatchBoost = "boost" // ToolSearchExactMatchOff disables exact-match special handling. ToolSearchExactMatchOff = "off" )
const ( // IconThemeLight declares that the icon is designed for light backgrounds. IconThemeLight = "light" // IconThemeDark declares that the icon is designed for dark backgrounds. IconThemeDark = "dark" // RuntimePromptRoleSystem identifies runtime system prompts. RuntimePromptRoleSystem = "system" // RuntimePromptRoleUser identifies runtime user prompts. RuntimePromptRoleUser = "user" // RuntimePromptRoleTool identifies runtime tool prompts. RuntimePromptRoleTool = "tool" // RuntimePromptRoleSynthesis identifies runtime synthesis prompts. RuntimePromptRoleSynthesis = "synthesis" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapabilitiesExpr ¶
type CapabilitiesExpr struct {
eval.Expression
// EnableTools indicates whether the server exposes tool
// invocation.
EnableTools bool
// EnableResources indicates whether the server exposes resource
// access.
EnableResources bool
// EnablePrompts indicates whether the server exposes prompt
// templates.
EnablePrompts bool
// EnableLogging indicates whether the server supports logging.
EnableLogging bool
// EnableProgress indicates whether the server supports progress
// notifications.
EnableProgress bool
// EnableCancellation indicates whether the server supports
// request cancellation.
EnableCancellation bool
// EnableNotifications indicates whether the server can send
// notifications.
EnableNotifications bool
// EnableCompletion indicates whether the server supports
// completion suggestions.
EnableCompletion bool
// EnablePagination indicates whether the server supports
// paginated responses.
EnablePagination bool
// EnableSubscriptions indicates whether the server supports
// resource subscriptions.
EnableSubscriptions bool
}
CapabilitiesExpr defines which MCP protocol capabilities a server supports.
func (*CapabilitiesExpr) EvalName ¶
func (c *CapabilitiesExpr) EvalName() string
EvalName returns the name used for evaluation.
type DynamicPromptExpr ¶
type DynamicPromptExpr struct {
eval.Expression
// Name is the unique identifier for this dynamic prompt.
Name string
// Description provides a human-readable explanation of the prompt's
// purpose.
Description string
// Method is the Goa service method that generates this prompt.
Method *expr.MethodExpr
// Icons is the optional icon metadata exposed for this prompt.
Icons []*IconExpr
}
DynamicPromptExpr defines a dynamic prompt generated at runtime by a service method.
func (*DynamicPromptExpr) EvalName ¶
func (d *DynamicPromptExpr) EvalName() string
EvalName returns the name used for evaluation.
type IconExpr ¶ added in v1.0.6
type IconExpr struct {
eval.Expression
// Source is the icon URI or data URI.
Source string
// MIMEType is the optional icon content type.
MIMEType string
// Sizes lists supported icon sizes.
Sizes []string
// Theme is the optional theme preference for the icon.
Theme string
}
IconExpr defines one icon metadata entry exposed through MCP.
type MCPExpr ¶
type MCPExpr struct {
eval.Expression
// Name is the MCP server name as advertised to MCP clients.
Name string
// Version is the server implementation version.
Version string
// Description provides a human-readable explanation of the
// server's purpose.
Description string
// WebsiteURL is the optional documentation or home page URL for the
// server implementation.
WebsiteURL string
// Icons is the optional icon metadata exposed for the server
// implementation.
Icons []*IconExpr
// ProtocolVersion is the MCP protocol version this server
// implements.
ProtocolVersion string
// Transport is the transport mechanism (e.g., "jsonrpc",
// "sse").
Transport string
// Capabilities defines which MCP capabilities this server
// supports.
Capabilities *CapabilitiesExpr
// Tools is the collection of tool expressions exposed by this
// server.
Tools []*ToolExpr
// Resources is the collection of resource expressions exposed
// by this server.
Resources []*ResourceExpr
// SkillDirectories are filesystem roots scanned for agent skills
// and exposed as skill:// MCP resources.
SkillDirectories []*SkillDirectoryExpr
// Prompts is the collection of static prompt expressions
// exposed by this server.
Prompts []*PromptExpr
// Notifications is the collection of notification expressions
// this server can send.
Notifications []*NotificationExpr
// Subscriptions is the collection of resource subscription
// expressions this server supports.
Subscriptions []*SubscriptionExpr
// SubscriptionMonitors is the collection of subscription
// monitor expressions for SSE.
SubscriptionMonitors []*SubscriptionMonitorExpr
// OAuth is the optional OAuth 2.0 protected-resource configuration
// that drives Protected Resource Metadata emission and the
// WWW-Authenticate challenge. When nil, the server does not
// advertise OAuth discovery.
OAuth *OAuthExpr
// ToolSearch is the optional design-time default policy for generated
// progressive tool discovery.
ToolSearch *ToolSearchExpr
// Service is the Goa service expression this MCP server is
// bound to.
Service *expr.ServiceExpr
}
MCPExpr defines MCP server configuration for a Goa service.
type MessageExpr ¶
type MessageExpr struct {
eval.Expression
// Role is the message sender role (e.g., "user", "assistant").
Role string
// Content is the message text content or template.
Content string
}
MessageExpr defines a single message within a prompt template.
func (*MessageExpr) EvalName ¶
func (m *MessageExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*MessageExpr) Validate ¶ added in v1.2.2
func (m *MessageExpr) Validate() error
Validate validates a static prompt message expression.
type NotificationExpr ¶
type NotificationExpr struct {
eval.Expression
// Name is the unique identifier for this notification type.
Name string
// Description provides a human-readable explanation of the
// notification.
Description string
// Method is the Goa service method that sends this notification.
Method *expr.MethodExpr
}
NotificationExpr defines a notification that the server can send to clients.
func (*NotificationExpr) EvalName ¶
func (n *NotificationExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*NotificationExpr) Validate ¶ added in v1.2.2
func (n *NotificationExpr) Validate() error
Validate validates a notification expression.
type OAuthExpr ¶ added in v1.1.0
type OAuthExpr struct {
// AuthorizationServers lists the OAuth 2.0 authorization servers
// that can issue tokens for this resource. Required; at least
// one entry.
AuthorizationServers []string
// Scopes documents the scopes the resource defines.
Scopes []*ScopeExpr
// ResourceIdentifier is the optional canonical audience URI
// emitted as the "resource" field in PRM JSON. When empty, the
// generated handler derives it from the incoming request.
ResourceIdentifier string
// BearerMethodsSupported enumerates the ways a client may
// present a bearer token. Defaults to ["header"] at generation
// time when empty.
BearerMethodsSupported []string
// ResourceDocumentationURL surfaces as resource_documentation
// in the PRM document.
ResourceDocumentationURL string
// TrustProxyHeaders determines whether the generated server
// consumes X-Forwarded-Proto / X-Forwarded-Host / Forwarded
// headers when deriving the canonical resource URL or the
// challenge origin. Default is false: forwarded headers are
// ignored entirely, and origin is derived from r.Host + r.TLS.
// Enable this only when the server sits behind a proxy the
// operator fully controls and trusts — otherwise an attacker
// with direct access can poison the PRM `resource` field.
TrustProxyHeaders bool
}
OAuthExpr describes the OAuth 2.0 protected-resource configuration exposed by an MCP server. It backs the Protected Resource Metadata document (RFC 9728) served at .well-known/oauth-protected-resource and the WWW-Authenticate challenge emitted for unauthenticated requests.
type PromptExpr ¶
type PromptExpr struct {
eval.Expression
// Name is the unique identifier for this prompt.
Name string
// Description provides a human-readable explanation of the
// prompt's purpose.
Description string
// Arguments defines the parameter schema for this prompt
// template.
Arguments *expr.AttributeExpr
// Messages is the collection of message templates in this
// prompt.
Messages []*MessageExpr
// Runtime optionally declares that this MCP prompt should also be
// registered as a runtime prompt spec.
Runtime *RuntimePromptExpr
// Icons is the optional icon metadata exposed for this prompt.
Icons []*IconExpr
}
PromptExpr defines a static MCP prompt template exposed by the server.
func (*PromptExpr) EvalName ¶
func (p *PromptExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*PromptExpr) Validate ¶
func (p *PromptExpr) Validate() error
Validate validates a prompt expression
type ResourceExpr ¶
type ResourceExpr struct {
eval.Expression
// Name is the unique identifier for this resource.
Name string
// Description provides a human-readable explanation of the
// resource.
Description string
// URI is the resource identifier used for access.
URI string
// MimeType is the MIME type of the resource content.
MimeType string
// Method is the Goa service method that provides this resource.
Method *expr.MethodExpr
// Watchable indicates whether this resource supports change
// notifications.
Watchable bool
// Icons is the optional icon metadata exposed for this resource.
Icons []*IconExpr
}
ResourceExpr defines an MCP resource that the server exposes for access.
func (*ResourceExpr) EvalName ¶
func (r *ResourceExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*ResourceExpr) Validate ¶
func (r *ResourceExpr) Validate() error
Validate validates a resource expression
type RootExpr ¶
type RootExpr struct {
// MCPServers maps service names to their MCP server configurations.
MCPServers map[string]*MCPExpr
// DynamicPrompts maps service names to their dynamic prompt
// expressions.
DynamicPrompts map[string][]*DynamicPromptExpr
// contains filtered or unexported fields
}
RootExpr is the top-level root expression for all MCP server declarations.
var Root *RootExpr
Root is the plugin root instance holding all MCP server configurations.
func (*RootExpr) GetMCP ¶
func (r *RootExpr) GetMCP(svc *expr.ServiceExpr) *MCPExpr
GetMCP returns the MCP configuration for a service.
func (*RootExpr) HasMCP ¶
func (r *RootExpr) HasMCP(svc *expr.ServiceExpr) bool
HasMCP returns true if the service has an MCP configuration.
func (*RootExpr) Packages ¶
Packages returns the DSL packages that should be recognized for error reporting.
func (*RootExpr) RegisterDynamicPrompt ¶
func (r *RootExpr) RegisterDynamicPrompt(svc *expr.ServiceExpr, prompt *DynamicPromptExpr)
RegisterDynamicPrompt registers a dynamic prompt for a service
func (*RootExpr) RegisterMCP ¶
func (r *RootExpr) RegisterMCP(svc *expr.ServiceExpr, mcp *MCPExpr)
RegisterMCP registers an MCP server configuration for a service
func (*RootExpr) ServiceMCP ¶
ServiceMCP returns the MCP configuration for a service name and optional toolset (server name) filter. When toolset is empty, it returns the MCP server for the service if present.
type RuntimePromptExpr ¶ added in v1.2.2
type RuntimePromptExpr struct {
eval.Expression
// AgentID identifies the owning runtime agent.
AgentID string
// Role identifies how the prompt is used at runtime.
Role string
// Version identifies the baseline runtime prompt version.
Version string
}
RuntimePromptExpr describes the runtime prompt spec generated from a static MCP prompt declaration.
func (*RuntimePromptExpr) EvalName ¶ added in v1.2.2
func (r *RuntimePromptExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*RuntimePromptExpr) Validate ¶ added in v1.2.2
func (r *RuntimePromptExpr) Validate() error
Validate validates a runtime prompt expression.
type ScopeExpr ¶ added in v1.1.0
type ScopeExpr struct {
// Name is the scope token value.
Name string
// Description is the human-readable summary surfaced in PRM
// JSON and in the WWW-Authenticate challenge.
Description string
}
ScopeExpr documents one OAuth 2.0 scope advertised by an MCP server.
type SkillDirectoryExpr ¶ added in v1.2.2
type SkillDirectoryExpr struct {
eval.Expression
// Root is the filesystem directory containing skill subdirectories.
Root string
}
SkillDirectoryExpr declares a filesystem root containing skill directories. Each child directory with a SKILL.md file is exposed as skill:// resources.
func (*SkillDirectoryExpr) EvalName ¶ added in v1.2.2
func (s *SkillDirectoryExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*SkillDirectoryExpr) Validate ¶ added in v1.2.2
func (s *SkillDirectoryExpr) Validate() error
Validate validates a skill directory expression.
type SubscriptionExpr ¶
type SubscriptionExpr struct {
eval.Expression
// ResourceName is the name of the resource being subscribed to.
ResourceName string
// Method is the Goa service method that handles this subscription.
Method *expr.MethodExpr
}
SubscriptionExpr defines a subscription to resource change events.
func (*SubscriptionExpr) EvalName ¶
func (s *SubscriptionExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*SubscriptionExpr) Validate ¶ added in v1.2.2
func (s *SubscriptionExpr) Validate() error
Validate validates a subscription expression.
type SubscriptionMonitorExpr ¶
type SubscriptionMonitorExpr struct {
eval.Expression
// Name is the unique identifier for this monitor.
Name string
// Method is the Goa service method that implements the monitor.
Method *expr.MethodExpr
}
SubscriptionMonitorExpr defines a subscription monitor for SSE-based subscriptions.
func (*SubscriptionMonitorExpr) EvalName ¶
func (s *SubscriptionMonitorExpr) EvalName() string
EvalName returns the name used for evaluation.
func (*SubscriptionMonitorExpr) Validate ¶ added in v1.2.2
func (s *SubscriptionMonitorExpr) Validate() error
Validate validates a subscription monitor expression.
type ToolExpr ¶
type ToolExpr struct {
eval.Expression
// Name is the unique identifier for this tool.
Name string
// Description provides a human-readable explanation of what the
// tool does.
Description string
// Title is the optional human-readable display name for this tool.
Title string
// DiscoveryCategory is the optional category used by generated
// progressive discovery search metadata.
DiscoveryCategory string
// DiscoveryTags are optional labels used by generated
// progressive discovery search metadata.
DiscoveryTags []string
// DiscoveryKeywords are optional extra search terms used by
// generated progressive discovery search metadata.
DiscoveryKeywords []string
// DiscoveryCallTemplateArgs are optional exemplar arguments included in
// progressive discovery call_tool templates without changing validation.
DiscoveryCallTemplateArgs map[string]any
// Method is the Goa service method that implements this tool.
Method *expr.MethodExpr
// InputSchema defines the parameter schema for this tool.
InputSchema *expr.AttributeExpr
// Icons is the optional icon metadata exposed for this tool.
Icons []*IconExpr
// ExposedSurfaces records projection option use on method-level tools.
ExposedSurfaces []string
// MCPPlacementService records invalid placement use on method-level tools.
MCPPlacementService string
// MCPPlacementServer records invalid placement use on method-level tools.
MCPPlacementServer string
}
ToolExpr defines an MCP tool that the server exposes for invocation.
type ToolSearchExpr ¶ added in v1.2.2
type ToolSearchExpr struct {
eval.Expression
// DefaultMaxResults caps search results when runtime options and
// request payloads do not set a positive max.
DefaultMaxResults int
// MinScore suppresses matches below this generated ranking score.
MinScore int
// ExactMatchMode controls what happens when a query exactly matches a
// tool name or title.
ExactMatchMode string
// FuzzyNameMatching enables fuzzy ranking against tool names and titles.
FuzzyNameMatching *bool
// BroadFallback allows weaker metadata, description, parameter, and
// schema matches when no strong name/title match exists.
BroadFallback *bool
// Weights customizes field weighting for generated ranking.
Weights ToolSearchWeightsExpr
}
ToolSearchExpr configures generated progressive discovery ranking defaults for an MCP server.
func (*ToolSearchExpr) EvalName ¶ added in v1.2.2
func (t *ToolSearchExpr) EvalName() string
EvalName returns the expression name used in validation errors.
func (*ToolSearchExpr) Validate ¶ added in v1.2.2
func (t *ToolSearchExpr) Validate() error
Validate validates the progressive tool discovery search policy.