mcp

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerName = "tiger"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Tools             []*mcp.Tool             `json:"tools" yaml:"tools"`
	Prompts           []*mcp.Prompt           `json:"prompts" yaml:"prompts"`
	Resources         []*mcp.Resource         `json:"resources" yaml:"resources"`
	ResourceTemplates []*mcp.ResourceTemplate `json:"resource_templates" yaml:"resource_templates"`
}

Capabilities holds all MCP server capabilities

func (*Capabilities) Get

func (c *Capabilities) Get(name string) any

Get finds any capability (tool, prompt, resource, or resource template) by name. Returns the capability if found, or nil if not found. Note that if there are duplicate names (e.g. a tool and a prompt with the same name) it will return the first found. We should therefore aim to avoid duplicate capability names.

func (*Capabilities) Names

func (c *Capabilities) Names() []string

type DBExecuteQueryColumn

type DBExecuteQueryColumn struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

DBExecuteQueryColumn represents a column in the query result

type DBExecuteQueryInput

type DBExecuteQueryInput struct {
	ServiceID      string   `json:"service_id"`
	Query          string   `json:"query"`
	Parameters     []string `json:"parameters,omitempty"`
	TimeoutSeconds int      `json:"timeout_seconds,omitempty"`
	Role           string   `json:"role,omitempty"`
	Pooled         bool     `json:"pooled,omitempty"`
}

DBExecuteQueryInput represents input for db_execute_query

func (DBExecuteQueryInput) Schema

type DBExecuteQueryOutput

type DBExecuteQueryOutput struct {
	ResultSets    []ResultSet `json:"result_sets"`
	ExecutionTime string      `json:"execution_time"`
	Truncated     bool        `json:"truncated,omitempty"`
	Notice        string      `json:"notice,omitempty"`
	Warning       string      `json:"warning,omitempty"`
}

DBExecuteQueryOutput represents output for db_execute_query

func (DBExecuteQueryOutput) Schema

type DBSchemaInput

type DBSchemaInput struct {
	ServiceID   string `json:"service_id"`
	SchemaName  string `json:"schema,omitempty"`
	Internal    bool   `json:"internal,omitempty"`
	Definitions bool   `json:"definitions,omitempty"`
	Comments    bool   `json:"comments,omitempty"`
	Role        string `json:"role,omitempty"`
	Pooled      bool   `json:"pooled,omitempty"`
}

DBSchemaInput represents input for db_schema

func (DBSchemaInput) Schema

func (DBSchemaInput) Schema() *jsonschema.Schema

type DBSchemaOutput

type DBSchemaOutput struct {
	SchemaText string `json:"schema"`
	Warning    string `json:"warning,omitempty"`
}

DBSchemaOutput represents output for db_schema

func (DBSchemaOutput) Schema

func (DBSchemaOutput) Schema() *jsonschema.Schema

type MetricLabelFilterInput

type MetricLabelFilterInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

MetricLabelFilterInput mirrors api.MetricLabelFilter for the tool schema.

type ProxyClient

type ProxyClient struct {
	// contains filtered or unexported fields
}

ProxyClient manages connection to a remote MCP server and forwards requests

func NewProxyClient

func NewProxyClient(ctx context.Context, url string, logger *slog.Logger) (*ProxyClient, error)

NewProxyClient creates a new proxy client for the given remote server configuration

func (*ProxyClient) Close

func (p *ProxyClient) Close() error

Close closes the connection to the remote MCP server

func (*ProxyClient) RegisterPrompts

func (p *ProxyClient) RegisterPrompts(ctx context.Context, server *mcp.Server) error

RegisterPrompts discovers prompts from remote server and registers them as proxy prompts

func (*ProxyClient) RegisterResourceTemplates

func (p *ProxyClient) RegisterResourceTemplates(ctx context.Context, server *mcp.Server) error

RegisterResourceTemplates discovers resource templates from remote server and registers them as proxy resource templates

func (*ProxyClient) RegisterResources

func (p *ProxyClient) RegisterResources(ctx context.Context, server *mcp.Server) error

RegisterResources discovers resources from remote server and registers them as proxy resources

func (*ProxyClient) RegisterTools

func (p *ProxyClient) RegisterTools(ctx context.Context, server *mcp.Server) error

RegisterTools discovers tools from remote server and registers them as proxy tools

type ResourceInfo

type ResourceInfo struct {
	CPU    string `json:"cpu,omitempty" jsonschema:"CPU allocation (e.g., '0.5 cores', '1 core')"`
	Memory string `json:"memory,omitempty" jsonschema:"Memory allocation (e.g., '2 GB', '4 GB')"`
}

ResourceInfo represents resource allocation information

type ResultSet

type ResultSet struct {
	CommandTag   string                 `json:"command_tag"`
	Columns      []DBExecuteQueryColumn `json:"columns,omitempty"`
	Rows         *[][]any               `json:"rows,omitempty"`
	RowsAffected int64                  `json:"rows_affected"`
	Truncated    bool                   `json:"truncated,omitempty"`
}

