mcp

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ServerName = "ghost"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Tools             []*mcp.Tool             `json:"tools"`
	Prompts           []*mcp.Prompt           `json:"prompts"`
	Resources         []*mcp.Resource         `json:"resources"`
	ResourceTemplates []*mcp.ResourceTemplate `json:"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 ConnectInput

type ConnectInput struct {
	Ref string `json:"name_or_id"`
}

ConnectInput represents input for ghost_connect

func (ConnectInput) Schema

func (ConnectInput) Schema() *jsonschema.Schema

type ConnectOutput

type ConnectOutput struct {
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

ConnectOutput represents output for ghost_connect

func (ConnectOutput) Schema

func (ConnectOutput) Schema() *jsonschema.Schema

type CreateDedicatedInput

type CreateDedicatedInput struct {
	Name string `json:"name,omitempty"`
	Size string `json:"size,omitempty"`
	Wait bool   `json:"wait,omitempty"`
}

CreateDedicatedInput represents input for ghost_create_dedicated

func (CreateDedicatedInput) Schema

type CreateDedicatedOutput

type CreateDedicatedOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Size             string   `json:"size"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

CreateDedicatedOutput represents output for ghost_create_dedicated

func (CreateDedicatedOutput) Schema

type CreateInput

type CreateInput struct {
	Name string `json:"name,omitempty"`
	Wait bool   `json:"wait,omitempty"`
}

CreateInput represents input for ghost_create

func (CreateInput) Schema

func (CreateInput) Schema() *jsonschema.Schema

type CreateOutput

type CreateOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

CreateOutput represents output for ghost_create

func (CreateOutput) Schema

func (CreateOutput) Schema() *jsonschema.Schema

type DatabaseInfo

type DatabaseInfo struct {
	ID      string             `json:"id"`
	Name    string             `json:"name"`
	Type    api.DatabaseType   `json:"type"`
	Size    *api.DatabaseSize  `json:"size,omitempty"`
	Status  api.DatabaseStatus `json:"status"`
	Storage string             `json:"storage"`
}

DatabaseInfo represents information about a single database

type DeleteInput

type DeleteInput struct {
	Ref string `json:"name_or_id"`
}

DeleteInput represents input for ghost_delete

func (DeleteInput) Schema

func (DeleteInput) Schema() *jsonschema.Schema

type DeleteOutput

type DeleteOutput struct {
	Success  bool     `json:"success"`
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Warnings []string `json:"warnings,omitempty"`
}

DeleteOutput represents output for ghost_delete

func (DeleteOutput) Schema

func (DeleteOutput) Schema() *jsonschema.Schema

type FeedbackInput

type FeedbackInput struct {
	Message string `json:"message"`
}

FeedbackInput represents input for ghost_feedback

func (FeedbackInput) Schema

func (FeedbackInput) Schema() *jsonschema.Schema

type FeedbackOutput

type FeedbackOutput struct {
	Success bool `json:"success"`
}

FeedbackOutput represents output for ghost_feedback

func (FeedbackOutput) Schema

func (FeedbackOutput) Schema() *jsonschema.Schema

type ForkDedicatedInput

type ForkDedicatedInput struct {
	Ref  string `json:"name_or_id"`
	Name string `json:"name,omitempty"`
	Size string `json:"size,omitempty"`
	Wait bool   `json:"wait,omitempty"`
}

ForkDedicatedInput represents input for ghost_fork_dedicated

func (ForkDedicatedInput) Schema

type ForkDedicatedOutput

type ForkDedicatedOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Size             string   `json:"size"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

ForkDedicatedOutput represents output for ghost_fork_dedicated

func (ForkDedicatedOutput) Schema

type ForkInput

type ForkInput struct {
	Ref  string `json:"name_or_id"`
	Name string `json:"name,omitempty"`
	Wait bool   `json:"wait,omitempty"`
}

ForkInput represents input for ghost_fork

func (ForkInput) Schema

func (ForkInput) Schema() *jsonschema.Schema

type ForkOutput

type ForkOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

ForkOutput represents output for ghost_fork

func (ForkOutput) Schema

func (ForkOutput) Schema() *jsonschema.Schema

type InvoiceInput added in v0.10.0

type InvoiceInput struct {
	InvoiceID string `json:"invoice_id"`
}

InvoiceInput represents input for ghost_invoice.

func (InvoiceInput) Schema added in v0.10.0

func (InvoiceInput) Schema() *jsonschema.Schema

type InvoiceLineItem added in v0.10.0

type InvoiceLineItem struct {
	ProductType  string  `json:"product_type"`
	DatabaseID   string  `json:"database_id,omitempty"`
	DetailedSpec string  `json:"detailed_spec,omitempty"`
	Quantity     float64 `json:"quantity"`
	UnitPrice    float64 `json:"unit_price"`
	LineTotal    float64 `json:"line_total"`
}

InvoiceLineItem represents a single line item on an invoice.

type InvoiceListInput added in v0.10.0

type InvoiceListInput struct{}

InvoiceListInput represents input for ghost_invoice_list (no parameters).

func (InvoiceListInput) Schema added in v0.10.0

type InvoiceListOutput added in v0.10.0

type InvoiceListOutput struct {
	Invoices []InvoiceSummary `json:"invoices"`
}

InvoiceListOutput represents output for ghost_invoice_list.

func (InvoiceListOutput) Schema added in v0.10.0

type InvoiceOutput added in v0.10.0

type InvoiceOutput struct {
	LineItems []InvoiceLineItem `json:"line_items"`
}

InvoiceOutput represents output for ghost_invoice.

func (InvoiceOutput) Schema added in v0.10.0

func (InvoiceOutput) Schema() *jsonschema.Schema

type InvoiceSummary added in v0.10.0

type InvoiceSummary struct {
	ID            string    `json:"id"`
	InvoiceNumber string    `json:"invoice_number"`
	InvoiceDate   time.Time `json:"invoice_date"`
	Total         float64   `json:"total"`
	Status        string    `json:"status"`
}

InvoiceSummary represents a single invoice in the ghost_invoice_list output.

type ListInput

type ListInput struct{}

ListInput represents input for ghost_list (empty - no parameters)

func (ListInput) Schema

func (ListInput) Schema() *jsonschema.Schema

type ListOutput

type ListOutput struct {
	Databases []DatabaseInfo `json:"databases"`
}

ListOutput represents output for ghost_list

func (ListOutput) Schema

func (ListOutput) Schema() *jsonschema.Schema

type LoginInput

type LoginInput struct{}

LoginInput represents input for ghost_login

func (LoginInput) Schema

func (LoginInput) Schema() *jsonschema.Schema

type LoginOutput

type LoginOutput struct {
	Name    string `json:"name"`
	Email   string `json:"email"`
	SpaceID string `json:"space_id"`
}

LoginOutput represents output for ghost_login

func (LoginOutput) Schema

func (LoginOutput) Schema() *jsonschema.Schema

type LogsInput

type LogsInput struct {
	Ref   string    `json:"name_or_id"`
	Tail  int       `json:"tail,omitempty"`
	Until time.Time `json:"until,omitempty"`
}

LogsInput represents input for ghost_logs

func (LogsInput) Schema

func (LogsInput) Schema() *jsonschema.Schema

type LogsOutput

type LogsOutput struct {
	Logs []string `json:"logs"`
}

LogsOutput represents output for ghost_logs

func (LogsOutput) Schema

func (LogsOutput) Schema() *jsonschema.Schema

type PasswordInput

type PasswordInput struct {
	Ref      string `json:"name_or_id"`
	Password string `json:"password,omitempty"`
}

PasswordInput represents input for ghost_password

func (PasswordInput) Schema

func (PasswordInput) Schema() *jsonschema.Schema

type PasswordOutput

type PasswordOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Password         string   `json:"password"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

