Documentation
¶
Index ¶
Constants ¶
View Source
const ( ImageRepository = "1panel/mcp-server" ContainerName = "1panel-mcp" SocketDirectory = "/etc/1panel/mcp-runtime" CoreSocket = SocketDirectory + "/core.sock" )
Variables ¶
View Source
var ErrUnsupported = errors.New("MCP Docker runtime requires a local rootful Linux Docker daemon without user namespace remapping")
Functions ¶
func ValidateImage ¶
Types ¶
type CleanupReference ¶
type CleanupResult ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Controller
func (*Controller) HandleWithProgress ¶
func (c *Controller) HandleWithProgress(ctx context.Context, req Request, progress func(PullProgress) error) (Response, error)
type DockerClient ¶
type DockerClient interface {
Close() error
DaemonHost() string
Info(context.Context) (system.Info, error)
ImageInspect(context.Context, string, ...client.ImageInspectOption) (image.InspectResponse, error)
ImagePull(context.Context, string, image.PullOptions) (io.ReadCloser, error)
ImageRemove(context.Context, string, image.RemoveOptions) ([]image.DeleteResponse, error)
ContainerInspect(context.Context, string) (container.InspectResponse, error)
ContainerCreate(context.Context, *container.Config, *container.HostConfig, *network.NetworkingConfig, *ocispec.Platform, string) (container.CreateResponse, error)
ContainerStart(context.Context, string, container.StartOptions) error
ContainerStop(context.Context, string, container.StopOptions) error
ContainerRemove(context.Context, string, container.RemoveOptions) error
ContainerRename(context.Context, string, string) error
ContainerLogs(context.Context, string, container.LogsOptions) (io.ReadCloser, error)
}
type PullEvent ¶
type PullEvent struct {
Type string `json:"type"`
PullProgress
Error string `json:"error,omitempty"`
}
type PullProgress ¶
type Request ¶
type Request struct {
Operation string `json:"operation"`
Image string `json:"image"`
Port int `json:"port"`
Enabled bool `json:"enabled"`
Restart bool `json:"restart"`
ImageID string `json:"imageID,omitempty"`
StreamProgress bool `json:"streamProgress,omitempty"`
Cleanup *CleanupReference `json:"cleanup,omitempty"`
DeleteOldImage bool `json:"deleteOldImage,omitempty"`
}
type Response ¶
type Response struct {
State *State `json:"state,omitempty"`
Catalog json.RawMessage `json:"catalog,omitempty"`
Logs string `json:"logs,omitempty"`
Error string `json:"error,omitempty"`
ImageID string `json:"imageID,omitempty"`
Cleanup *CleanupReference `json:"cleanup,omitempty"`
CleanupResult *CleanupResult `json:"cleanupResult,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.