ResultSet represents a single query result set

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps the MCP server with Tiger-specific functionality

func NewServer

func NewServer(ctx context.Context, app *common.App, logger *slog.Logger) (*Server, error)

NewServer creates a new Tiger MCP server instance. The app must already be loaded: its config renders the read-only warning in the server instructions and gates which tools are registered, both evaluated once here at startup. A nil logger discards the server's log output.

func (*Server) Close

func (s *Server) Close() error

Close gracefully shuts down the MCP server and all proxy connections

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

Returns an HTTP handler that implements the http transport

func (*Server) ListCapabilities

func (s *Server) ListCapabilities(ctx context.Context) (*Capabilities, error)

ListCapabilities creates a temporary in-memory client connection to list all capabilities (tools, prompts, resources, and resource templates).

func (*Server) StartStdio

func (s *Server) StartStdio(ctx context.Context) error

StartStdio starts the MCP server with the stdio transport

type ServiceCreateInput

type ServiceCreateInput struct {
	Name         string   `json:"name,omitempty"`
	Addons       []string `json:"addons,omitempty"`
	Region       *string  `json:"region,omitempty"`
	CPUMemory    string   `json:"cpu_memory,omitempty"`
	Replicas     int      `json:"replicas,omitempty"`
	Wait         bool     `json:"wait,omitempty"`
	SetDefault   bool     `json:"set_default,omitempty"`
	WithPassword bool     `json:"with_password,omitempty"`
}

ServiceCreateInput represents input for service_create

func (ServiceCreateInput) Schema

type ServiceCreateOutput

type ServiceCreateOutput struct {
	Service         ServiceDetail                 `json:"service"`
	Message         string                        `json:"message"`
	PasswordStorage *common.PasswordStorageResult `json:"password_storage,omitempty"`
}

ServiceCreateOutput represents output for service_create

func (ServiceCreateOutput) Schema

type ServiceDetail

type ServiceDetail struct {
	ServiceID        string        `json:"id" jsonschema:"Service identifier (10-character alphanumeric string)"`
	Name             string        `json:"name"`
	Status           string        `json:"status" jsonschema:"Service status (e.g., READY, PAUSED, CONFIGURING, UPGRADING)"`
	Type             string        `json:"type"`
	Region           string        `json:"region"`
	Created          string        `json:"created,omitempty"`
	Resources        *ResourceInfo `json:"resources,omitempty"`
	Replicas         int           `json:"replicas" jsonschema:"Number of HA replicas (0=single node/no HA, 1+=HA enabled)"`
	DirectEndpoint   string        `json:"direct_endpoint,omitempty" jsonschema:"Direct database connection endpoint"`
	PoolerEndpoint   string        `json:"pooler_endpoint,omitempty" jsonschema:"Connection pooler endpoint"`
	Password         string        `json:"password,omitempty" jsonschema:"Password for tsdbadmin user (only included if with_password=true)"`
	ConnectionString string        `json:"connection_string" jsonschema:"PostgreSQL connection string (password embedded only if with_password=true)"`
}

ServiceDetail represents detailed service information

func (ServiceDetail) Schema

func (ServiceDetail) Schema() *jsonschema.Schema

type ServiceForkInput

type ServiceForkInput struct {
	ServiceID    string           `json:"service_id"`
	Name         string           `json:"name,omitempty"`
	ForkStrategy api.ForkStrategy `json:"fork_strategy"`
	TargetTime   *time.Time       `json:"target_time,omitempty"`
	CPUMemory    string           `json:"cpu_memory,omitempty"`
	Wait         bool             `json:"wait,omitempty"`
	SetDefault   bool             `json:"set_default,omitempty"`
	WithPassword bool             `json:"with_password,omitempty"`
}

ServiceForkInput represents input for service_fork

func (ServiceForkInput) Schema

type ServiceForkOutput

type ServiceForkOutput struct {
	Service         ServiceDetail                 `json:"service"`
	Message         string                        `json:"message"`
	PasswordStorage *common.PasswordStorageResult `json:"password_storage,omitempty"`
}

ServiceForkOutput represents output for service_fork

func (ServiceForkOutput) Schema

type ServiceGetInput

type ServiceGetInput struct {
	ServiceID    string `json:"service_id"`
	WithPassword bool   `json:"with_password,omitempty"`
}

ServiceGetInput represents input for service_get

func (ServiceGetInput) Schema

func (ServiceGetInput) Schema() *jsonschema.Schema

type ServiceGetOutput

type ServiceGetOutput struct {
	Service ServiceDetail `json:"service"`
}

ServiceGetOutput represents output for service_get

func (ServiceGetOutput) Schema

type ServiceInfo

type ServiceInfo struct {
	ServiceID string        `json:"id" jsonschema:"Service identifier (10-character alphanumeric string)"`
	Name      string        `json:"name"`
	Status    string        `json:"status" jsonschema:"Service status (e.g., READY, PAUSED, CONFIGURING, UPGRADING)"`
	Type      string        `json:"type"`
	Region    string        `json:"region"`
	Created   string        `json:"created,omitempty"`
	Resources *ResourceInfo `json:"resources,omitempty"`
}