PasswordOutput represents output for ghost_password

func (PasswordOutput) Schema

func (PasswordOutput) Schema() *jsonschema.Schema

type PauseInput added in v0.9.0

type PauseInput struct {
	Ref string `json:"name_or_id"`
}

PauseInput represents input for ghost_pause

func (PauseInput) Schema added in v0.9.0

func (PauseInput) Schema() *jsonschema.Schema

type PauseOutput added in v0.9.0

type PauseOutput struct {
	Success bool   `json:"success"`
	ID      string `json:"id"`
	Name    string `json:"name"`
}

PauseOutput represents output for ghost_pause

func (PauseOutput) Schema added in v0.9.0

func (PauseOutput) Schema() *jsonschema.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 RenameInput

type RenameInput struct {
	Ref  string `json:"name_or_id"`
	Name string `json:"name"`
}

RenameInput represents input for ghost_rename

func (RenameInput) Schema

func (RenameInput) Schema() *jsonschema.Schema

type RenameOutput

type RenameOutput struct {
	Success bool   `json:"success"`
	ID      string `json:"id"`
	OldName string `json:"old_name"`
	Name    string `json:"name"`
}

RenameOutput represents output for ghost_rename

func (RenameOutput) Schema

func (RenameOutput) Schema() *jsonschema.Schema

type ResumeInput

type ResumeInput struct {
	Ref  string `json:"name_or_id"`
	Wait bool   `json:"wait,omitempty"`
}

ResumeInput represents input for ghost_resume

func (ResumeInput) Schema

func (ResumeInput) Schema() *jsonschema.Schema

type ResumeOutput

type ResumeOutput struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	ConnectionString string   `json:"connection_string"`
	Warnings         []string `json:"warnings,omitempty"`
}

ResumeOutput represents output for ghost_resume

func (ResumeOutput) Schema

func (ResumeOutput) Schema() *jsonschema.Schema

type SQLInput

type SQLInput struct {
	Ref        string   `json:"name_or_id"`
	Query      string   `json:"query"`
	Parameters []string `json:"parameters,omitempty"`
}

SQLInput represents input for ghost_sql

func (SQLInput) Schema

func (SQLInput) Schema() *jsonschema.Schema

type SQLOutput

type SQLOutput struct {
	ResultSets    []common.ResultSet `json:"result_sets"`
	ExecutionTime string             `json:"execution_time"`
}

SQLOutput represents output for ghost_sql

func (SQLOutput) Schema

func (SQLOutput) Schema() *jsonschema.Schema

type SchemaInput

type SchemaInput struct {
	Ref string `json:"name_or_id"`
}

SchemaInput represents input for ghost_schema

func (SchemaInput) Schema

func (SchemaInput) Schema() *jsonschema.Schema

type Server

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

Server wraps the MCP server with Ghost-specific functionality

func NewServer

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

NewServer creates a new Ghost MCP server instance

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 StatusInput

type StatusInput struct{}

StatusInput represents input for ghost_status (empty - no parameters)

func (StatusInput) Schema

func (StatusInput) Schema() *jsonschema.Schema

type StatusOutput

type StatusOutput struct {
	ComputeMinutes      int64                 `json:"compute_minutes"`
	ComputeLimitMinutes int64                 `json:"compute_limit_minutes"`
	Storage             string                `json:"storage"`
	StorageLimit        string                `json:"storage_limit"`
	Databases           common.DatabaseCounts `json:"databases"`
	CostToDate          *float64              `json:"cost_to_date,omitempty"`
	EstimatedTotalCost  *float64              `json:"estimated_total_cost,omitempty"`
	BillingPeriodStart  *time.Time            `json:"billing_period_start,omitempty"`
	BillingPeriodEnd    *time.Time            `json:"billing_period_end,omitempty"`
}

StatusOutput represents output for ghost_status

func (StatusOutput) Schema

func (StatusOutput) Schema() *jsonschema.Schema

Jump to

Keyboard shortcuts

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