Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeStoredMCPServiceConfig(data []byte) (any, error)
- type AuditConfig
- type AuthConfig
- type ClientStatus
- type GatewaySession
- type MCPServiceConfig
- type Manager
- func (m *Manager) CallTool(ctx context.Context, id string, name string, args map[string]any, ...) (*basemcp.ToolResult, error)
- func (m *Manager) Complete(ctx context.Context, id string, ref basemcp.CompletionReference, ...) (*basemcp.CompletionResult, error)
- func (m *Manager) Create(ctx context.Context, cfg MCPServiceConfig) error
- func (m *Manager) Delete(ctx context.Context, id string) error
- func (m *Manager) Get(ctx context.Context, id string) (MCPServiceConfig, error)
- func (m *Manager) GetGatewaySession(serviceID string) *GatewaySession
- func (m *Manager) GetPrompt(ctx context.Context, id string, name string, args map[string]any, ...) (*basemcp.PromptResult, error)
- func (m *Manager) Initialize(ctx context.Context, id string) (map[string]any, error)
- func (m *Manager) List(ctx context.Context) ([]MCPServiceConfig, error)
- func (m *Manager) ListGatewaySessions() []GatewaySession
- func (m *Manager) ListPrompts(ctx context.Context, id string) ([]basemcp.Prompt, error)
- func (m *Manager) ListPromptsPage(ctx context.Context, id string, cursor string) (*basemcp.PromptListResult, error)
- func (m *Manager) ListResourceTemplates(ctx context.Context, id string) ([]basemcp.ResourceTemplate, error)
- func (m *Manager) ListResourceTemplatesPage(ctx context.Context, id string, cursor string) (*basemcp.ResourceTemplateListResult, error)
- func (m *Manager) ListResources(ctx context.Context, id string) ([]basemcp.Resource, error)
- func (m *Manager) ListResourcesPage(ctx context.Context, id string, cursor string) (*basemcp.ResourceListResult, error)
- func (m *Manager) ListTools(ctx context.Context, id string) ([]basemcp.Tool, error)
- func (m *Manager) ListToolsPage(ctx context.Context, id string, cursor string) (*basemcp.ToolListResult, error)
- func (m *Manager) ReadResource(ctx context.Context, id string, uri string, progressCh chan<- UpstreamProgress) (*basemcp.ResourceReadResult, error)
- func (m *Manager) Update(ctx context.Context, id string, cfg MCPServiceConfig) error
- type SessionState
- type TransportType
- type UpstreamProgress
Constants ¶
View Source
const ( TransportStdio = basemcp.TransportStdio TransportSSE = basemcp.TransportSSE TransportStreamableHTTP = basemcp.TransportStreamableHTTP )
Variables ¶
View Source
var ErrServiceNotConfigured = errors.New("mcp service is not configured")
Functions ¶
Types ¶
type AuditConfig ¶ added in v0.4.0
type AuditConfig struct {
CaptureToolArgs bool `json:"capture_tool_args,omitempty"`
}
type AuthConfig ¶
type AuthConfig struct {
Type string `json:"type"` // api_key, oauth2, basic
APIKey string `json:"api_key,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
AuthConfig contains MCP authentication configuration.
type ClientStatus ¶
type ClientStatus = basemcp.ClientStatus
type GatewaySession ¶
type GatewaySession struct {
ID string `json:"id"`
ServiceID string `json:"service_id"`
UpstreamSessionID string `json:"upstream_session_id,omitempty"`
Transport TransportType `json:"transport"`
State SessionState `json:"state"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt time.Time `json:"last_used_at"`
}
GatewaySession is the gateway's view of one upstream session for an MCP service. It maps a stable gateway-generated ID to the upstream transport session.
type MCPServiceConfig ¶
type MCPServiceConfig struct {
ID string `json:"id"`
Name string `json:"name"`
Transport TransportType `json:"transport"`
Command string `json:"command,omitempty"` // stdio only
Args []string `json:"args,omitempty"` // stdio only
URL string `json:"url,omitempty"` // remote transports
PostURL string `json:"post_url,omitempty"` // SSE only; if empty, derived from url
Env map[string]string `json:"env,omitempty"`
AutoAuth bool `json:"auto_auth,omitempty"`
AuthConfig *AuthConfig `json:"auth,omitempty"`
Audit AuditConfig `json:"audit,omitempty"`
Disabled bool `json:"disabled"`
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MCPServiceConfig is the configuration for one upstream MCP service.
func (*MCPServiceConfig) Normalize ¶
func (c *MCPServiceConfig) Normalize()
func (*MCPServiceConfig) NormalizeTimestamps ¶
func (c *MCPServiceConfig) NormalizeTimestamps(now time.Time)
func (MCPServiceConfig) Validate ¶
func (c MCPServiceConfig) Validate() error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(store configstore.ConfigStore) *Manager
func (*Manager) Complete ¶
func (m *Manager) Complete(ctx context.Context, id string, ref basemcp.CompletionReference, argument basemcp.CompletionArgument, args map[string]string) (*basemcp.CompletionResult, error)
func (*Manager) GetGatewaySession ¶
func (m *Manager) GetGatewaySession(serviceID string) *GatewaySession
GetGatewaySession returns a snapshot of the active session for serviceID, or nil if no session exists for that service.
func (*Manager) Initialize ¶
func (*Manager) ListGatewaySessions ¶
func (m *Manager) ListGatewaySessions() []GatewaySession
ListGatewaySessions returns a snapshot of all active gateway sessions, sorted by creation time.
func (*Manager) ListPrompts ¶
func (*Manager) ListPromptsPage ¶
func (*Manager) ListResourceTemplates ¶
func (*Manager) ListResourceTemplatesPage ¶
func (*Manager) ListResources ¶
func (*Manager) ListResourcesPage ¶
func (*Manager) ListToolsPage ¶
func (*Manager) ReadResource ¶
func (m *Manager) ReadResource(ctx context.Context, id string, uri string, progressCh chan<- UpstreamProgress) (*basemcp.ResourceReadResult, error)
type SessionState ¶
type SessionState string
SessionState is the lifecycle state of a gateway upstream session.
const ( SessionStateConnecting SessionState = "connecting" SessionStateReady SessionState = "ready" SessionStateError SessionState = "error" SessionStateClosed SessionState = "closed" )
type TransportType ¶
type TransportType = basemcp.TransportType
Click to show internal directories.
Click to hide internal directories.