A Go client for the MCSManager panel API. Manage users, daemons, instances, files, Docker images, and dashboard data from Go.
Requires Go 1.23.4 or newer.
go get github.com/Dobytchick/mcsmapiCreate an API key in MCSManager, then set MCSM_API_KEY in your environment. Use HTTPS when connecting to a remote panel: the MCSManager API sends the key as a query parameter.
package main
import (
"fmt"
"log"
"os"
"github.com/Dobytchick/mcsmapi"
)
func main() {
client := mcsmapi.NewClient(os.Getenv("MCSM_API_KEY"), "http://localhost:23333", nil)
users, err := client.User.GetList(&mcsmapi.UserQueryParams{Page: 1, PageSize: 10})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", users.Data)
}NewClient accepts an optional *http.Client; passing nil uses a client with a 10-second timeout. API and HTTP failures are returned as errors.
| Client | Typical operations |
|---|---|
client.User |
Search, create, update, and delete users |
client.Daemon |
Add, remove, and connect daemons |
client.Instance |
List, create, control, and send commands to instances |
client.File |
List, read, update, copy, move, archive, and delete files |
client.Image |
Inspect images, containers, networks, and build progress |
client.Dashboard |
Read the panel overview |
result, err := client.Instance.SendCommandResult("instance-uuid", "daemon-uuid", "say Hello from Go")
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Data)File.Download and File.Upload request one-time transfer credentials from the panel. The actual download or multipart upload takes place against the daemon address returned by the API. See the MCSManager file API for that second step.
Browse the usage guide, runnable examples, and the Go package reference for request and response types.
go test ./...
go vet ./...Each example has its own directory and can be run with go run ./examples/<name> after setting MCSM_API_KEY and replacing placeholder IDs.