Documentation
¶
Index ¶
- Variables
- func IsRPCError(err error) bool
- type Composer
- type ConsentRequiredError
- type CredentialResolver
- type Dialer
- type DialerFunc
- type DiscoveryCache
- type Introspector
- type PluginRunner
- type Prompt
- type RPCError
- type Resource
- type ResourceTemplate
- type RoleScoper
- type Target
- type Tool
- type Upstream
Constants ¶
This section is empty.
Variables ¶
var ( ErrToolNotFound = fmt.Errorf("mcp: tool not found: %w", commonerrors.ErrNotFound) ErrPromptNotFound = fmt.Errorf("mcp: prompt not found: %w", commonerrors.ErrNotFound) ErrResourceNotFound = fmt.Errorf("mcp: resource not found: %w", commonerrors.ErrNotFound) ErrNoMCPRegistries = fmt.Errorf("mcp: no MCP registries attached to consumer: %w", commonerrors.ErrValidation) )
var ErrAudienceMismatch = errors.New("mcp: inbound token audience does not match the upstream's expected audience")
var ErrNoPrincipal = errors.New("mcp: downstream auth mode requires an authenticated user identity")
var ErrNoRoleAccess = errors.New("mcp: no role grants MCP access for this identity")
var ErrNotSupported = errors.New("mcp upstream does not support this method")
var ErrUnreachable = errors.New("mcp upstream unreachable")
Functions ¶
func IsRPCError ¶
Types ¶
type Composer ¶
type Composer interface {
ListTools(ctx context.Context, rc *appconsumer.RoutableConsumer) ([]Tool, error)
CallTool(ctx context.Context, rc *appconsumer.RoutableConsumer, name string, arguments json.RawMessage) (json.RawMessage, error)
ListResources(ctx context.Context, rc *appconsumer.RoutableConsumer) ([]Resource, error)
ListResourceTemplates(ctx context.Context, rc *appconsumer.RoutableConsumer) ([]ResourceTemplate, error)
ReadResource(ctx context.Context, rc *appconsumer.RoutableConsumer, uri string) (json.RawMessage, error)
ListPrompts(ctx context.Context, rc *appconsumer.RoutableConsumer) ([]Prompt, error)
GetPrompt(ctx context.Context, rc *appconsumer.RoutableConsumer, name string, arguments map[string]string) (json.RawMessage, error)
}
func NewComposer ¶
func NewComposer(dialer Dialer, creds CredentialResolver, discovery DiscoveryCache, logger *slog.Logger) Composer
type ConsentRequiredError ¶
func (*ConsentRequiredError) Error ¶
func (e *ConsentRequiredError) Error() string
type CredentialResolver ¶
type CredentialResolver interface {
Apply(ctx context.Context, rc *appconsumer.RoutableConsumer, reg *registrydomain.Registry, target *Target) error
}
func NewCredentialResolver ¶
func NewCredentialResolver( exchanger sts.Exchanger, vault vaultdomain.Repository, connect appoauth.ConnectService, provider appoauth.ProviderClient, ) CredentialResolver
type DialerFunc ¶
type DiscoveryCache ¶
type Introspector ¶
type Introspector interface {
ListRegistryTools(ctx context.Context, gatewayID ids.GatewayID, registryID ids.RegistryID) ([]Tool, error)
}
func NewIntrospector ¶
func NewIntrospector(registries appregistry.Finder, dialer Dialer) Introspector
type PluginRunner ¶ added in v0.3.4
type PluginRunner struct {
// contains filtered or unexported fields
}
PluginRunner runs the resolved plugin chain on the native MCP tools/call path, mirroring pkg/app/proxy for the LLM path. It is a thin adapter over the shared plugins.Executor: it builds stage contexts from JSON-RPC values and maps a plugin block to a JSON-RPC error.
func NewPluginRunner ¶ added in v0.3.4
func NewPluginRunner(executor appplugins.Executor, logger *slog.Logger) *PluginRunner
NewPluginRunner accepts the shared executor port; a nil executor makes every method a no-op (plugin-free parity with today's MCP path).
func (*PluginRunner) PreRequest ¶ added in v0.3.4
func (r *PluginRunner) PreRequest( ctx context.Context, rc *appconsumer.RoutableConsumer, name string, arguments json.RawMessage, ) error
PreRequest runs StagePreRequest over the tools/call params. It returns nil to allow the call; a non-nil *RPCError means a policy blocked it (caller skips the upstream dial and writes the error). Per RUN-832 the call fails open on any non-block error (guard unavailable, decode failure): it is logged and nil is returned so the tools/call proceeds.
func (*PluginRunner) PreResponse ¶ added in v0.3.4
func (r *PluginRunner) PreResponse( ctx context.Context, rc *appconsumer.RoutableConsumer, name string, arguments json.RawMessage, result json.RawMessage, ) error
PreResponse runs StagePreResponse over the tool result. It returns nil to keep the original result; a non-nil *RPCError means the response is blocked (caller discards the result and writes the error). Per RUN-832 the call fails open on any non-block error in this direction too: it is logged and the original result is kept.
type Prompt ¶
type Prompt struct {
Name string
// contains filtered or unexported fields
}
func (Prompt) MarshalJSON ¶
func (*Prompt) UnmarshalJSON ¶
type RPCError ¶
type RPCError struct {
Code int64 `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
type ResourceTemplate ¶
type ResourceTemplate struct {
Name string
URITemplate string
// contains filtered or unexported fields
}
func (ResourceTemplate) MarshalJSON ¶
func (rt ResourceTemplate) MarshalJSON() ([]byte, error)
func (*ResourceTemplate) UnmarshalJSON ¶
func (rt *ResourceTemplate) UnmarshalJSON(data []byte) error
type RoleScoper ¶
type RoleScoper interface {
Scope(ctx context.Context, rc *appconsumer.RoutableConsumer, data *appconsumer.Data) (*appconsumer.RoutableConsumer, error)
}
func NewRoleScoper ¶
func NewRoleScoper(oidcResolver approle.OIDCResolver) RoleScoper
type Target ¶
func StaticTarget ¶
func StaticTarget(reg *registrydomain.Registry) Target
type Tool ¶
type Tool struct {
Name string
// contains filtered or unexported fields
}
func (Tool) MarshalJSON ¶
func (*Tool) UnmarshalJSON ¶
type Upstream ¶
type Upstream interface {
ListTools(ctx context.Context) ([]Tool, error)
CallTool(ctx context.Context, name string, arguments json.RawMessage) (json.RawMessage, error)
ListResources(ctx context.Context) ([]Resource, error)
ListResourceTemplates(ctx context.Context) ([]ResourceTemplate, error)
ReadResource(ctx context.Context, uri string) (json.RawMessage, error)
ListPrompts(ctx context.Context) ([]Prompt, error)
GetPrompt(ctx context.Context, name string, arguments map[string]string) (json.RawMessage, error)
SupportsResources() bool
SupportsPrompts() bool
Close(ctx context.Context)
}