Documentation
¶
Index ¶
- Constants
- func ApplyResult(processorConfig *config.ProcessorConfig, result *processor.DataContext, ...) error
- func GetInput(processorConfig *config.ProcessorConfig, callCtx CallContext) *processor.DataContext
- func RegisterEndpoint(proxy *CentianEndpoint, mux *http.ServeMux, options *mcp.StreamableHTTPOptions)
- func WithCallContext(ctx context.Context, cc CallContext) context.Context
- type AuthData
- type CallContext
- type CallContextHandler
- type CentianEndpoint
- func (p *CentianEndpoint) Close() []error
- func (p *CentianEndpoint) GetActiveMCPServerConfigs() map[string]*config.MCPServerConfig
- func (p *CentianEndpoint) GetOrCreateServerForRequest(r *http.Request) *mcp.Server
- func (p *CentianEndpoint) ProcessCall(callCtx CallContext, direction common.McpEventDirection, ...) error
- type CentianProject
- type CentianServer
- type CentianServerOptions
- type ConnectionStatus
- func (s ConnectionStatus) IsAuthRequired() bool
- func (s ConnectionStatus) IsConnected() bool
- func (s ConnectionStatus) IsConnecting() bool
- func (s ConnectionStatus) IsDisconnected() bool
- func (s ConnectionStatus) IsFailed() bool
- func (s ConnectionStatus) IsPending() bool
- func (s ConnectionStatus) IsRefreshFailed() bool
- type DefaultAnnotationHandler
- type DefaultAuthHandler
- type DefaultLogHandler
- type DefaultMetaHandler
- type DefaultPayloadHandler
- type DefaultRoutingHandler
- type DownstreamClientState
- type DownstreamConnectOptions
- type DownstreamConnection
- func (dc *DownstreamConnection) CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func (dc *DownstreamConnection) Close() error
- func (dc *DownstreamConnection) Complete(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error)
- func (dc *DownstreamConnection) Connect(ctx context.Context, options *DownstreamConnectOptions) error
- func (dc *DownstreamConnection) ConnectedAt() time.Time
- func (dc *DownstreamConnection) DiscoverPrompts(ctx context.Context) error
- func (dc *DownstreamConnection) DiscoverResourceTemplates(ctx context.Context) error
- func (dc *DownstreamConnection) DiscoverResources(ctx context.Context) error
- func (dc *DownstreamConnection) GetConfig() *config.MCPServerConfig
- func (dc *DownstreamConnection) GetError() error
- func (dc *DownstreamConnection) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
- func (dc *DownstreamConnection) GetServerName() string
- func (dc *DownstreamConnection) GetStatus() ConnectionStatus
- func (dc *DownstreamConnection) IsConnected() bool
- func (dc *DownstreamConnection) IsConnecting() bool
- func (dc *DownstreamConnection) IsDisconnected() bool
- func (dc *DownstreamConnection) IsFailed() bool
- func (dc *DownstreamConnection) IsPending() bool
- func (dc *DownstreamConnection) Prompts() []*mcp.Prompt
- func (dc *DownstreamConnection) ReadResource(ctx context.Context, uri string) (*mcp.ReadResourceResult, error)
- func (dc *DownstreamConnection) ResourceTemplates() []*mcp.ResourceTemplate
- func (dc *DownstreamConnection) Resources() []*mcp.Resource
- func (dc *DownstreamConnection) ServerName() string
- func (dc *DownstreamConnection) SetLoggingLevel(ctx context.Context, params *mcp.SetLoggingLevelParams) error
- func (dc *DownstreamConnection) Subscribe(ctx context.Context, uri string) error
- func (dc *DownstreamConnection) SyncClientState(ctx context.Context, clientState *DownstreamClientState) error
- func (dc *DownstreamConnection) Tools() []*mcp.Tool
- func (dc *DownstreamConnection) Unsubscribe(ctx context.Context, uri string) error
- type DownstreamConnectionInterface
- type DownstreamElicitationHandler
- type DownstreamLoggingHandler
- type DownstreamResourceListChangedHandler
- type DownstreamResourceUpdatedHandler
- type DownstreamSamplingHandler
- type DownstreamSessionPool
- func (p *DownstreamSessionPool) GetConnectionByServerName(serverName string) (DownstreamConnectionInterface, error)
- func (p *DownstreamSessionPool) HasActiveConnectWorker(serverName string) bool
- func (p *DownstreamSessionPool) IsConnecting(serverName string) (bool, error)
- func (p *DownstreamSessionPool) SetConnection(serverName string, conn DownstreamConnectionInterface)
- type HeaderRoundTripper
- type LogHandler
- type ProcessingController
- type ProcessingControllerInterface
- type TaskToolMetadata
- type ToolCallContext
- func (c *ToolCallContext) GetAuthData() *AuthData
- func (c *ToolCallContext) GetDirection() common.McpEventDirection
- func (c *ToolCallContext) GetError() string
- func (c *ToolCallContext) GetHandler(part string) (CallContextHandler, bool)
- func (c *ToolCallContext) GetLogHandler() LogHandler
- func (c *ToolCallContext) GetMessageType() common.McpMessageType
- func (c *ToolCallContext) GetMetaContext() *common.MetaContext
- func (c *ToolCallContext) GetOriginalRequest() *mcp.CallToolRequest
- func (c *ToolCallContext) GetOriginalResult() *mcp.CallToolResult
- func (c *ToolCallContext) GetOriginalServerName() string
- func (c *ToolCallContext) GetOriginalToolName() string
- func (c *ToolCallContext) GetRequest() *mcp.CallToolRequest
- func (c *ToolCallContext) GetRequestID() string
- func (c *ToolCallContext) GetResult() *mcp.CallToolResult
- func (c *ToolCallContext) GetRoutingContext() *common.RoutingContext
- func (c *ToolCallContext) GetServerName() string
- func (c *ToolCallContext) GetSessionID() string
- func (c *ToolCallContext) GetStatus() int
- func (c *ToolCallContext) GetToolName() string
- func (c *ToolCallContext) HasResult() bool
- func (c *ToolCallContext) SendRequest(ctx context.Context) error
- func (c *ToolCallContext) SetDirection(d common.McpEventDirection)
- func (c *ToolCallContext) SetError(msg string)
- func (c *ToolCallContext) SetHandler(part string, h CallContextHandler)
- func (c *ToolCallContext) SetLogHandler(l LogHandler)
- func (c *ToolCallContext) SetMessageType(t common.McpMessageType)
- func (c *ToolCallContext) SetMetaContext(meta *common.MetaContext)
- func (c *ToolCallContext) SetResult(result *mcp.CallToolResult)
- func (c *ToolCallContext) SetServerName(name string)
- func (c *ToolCallContext) SetStatus(status int)
- func (c *ToolCallContext) ToLogEntry() *common.LogEntry
- type UpstreamSession
Constants ¶
const NamespaceSeparator = "___"
NamespaceSeparator is used to create tool names in an aggregated proxy server.
Variables ¶
This section is empty.
Functions ¶
func ApplyResult ¶ added in v0.0.3
func ApplyResult(processorConfig *config.ProcessorConfig, result *processor.DataContext, callCtx CallContext) error
ApplyResult takes the result from the processor and processes it in order for each configured part of the ProcessorConfig.
func GetInput ¶ added in v0.0.3
func GetInput(processorConfig *config.ProcessorConfig, callCtx CallContext) *processor.DataContext
GetInput uses the provided ProcessorConfig and CallContext to create the input map for the processor.
func RegisterEndpoint ¶ added in v0.0.3
func RegisterEndpoint(proxy *CentianEndpoint, mux *http.ServeMux, options *mcp.StreamableHTTPOptions)
RegisterEndpoint registers a ServerProvider with the HTTP mux.
func WithCallContext ¶ added in v0.0.3
func WithCallContext(ctx context.Context, cc CallContext) context.Context
WithCallContext attaches a CallContext to a context.Context.
Types ¶
type AuthData ¶ added in v0.0.5
type AuthData struct {
AuthHeaderName string
Project string
Gateway string
Headers http.Header
Principal *auth.Principal
CredentialID string
}
AuthData stores raw auth-related references/snapshots for internal use.
This struct intentionally does not match processor contracts. Handlers are responsible for mapping AuthData to processor-facing context.
type CallContext ¶ added in v0.0.3
type CallContext interface {
// Lifecycle
SendRequest(ctx context.Context) error // Execute the downstream call
HasResult() bool // Returns true if a result is available
GetResult() *mcp.CallToolResult // Returns the CallToolResult, can be nil if request was not sent yet OR resulted in error
GetOriginalResult() *mcp.CallToolResult // Returns the initial CallToolResult first set, can be nil if request was not sent yet OR resulted in error
SetResult(*mcp.CallToolResult) // Sets the result for this call context
GetMetaContext() *common.MetaContext // Returns the attached processor metadata
SetMetaContext(*common.MetaContext) // Sets the provided processor metadata
ToLogEntry() *common.LogEntry // Returns the current call state as a log entry
// Original request (immutable deep clone - for auditing/comparison)
GetOriginalServerName() string // Returns name of the original server
GetOriginalRequest() *mcp.CallToolRequest // Returns original CallToolRequest
GetOriginalToolName() string // Returns original tool name
// Current request (mutable - handlers modify this)
GetServerName() string // Returns current server name
SetServerName(string) // Sets current server name, can be used for re-routing
GetRequest() *mcp.CallToolRequest // Returns current CallToolRequest
GetToolName() string // Returns current tool name
// Status and error handling
GetStatus() int // Returns current status code (0 = not set, 200 = ok, 4xx/5xx = error)
SetStatus(int) // Sets status code
GetError() string // Returns error message if status >= 400
SetError(string) // Sets error message
// Session and request identification
GetRequestID() string // Returns unique request ID
GetSessionID() string // Returns session ID
GetAuthData() *AuthData
// Direction (processors need to know request vs response phase)
GetDirection() common.McpEventDirection
SetDirection(common.McpEventDirection)
GetMessageType() common.McpMessageType
SetMessageType(common.McpMessageType)
// Routing context (reuses common.RoutingContext)
GetRoutingContext() *common.RoutingContext
// Handler access
GetHandler(part string) (CallContextHandler, bool) // Returns handler for given part (payload, meta, routing, etc.)
SetHandler(part string, h CallContextHandler) // Sets the provided context handler
GetLogHandler() LogHandler // Returns the log handler for this context
SetLogHandler(l LogHandler) // sets the provided log handler
}
CallContext represents a single request/response cycle. Implementations know how to send themselves and manage their own state.
func CallContextFromContext ¶ added in v0.0.5
func CallContextFromContext(ctx context.Context) (CallContext, bool)
CallContextFromContext retrieves the attached CallContext from context.Context.
func NewToolCallContext ¶ added in v0.0.3
func NewToolCallContext( proxy *CentianEndpoint, upstreamSession *UpstreamSession, serverName string, req *mcp.CallToolRequest, ) (CallContext, error)
NewToolCallContext creates a new ToolCallContext. Returns CallContext interface to allow implementation swapping.
type CallContextHandler ¶ added in v0.0.3
type CallContextHandler interface {
// AttachPart extracts this handler's part from CallContext for processor input
AttachPart(callCtx CallContext, input *processor.DataContext)
// Apply updates CallContext based on processor output for this part
Apply(callCtx CallContext, output *processor.DataContext) error
}
CallContextHandler handles a specific part of the processing context. Each handler knows how to extract its part for processor input (Get) and apply processor output back to CallContext (Apply).
type CentianEndpoint ¶ added in v0.0.5
type CentianEndpoint struct {
// contains filtered or unexported fields
}
CentianEndpoint manages one proxied MCP endpoint, including upstream sessions, downstream pooling, tool registration, and request routing.
func NewAggregatedEndpoint ¶ added in v0.0.5
func NewAggregatedEndpoint(gatewayName, endpoint string, gatewayConfig *config.GatewayConfig) *CentianEndpoint
NewAggregatedEndpoint creates an endpoint that aggregates multiple downstream servers.
func NewSingleEndpoint ¶ added in v0.0.5
func NewSingleEndpoint(serverName, endpoint string, gatewayConfig *config.GatewayConfig) *CentianEndpoint
NewSingleEndpoint creates an endpoint for a single downstream server.
func (*CentianEndpoint) Close ¶ added in v0.0.5
func (p *CentianEndpoint) Close() []error
Close terminates all sessions and their downstream connections.
func (*CentianEndpoint) GetActiveMCPServerConfigs ¶ added in v0.0.5
func (p *CentianEndpoint) GetActiveMCPServerConfigs() map[string]*config.MCPServerConfig
GetActiveMCPServerConfigs returns the downstream server configs that this endpoint should actively use at runtime.
func (*CentianEndpoint) GetOrCreateServerForRequest ¶ added in v0.0.5
func (p *CentianEndpoint) GetOrCreateServerForRequest(r *http.Request) *mcp.Server
GetOrCreateServerForRequest returns (or creates) the upstream-facing MCP server for the request.
func (*CentianEndpoint) ProcessCall ¶ added in v0.0.5
func (p *CentianEndpoint) ProcessCall(callCtx CallContext, direction common.McpEventDirection, msgType common.McpMessageType) error
ProcessCall handles the request phase processing using handlers.
type CentianProject ¶ added in v0.3.3
type CentianProject struct {
Slug string
Config *config.ProjectConfig
Gateways map[string]*CentianEndpoint
Endpoints []*CentianEndpoint
OAuth *centoauth.Manager
Logger *logging.Logger
PersistenceStore *persistence.Store
TaskVerification *taskverification.Service
// contains filtered or unexported fields
}
CentianProject holds the runtime state for a single project (tenant).
type CentianServer ¶ added in v0.0.5
type CentianServer struct {
Name string
ServerID string
Config *config.GlobalConfig
Mux *http.ServeMux
Server *http.Server
Logger *logging.Logger
Projects map[string]*CentianProject
Principals centauth.PrincipalProvider
Authorizer centauth.Authorizer
AuthHeader string
// Legacy flat-access fields - point to the default project's data for backwards compatibility.
Gateways map[string]*CentianEndpoint
Endpoints []*CentianEndpoint
OAuth *centoauth.Manager
PersistenceStore *persistence.Store
TaskVerification *taskverification.Service
// contains filtered or unexported fields
}
CentianServer owns the HTTP server, global config, auth, logging, and the set of registered proxy endpoints exposed by the running Centian process.
CentianServer is the main process for providing routes and delegating endpoint creation.
func NewCentianServer ¶ added in v0.0.5
func NewCentianServer(globalConfig *config.GlobalConfig) (*CentianServer, error)
NewCentianServer takes a GlobalConfig struct and returns a new CentianServer. It resolves the config into the project-based layout and initializes per-project services (persistence, task verification) for each project.
func NewCentianServerWithOptions ¶ added in v0.4.3
func NewCentianServerWithOptions(globalConfig *config.GlobalConfig, options CentianServerOptions) (*CentianServer, error)
NewCentianServerWithOptions takes a GlobalConfig struct and explicit runtime dependencies, then returns a new CentianServer.
func (*CentianServer) Close ¶ added in v0.1.0
func (c *CentianServer) Close() []error
Close releases endpoint-owned resources such as pooled downstream sessions.
func (*CentianServer) Setup ¶ added in v0.0.5
func (c *CentianServer) Setup() error
Setup uses CentianServer.config to create all gateways and endpoints for every project.
type CentianServerOptions ¶ added in v0.4.3
type CentianServerOptions struct {
LoggerFactory func(projectSlug string) (*logging.Logger, error)
}
CentianServerOptions customizes runtime dependencies for server construction.
type ConnectionStatus ¶ added in v0.0.3
type ConnectionStatus string
ConnectionStatus represents the state of a downstream connection.
const ( StatusPending ConnectionStatus = "pending" StatusConnecting ConnectionStatus = "connecting" StatusConnected ConnectionStatus = "connected" StatusAuthRequired ConnectionStatus = "auth_required" StatusRefreshFailed ConnectionStatus = "refresh_failed" StatusFailed ConnectionStatus = "failed" StatusDisconnected ConnectionStatus = "disconnected" )
Connection status constants for tracking downstream connection lifecycle.
func (ConnectionStatus) IsAuthRequired ¶ added in v0.0.6
func (s ConnectionStatus) IsAuthRequired() bool
IsAuthRequired returns true if ConnectionStatus is AuthRequired.
func (ConnectionStatus) IsConnected ¶ added in v0.0.5
func (s ConnectionStatus) IsConnected() bool
IsConnected returns true if ConnectionStatus is Connected.
func (ConnectionStatus) IsConnecting ¶ added in v0.0.5
func (s ConnectionStatus) IsConnecting() bool
IsConnecting returns true if ConnectionStatus is Conecting.
func (ConnectionStatus) IsDisconnected ¶ added in v0.0.5
func (s ConnectionStatus) IsDisconnected() bool
IsDisconnected returns true if ConnectionStatus is Disconnected.
func (ConnectionStatus) IsFailed ¶ added in v0.0.5
func (s ConnectionStatus) IsFailed() bool
IsFailed returns true if ConnectionStatus is Failed.
func (ConnectionStatus) IsPending ¶ added in v0.0.5
func (s ConnectionStatus) IsPending() bool
IsPending returns true if ConnectionStatus is Pending.
func (ConnectionStatus) IsRefreshFailed ¶ added in v0.0.6
func (s ConnectionStatus) IsRefreshFailed() bool
IsRefreshFailed returns true if ConnectionStatus is RefreshFailed.
type DefaultAnnotationHandler ¶ added in v0.4.3
type DefaultAnnotationHandler struct{}
DefaultAnnotationHandler lets processors report findings without modifying MCP payloads.
func (*DefaultAnnotationHandler) Apply ¶ added in v0.4.3
func (h *DefaultAnnotationHandler) Apply(callCtx CallContext, output *processor.DataContext) error
Apply appends processor annotations to the event model.
func (*DefaultAnnotationHandler) AttachPart ¶ added in v0.4.3
func (h *DefaultAnnotationHandler) AttachPart(callCtx CallContext, input *processor.DataContext)
AttachPart attaches existing processor annotations from the current event.
type DefaultAuthHandler ¶ added in v0.0.5
type DefaultAuthHandler struct{}
DefaultAuthHandler attaches auth context and treats it as immutable.
func (*DefaultAuthHandler) Apply ¶ added in v0.0.5
func (h *DefaultAuthHandler) Apply(_ CallContext, _ *processor.DataContext) error
Apply ignores auth modifications from processors to keep auth context read-only.
func (*DefaultAuthHandler) AttachPart ¶ added in v0.0.5
func (h *DefaultAuthHandler) AttachPart(callCtx CallContext, input *processor.DataContext)
AttachPart attaches auth information from CallContext to input ProcessorContext.
type DefaultLogHandler ¶ added in v0.0.3
type DefaultLogHandler struct {
// contains filtered or unexported fields
}
DefaultLogHandler provides simple, default functionality for logging CallContext data.
func NewDefaultLogHandler ¶ added in v0.0.3
func NewDefaultLogHandler(logger *logging.Logger) *DefaultLogHandler
NewDefaultLogHandler returns a new DefaultLogHandler.
func (*DefaultLogHandler) Log ¶ added in v0.0.3
func (h *DefaultLogHandler) Log(callCtx CallContext) error
Log uses the attached logger to log the provided CallContext data.
type DefaultMetaHandler ¶ added in v0.0.3
type DefaultMetaHandler struct{}
DefaultMetaHandler provides default behavior for providing and modifying metadata information to/by a processor.
func (*DefaultMetaHandler) Apply ¶ added in v0.0.3
func (h *DefaultMetaHandler) Apply(callCtx CallContext, result *processor.DataContext) error
Apply uses provided result ProcessorContext to modify the CallContext.
func (*DefaultMetaHandler) AttachPart ¶ added in v0.0.3
func (h *DefaultMetaHandler) AttachPart(callCtx CallContext, input *processor.DataContext)
AttachPart attaches MetaContext information from CallContext on input ProcessorContext.
type DefaultPayloadHandler ¶ added in v0.0.3
type DefaultPayloadHandler struct{}
DefaultPayloadHandler provides payload information for request and result, as well as applies modifications to those provided by a processor.
Note: DefaultPayloadHandler does a full replacement of request params and result, requiring the processors to return an exact copy of the structure. Partial replacement is not possible with this handlers.
func (*DefaultPayloadHandler) Apply ¶ added in v0.0.3
func (h *DefaultPayloadHandler) Apply(callCtx CallContext, result *processor.DataContext) error
Apply modifies payload using result ProcessorContext.
Behavior: both result.Payload.Request.Params and result.Payload.Result will be used to modify CallContext accordingly.
func (*DefaultPayloadHandler) AttachPart ¶ added in v0.0.3
func (h *DefaultPayloadHandler) AttachPart(callCtx CallContext, input *processor.DataContext)
AttachPart attaches Payload information from CallContext on input ProcessorContext.
type DefaultRoutingHandler ¶ added in v0.0.3
type DefaultRoutingHandler struct{}
DefaultRoutingHandler handles routing data and modifications on CallContext.
func (*DefaultRoutingHandler) Apply ¶ added in v0.0.3
func (h *DefaultRoutingHandler) Apply(callCtx CallContext, result *processor.DataContext) error
Apply uses provided result ProcessorContext to modify the CallContext. Returns an error if no request is attached to CallContext.
func (*DefaultRoutingHandler) AttachPart ¶ added in v0.0.3
func (h *DefaultRoutingHandler) AttachPart(callCtx CallContext, input *processor.DataContext)
AttachPart attaches routing information from CallContext to input ProcessorContext.
type DownstreamClientState ¶ added in v0.0.5
type DownstreamClientState struct {
ProtocolVersion string
ClientCapabilities *mcp.ClientCapabilities
Roots []*mcp.Root
CapabilitiesFingerprint string
RootsFingerprint string
}
DownstreamClientState describes the effective upstream client state mirrored downstream.
type DownstreamConnectOptions ¶ added in v0.0.5
type DownstreamConnectOptions struct {
ForwardedHeaders map[string]string
ClientState DownstreamClientState
IdentityKey string
GatewayName string
SamplingHandler DownstreamSamplingHandler
ElicitationHandler DownstreamElicitationHandler
LoggingHandler DownstreamLoggingHandler
ResourceListChangedHandler DownstreamResourceListChangedHandler
ResourceUpdatedHandler DownstreamResourceUpdatedHandler
}
DownstreamConnectOptions configures downstream client setup.
type DownstreamConnection ¶
type DownstreamConnection struct {
// contains filtered or unexported fields
}
DownstreamConnection represents a connection to a downstream MCP server.
func NewDownstreamConnection ¶
func NewDownstreamConnection(serverName string, cfg *config.MCPServerConfig) *DownstreamConnection
NewDownstreamConnection creates an unconnected downstream wrapper.
func (*DownstreamConnection) CallTool ¶
func (dc *DownstreamConnection) CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
CallTool forwards a tool call to the downstream server.
func (*DownstreamConnection) Close ¶
func (dc *DownstreamConnection) Close() error
Close terminates the downstream connection.
func (*DownstreamConnection) Complete ¶ added in v0.0.5
func (dc *DownstreamConnection) Complete(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error)
Complete forwards a completion request to the downstream server.
func (*DownstreamConnection) Connect ¶
func (dc *DownstreamConnection) Connect(ctx context.Context, options *DownstreamConnectOptions) error
Connect establishes connection to downstream server.
func (*DownstreamConnection) ConnectedAt ¶ added in v0.0.3
func (dc *DownstreamConnection) ConnectedAt() time.Time
ConnectedAt returns when connection was established (zero if not connected).
func (*DownstreamConnection) DiscoverPrompts ¶ added in v0.0.5
func (dc *DownstreamConnection) DiscoverPrompts(ctx context.Context) error
DiscoverPrompts fetches and caches the prompt list from the downstream server. Safe to call after Connect returns; acquires the write lock for the duration of the RPC.
func (*DownstreamConnection) DiscoverResourceTemplates ¶ added in v0.0.5
func (dc *DownstreamConnection) DiscoverResourceTemplates(ctx context.Context) error
DiscoverResourceTemplates fetches and caches the resource template list from the downstream server. Safe to call after Connect returns; acquires the write lock for the duration of the RPC.
func (*DownstreamConnection) DiscoverResources ¶ added in v0.0.5
func (dc *DownstreamConnection) DiscoverResources(ctx context.Context) error
DiscoverResources fetches and caches the resource list from the downstream server. Safe to call after Connect returns; acquires the write lock for the duration of the RPC.
func (*DownstreamConnection) GetConfig ¶ added in v0.0.3
func (dc *DownstreamConnection) GetConfig() *config.MCPServerConfig
GetConfig returns the server configuration for this connection.
func (*DownstreamConnection) GetError ¶ added in v0.0.3
func (dc *DownstreamConnection) GetError() error
GetError returns the connection error if status is Failed (thread-safe).
func (*DownstreamConnection) GetPrompt ¶ added in v0.0.5
func (dc *DownstreamConnection) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
GetPrompt retrieves a prompt by name from the downstream server.
func (*DownstreamConnection) GetServerName ¶ added in v0.0.5
func (dc *DownstreamConnection) GetServerName() string
GetServerName returns the server name for this DownstreamConnection.
func (*DownstreamConnection) GetStatus ¶ added in v0.0.3
func (dc *DownstreamConnection) GetStatus() ConnectionStatus
GetStatus returns the current connection status (thread-safe).
func (*DownstreamConnection) IsConnected ¶
func (dc *DownstreamConnection) IsConnected() bool
IsConnected returns true if connection was established and not yet closed.
func (*DownstreamConnection) IsConnecting ¶ added in v0.0.5
func (dc *DownstreamConnection) IsConnecting() bool
IsConnecting returns true if connection is being established and not yet closed.
func (*DownstreamConnection) IsDisconnected ¶ added in v0.0.5
func (dc *DownstreamConnection) IsDisconnected() bool
IsDisconnected returns true if connection is closed.
func (*DownstreamConnection) IsFailed ¶ added in v0.0.5
func (dc *DownstreamConnection) IsFailed() bool
IsFailed returns true if connection could not be established.
func (*DownstreamConnection) IsPending ¶ added in v0.0.5
func (dc *DownstreamConnection) IsPending() bool
IsPending returns true if connection is currently pending.
func (*DownstreamConnection) Prompts ¶ added in v0.0.5
func (dc *DownstreamConnection) Prompts() []*mcp.Prompt
Prompts returns the cached prompts discovered on connect (nil if not connected or unsupported).
func (*DownstreamConnection) ReadResource ¶ added in v0.0.5
func (dc *DownstreamConnection) ReadResource(ctx context.Context, uri string) (*mcp.ReadResourceResult, error)
ReadResource reads a resource by URI from the downstream server.
func (*DownstreamConnection) ResourceTemplates ¶ added in v0.0.5
func (dc *DownstreamConnection) ResourceTemplates() []*mcp.ResourceTemplate
ResourceTemplates returns the cached resource templates discovered on connect (nil if not connected or unsupported).
func (*DownstreamConnection) Resources ¶ added in v0.0.5
func (dc *DownstreamConnection) Resources() []*mcp.Resource
Resources returns the cached resources discovered on connect (nil if not connected or unsupported).
func (*DownstreamConnection) ServerName ¶ added in v0.0.3
func (dc *DownstreamConnection) ServerName() string
ServerName returns the name of this downstream server.
func (*DownstreamConnection) SetLoggingLevel ¶ added in v0.0.5
func (dc *DownstreamConnection) SetLoggingLevel(ctx context.Context, params *mcp.SetLoggingLevelParams) error
SetLoggingLevel forwards a logging level request to the downstream server.
func (*DownstreamConnection) Subscribe ¶ added in v0.0.5
func (dc *DownstreamConnection) Subscribe(ctx context.Context, uri string) error
Subscribe requests resource update notifications for the given URI from the downstream server.
func (*DownstreamConnection) SyncClientState ¶ added in v0.0.5
func (dc *DownstreamConnection) SyncClientState(ctx context.Context, clientState *DownstreamClientState) error
SyncClientState updates mutable downstream client state without reconnecting.
func (*DownstreamConnection) Tools ¶
func (dc *DownstreamConnection) Tools() []*mcp.Tool
Tools returns the cached tools (nil if not connected).
func (*DownstreamConnection) Unsubscribe ¶ added in v0.0.5
func (dc *DownstreamConnection) Unsubscribe(ctx context.Context, uri string) error
Unsubscribe cancels resource update notifications for the given URI from the downstream server.
type DownstreamConnectionInterface ¶ added in v0.0.3
type DownstreamConnectionInterface interface {
CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
GetServerName() string
IsConnected() bool
IsConnecting() bool
IsDisconnected() bool
IsFailed() bool
IsPending() bool
Tools() []*mcp.Tool
Resources() []*mcp.Resource
ResourceTemplates() []*mcp.ResourceTemplate
Prompts() []*mcp.Prompt
DiscoverResources(ctx context.Context) error
DiscoverResourceTemplates(ctx context.Context) error
DiscoverPrompts(ctx context.Context) error
ReadResource(ctx context.Context, uri string) (*mcp.ReadResourceResult, error)
GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
Complete(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error)
Subscribe(ctx context.Context, uri string) error
Unsubscribe(ctx context.Context, uri string) error
SetLoggingLevel(ctx context.Context, params *mcp.SetLoggingLevelParams) error
Close() error
GetConfig() *config.MCPServerConfig
GetStatus() ConnectionStatus
GetError() error
Connect(context.Context, *DownstreamConnectOptions) error
SyncClientState(context.Context, *DownstreamClientState) error
}
DownstreamConnectionInterface abstracts downstream MCP server connections for testability.
The actual connection lives in DownstreamConnection.
type DownstreamElicitationHandler ¶ added in v0.0.5
type DownstreamElicitationHandler func(context.Context, *mcp.ElicitRequest) (*mcp.ElicitResult, error)
DownstreamElicitationHandler forwards elicitation requests from a downstream session.
type DownstreamLoggingHandler ¶ added in v0.0.5
type DownstreamLoggingHandler func(context.Context, *mcp.LoggingMessageRequest)
DownstreamLoggingHandler forwards logging notifications from a downstream session.
type DownstreamResourceListChangedHandler ¶ added in v0.0.5
type DownstreamResourceListChangedHandler func(context.Context, *mcp.ResourceListChangedRequest)
DownstreamResourceListChangedHandler forwards resource list change notifications from a downstream session.
type DownstreamResourceUpdatedHandler ¶ added in v0.0.5
type DownstreamResourceUpdatedHandler func(context.Context, *mcp.ResourceUpdatedNotificationRequest)
DownstreamResourceUpdatedHandler forwards resource update notifications from a downstream session.
type DownstreamSamplingHandler ¶ added in v0.0.5
type DownstreamSamplingHandler func(context.Context, *mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error)
DownstreamSamplingHandler forwards sampling requests from a downstream session.
type DownstreamSessionPool ¶ added in v0.0.5
type DownstreamSessionPool struct {
// contains filtered or unexported fields
}
DownstreamSessionPool owns the reusable downstream connection set for one downstream session key.
func (*DownstreamSessionPool) GetConnectionByServerName ¶ added in v0.0.5
func (p *DownstreamSessionPool) GetConnectionByServerName(serverName string) (DownstreamConnectionInterface, error)
GetConnectionByServerName returns a downstream connection for the given server name.
func (*DownstreamSessionPool) HasActiveConnectWorker ¶ added in v0.1.0
func (p *DownstreamSessionPool) HasActiveConnectWorker(serverName string) bool
HasActiveConnectWorker reports whether the pool already has a connect/retry worker responsible for this server slot.
func (*DownstreamSessionPool) IsConnecting ¶ added in v0.0.5
func (p *DownstreamSessionPool) IsConnecting(serverName string) (bool, error)
IsConnecting returns true if the connection for the given serverName is currently in state Connecting.
func (*DownstreamSessionPool) SetConnection ¶ added in v0.0.5
func (p *DownstreamSessionPool) SetConnection(serverName string, conn DownstreamConnectionInterface)
SetConnection sets a downstream connection for the given server name.
type HeaderRoundTripper ¶
type HeaderRoundTripper struct {
Base http.RoundTripper
Headers map[string]string
}
HeaderRoundTripper injects configured headers into outgoing downstream requests.
type LogHandler ¶ added in v0.0.3
type LogHandler interface {
Log(callCtx CallContext) error
}
LogHandler defines how CallContext is serialized for logging. Different implementations allow different log formats.
type ProcessingController ¶ added in v0.0.3
type ProcessingController struct {
// contains filtered or unexported fields
}
ProcessingController is used to call the main processing loop for any MCP transport method.
func NewProcessingController ¶ added in v0.0.3
func NewProcessingController(processorConfigs []*config.ProcessorConfig) (*ProcessingController, error)
NewProcessingController returns a new ProcessingController using the provided processor configs.
func (*ProcessingController) Process ¶ added in v0.0.3
func (ep *ProcessingController) Process(callCtx CallContext) error
Process runs all processors on the CallContext using handlers to build input and apply results.
type ProcessingControllerInterface ¶ added in v0.0.3
type ProcessingControllerInterface interface {
Process(event CallContext) error
}
ProcessingControllerInterface abstracts event processing for testability.
type TaskToolMetadata ¶ added in v0.4.3
type TaskToolMetadata struct {
Annotations []any `json:"annotations,omitempty"`
}
TaskToolMetadata contains optional metadata accepted by all Centian task tools.
type ToolCallContext ¶ added in v0.0.3
type ToolCallContext struct {
// contains filtered or unexported fields
}
ToolCallContext handles standard tool calls (client → downstream → client). Implements the CallContext interface.
func (*ToolCallContext) GetAuthData ¶ added in v0.0.5
func (c *ToolCallContext) GetAuthData() *AuthData
GetAuthData returns auth mapping data attached to this call.
func (*ToolCallContext) GetDirection ¶ added in v0.0.3
func (c *ToolCallContext) GetDirection() common.McpEventDirection
GetDirection returns MetaContext.Direction.
func (*ToolCallContext) GetError ¶ added in v0.0.3
func (c *ToolCallContext) GetError() string
GetError returns ToolCallContext.MetaContext.Error.
func (*ToolCallContext) GetHandler ¶ added in v0.0.3
func (c *ToolCallContext) GetHandler(part string) (CallContextHandler, bool)
GetHandler returns the handler for the given part.
func (*ToolCallContext) GetLogHandler ¶ added in v0.0.3
func (c *ToolCallContext) GetLogHandler() LogHandler
GetLogHandler returns the attached log handler.
func (*ToolCallContext) GetMessageType ¶ added in v0.0.3
func (c *ToolCallContext) GetMessageType() common.McpMessageType
GetMessageType returns MetaContext.MessageType.
func (*ToolCallContext) GetMetaContext ¶ added in v0.1.0
func (c *ToolCallContext) GetMetaContext() *common.MetaContext
GetMetaContext returns the attached processor metadata.
func (*ToolCallContext) GetOriginalRequest ¶ added in v0.0.3
func (c *ToolCallContext) GetOriginalRequest() *mcp.CallToolRequest
GetOriginalRequest returns a reference to the original CallToolRequest.
func (*ToolCallContext) GetOriginalResult ¶ added in v0.0.3
func (c *ToolCallContext) GetOriginalResult() *mcp.CallToolResult
GetOriginalResult returns the initial, original CallToolResult.
func (*ToolCallContext) GetOriginalServerName ¶ added in v0.0.3
func (c *ToolCallContext) GetOriginalServerName() string
GetOriginalServerName returns the initial, original server name.
func (*ToolCallContext) GetOriginalToolName ¶ added in v0.0.3
func (c *ToolCallContext) GetOriginalToolName() string
GetOriginalToolName returns the initial tool name.
func (*ToolCallContext) GetRequest ¶ added in v0.0.3
func (c *ToolCallContext) GetRequest() *mcp.CallToolRequest
GetRequest returns a reference to the current CallToolRequest - allows modifications.
func (*ToolCallContext) GetRequestID ¶ added in v0.0.3
func (c *ToolCallContext) GetRequestID() string
GetRequestID returns the current request ID.
func (*ToolCallContext) GetResult ¶ added in v0.0.3
func (c *ToolCallContext) GetResult() *mcp.CallToolResult
GetResult returns the CallToolResult for this CallContext.
func (*ToolCallContext) GetRoutingContext ¶ added in v0.0.3
func (c *ToolCallContext) GetRoutingContext() *common.RoutingContext
GetRoutingContext returns the attached RoutingLog.
func (*ToolCallContext) GetServerName ¶ added in v0.0.3
func (c *ToolCallContext) GetServerName() string
GetServerName returns the current server name from routing context.
func (*ToolCallContext) GetSessionID ¶ added in v0.0.3
func (c *ToolCallContext) GetSessionID() string
GetSessionID returns the current session ID.
func (*ToolCallContext) GetStatus ¶ added in v0.0.3
func (c *ToolCallContext) GetStatus() int
GetStatus returns ToolCallContext.MetaContext.Status.
func (*ToolCallContext) GetToolName ¶ added in v0.0.3
func (c *ToolCallContext) GetToolName() string
GetToolName returns the current tool name.
func (*ToolCallContext) HasResult ¶ added in v0.0.3
func (c *ToolCallContext) HasResult() bool
HasResult returns true if a result is available.
func (*ToolCallContext) SendRequest ¶ added in v0.0.3
func (c *ToolCallContext) SendRequest(ctx context.Context) error
SendRequest executes the downstream call using current request state. Note: if processors returned a status >= 400 this will NOT trigger a downstream call, instead an immediate error response will be returned.
func (*ToolCallContext) SetDirection ¶ added in v0.0.3
func (c *ToolCallContext) SetDirection(d common.McpEventDirection)
SetDirection sets MetaContext.Direction.
func (*ToolCallContext) SetError ¶ added in v0.0.3
func (c *ToolCallContext) SetError(msg string)
SetError sets the ToolCallContext.MetaContext.Error.
func (*ToolCallContext) SetHandler ¶ added in v0.0.3
func (c *ToolCallContext) SetHandler(part string, h CallContextHandler)
SetHandler sets the provided handler for the provided part.
Automatically creates the handlers map if it is nil.
func (*ToolCallContext) SetLogHandler ¶ added in v0.0.3
func (c *ToolCallContext) SetLogHandler(l LogHandler)
SetLogHandler sets the provided log handler.
func (*ToolCallContext) SetMessageType ¶ added in v0.0.3
func (c *ToolCallContext) SetMessageType(t common.McpMessageType)
SetMessageType sets MetaContext.MessageType.
func (*ToolCallContext) SetMetaContext ¶ added in v0.1.0
func (c *ToolCallContext) SetMetaContext(meta *common.MetaContext)
SetMetaContext sets the provided processor metadata.
func (*ToolCallContext) SetResult ¶ added in v0.0.3
func (c *ToolCallContext) SetResult(result *mcp.CallToolResult)
SetResult sets the CallToolResult for this CallContext.
func (*ToolCallContext) SetServerName ¶ added in v0.0.3
func (c *ToolCallContext) SetServerName(name string)
SetServerName sets the server name in routing context.
Note: creates routing context if it doesn't exist.
func (*ToolCallContext) SetStatus ¶ added in v0.0.3
func (c *ToolCallContext) SetStatus(status int)
SetStatus sets ToolCallContext.MetaContext.Status.
func (*ToolCallContext) ToLogEntry ¶ added in v0.1.0
func (c *ToolCallContext) ToLogEntry() *common.LogEntry
ToLogEntry returns the current call state as a structured log entry.
type UpstreamSession ¶ added in v0.0.4
type UpstreamSession struct {
// contains filtered or unexported fields
}
UpstreamSession represents one MCP client session talking to this proxy endpoint.
func (*UpstreamSession) GetAuthHeaders ¶ added in v0.0.5
func (s *UpstreamSession) GetAuthHeaders(excludedHeader string) map[string]string
GetAuthHeaders returns the subset of client headers that should be forwarded to downstream servers as authentication headers.
Source Files
¶
- auth_context.go
- call_context.go
- downstream_client_state.go
- downstream_connection.go
- forwarded_method_error.go
- handlers.go
- interfaces.go
- proxy_auth_tools.go
- proxy_downstream_pool.go
- proxy_downstream_retry.go
- proxy_event_processor.go
- proxy_http.go
- proxy_logging.go
- proxy_oauth.go
- proxy_project_helpers.go
- proxy_prompts.go
- proxy_resource_notifications.go
- proxy_resources.go
- proxy_session_test_helpers.go
- proxy_sessions.go
- proxy_setup.go
- proxy_task_events.go
- proxy_task_timeout.go
- proxy_task_verification_policy.go
- proxy_taskverification_tools.go
- proxy_tool_governance.go
- proxy_tools.go
- proxy_types.go
- request_identity.go
- tool_call_context.go
- utils.go