ServiceInfo represents simplified service information for MCP output

func (ServiceInfo) Schema

func (ServiceInfo) Schema() *jsonschema.Schema

type ServiceListInput

type ServiceListInput struct{}

ServiceListInput represents input for service_list

func (ServiceListInput) Schema

type ServiceListOutput

type ServiceListOutput struct {
	Services []ServiceInfo `json:"services"`
}

ServiceListOutput represents output for service_list

func (ServiceListOutput) Schema

type ServiceLogsInput

type ServiceLogsInput struct {
	ServiceID string     `json:"service_id"`
	Node      *int       `json:"node,omitempty"`
	Tail      int        `json:"tail,omitempty"`
	Since     *time.Time `json:"since,omitempty"`
	Until     *time.Time `json:"until,omitempty"`
}

ServiceLogsInput represents input for service_logs

func (ServiceLogsInput) Schema

type ServiceLogsOutput

type ServiceLogsOutput struct {
	Logs []string `` /* 142-byte string literal not displayed */
}

ServiceLogsOutput represents output for service_logs

func (ServiceLogsOutput) Schema

type ServiceMetricsAvailableInput

type ServiceMetricsAvailableInput struct {
	ServiceID string `json:"service_id"`
}

ServiceMetricsAvailableInput represents input for service_metrics_available

func (ServiceMetricsAvailableInput) Schema

type ServiceMetricsAvailableOutput

type ServiceMetricsAvailableOutput struct {
	Series []string `json:"series"`
}

ServiceMetricsAvailableOutput represents output for service_metrics_available

func (ServiceMetricsAvailableOutput) Schema

type ServiceMetricsSeriesInput

type ServiceMetricsSeriesInput struct {
	ServiceID     string                   `json:"service_id"`
	MetricName    string                   `json:"metric_name"`
	From          string                   `json:"from"`
	To            string                   `json:"to"`
	Role          string                   `json:"role,omitempty"`
	Filters       []MetricLabelFilterInput `json:"filters,omitempty"`
	BucketSeconds int                      `json:"bucket_seconds,omitempty"`
	Fn            string                   `json:"fn,omitempty"`
}

ServiceMetricsSeriesInput represents input for service_metrics_series

func (ServiceMetricsSeriesInput) Schema

type ServiceMetricsSeriesOutput

type ServiceMetricsSeriesOutput struct {
	Series []api.MetricSeries `json:"series"`
}

ServiceMetricsSeriesOutput is the response from service_metrics_series. The endpoint returns one MetricSeries per distinct label set (e.g. one per replica).

func (ServiceMetricsSeriesOutput) Schema

type ServiceResizeInput

type ServiceResizeInput struct {
	ServiceID string `json:"service_id"`
	CPUMemory string `json:"cpu_memory"`
	Wait      bool   `json:"wait,omitempty"`
}

ServiceResizeInput represents input for service_resize

func (ServiceResizeInput) Schema

type ServiceResizeOutput

type ServiceResizeOutput struct {
	Status    string        `json:"status" jsonschema:"Current service status after resize operation"`
	Resources *ResourceInfo `json:"resources,omitempty"`
	Message   string        `json:"message"`
}

ServiceResizeOutput represents output for service_resize

func (ServiceResizeOutput) Schema

type ServiceStartInput

type ServiceStartInput struct {
	ServiceID string `json:"service_id"`
	Wait      bool   `json:"wait,omitempty"`
}

ServiceStartInput represents input for service_start

func (ServiceStartInput) Schema

type ServiceStartOutput

type ServiceStartOutput struct {
	Status  string `json:"status" jsonschema:"Current service status after start operation"`
	Message string `json:"message"`
}

ServiceStartOutput represents output for service_start

func (ServiceStartOutput) Schema

type ServiceStopInput

type ServiceStopInput struct {
	ServiceID string `json:"service_id"`
	Wait      bool   `json:"wait,omitempty"`
}

ServiceStopInput represents input for service_stop

func (ServiceStopInput) Schema

type ServiceStopOutput

type ServiceStopOutput struct {
	Status  string `json:"status" jsonschema:"Current service status after stop operation"`
	Message string `json:"message"`
}

ServiceStopOutput represents output for service_stop

func (ServiceStopOutput) Schema

type ServiceUpdatePasswordInput

type ServiceUpdatePasswordInput struct {
	ServiceID string `json:"service_id"`
	Password  string `json:"password"`
}

ServiceUpdatePasswordInput represents input for service_update_password

func (ServiceUpdatePasswordInput) Schema

type ServiceUpdatePasswordOutput

type ServiceUpdatePasswordOutput struct {
	Message         string                        `json:"message"`
	PasswordStorage *common.PasswordStorageResult `json:"password_storage,omitempty"`
}

ServiceUpdatePasswordOutput represents output for service_update_password

func (ServiceUpdatePasswordOutput) Schema

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL