Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the server's release version, reported to clients during the MCP initialize handshake. It is overridden at build time via -ldflags "-X .../internal/server.Version=...") so released binaries report their actual tag instead of this placeholder.

Functions

func NewMCPServer

func NewMCPServer() *mcp.Server

NewMCPServer constructs the MCP server with all registered tools.

func PrintToolsets added in v0.3.0

func PrintToolsets(w io.Writer) error

PrintToolsets writes every toolset, whether it's loaded at startup under the current environment, and what it covers: the --list-toolsets output.

func Run

func Run(ctx context.Context) error

Run starts the server over stdio (default transport).

func RunHTTP

func RunHTTP(ctx context.Context, host string, port int, allowNonLoopback bool) error

RunHTTP starts the server using the streamable HTTP transport on host:port. This is for a client that connects to an already-running server by URL (an HTTP-type MCP client config), not one that spawns datum-mcp itself as a subprocess - that's what stdio mode (the default) is for. Shuts down gracefully when ctx is canceled (e.g. on SIGINT/SIGTERM - see cmd/datum-mcp).

This transport has no authentication or Origin check of its own: every tool call runs with whatever Datum Cloud credentials this process has (the operator's own, via EnsureAuth). Anyone who can reach host:port can act as that operator against Datum Cloud. Refuses to bind to a non-loopback host unless allowNonLoopback is set.

Types

type APIInfoInput

type APIInfoInput struct {
	Project string `json:"project,omitempty" jsonschema:"Optional project id; overrides the active project."`
	Group   string `json:"group,omitempty" jsonschema:"API group, e.g. 'networking.datumapis.com'; required for action=get."`
	Version string `json:"version,omitempty" jsonschema:"API version, e.g. 'v1alpha'; required for action=get."`
	Kind    string `json:"kind,omitempty" jsonschema:"Resource Kind, e.g. 'Domain'; required for action=get."`
	Action  string `json:"action,omitempty" jsonschema:"One of list|get."`
	Detail  string `` /* 169-byte string literal not displayed */
}

type Action

type Action string
const (
	ActionList   Action = "list"
	ActionGet    Action = "get"
	ActionCreate Action = "create"
	ActionUpdate Action = "update"
	ActionDelete Action = "delete"
)

type ActivityInput

type ActivityInput struct {
	RoutedInput
	QueryType string `json:"queryType" jsonschema:"One of audit|events|feed. See the tool description for each one's distinct body.spec fields."`
}

ActivityInput is RoutedInput plus the queryType that selects which of the three activity.miloapis.com query Kinds to use.

type ContextInput

type ContextInput struct{}

ContextInput takes no fields; it's a pure discovery call.

type ContextResult

type ContextResult struct {
	Authenticated          bool             `json:"authenticated"`
	ActiveOrganization     string           `json:"active_organization,omitempty"`
	ActiveProject          string           `json:"active_project,omitempty"`
	ProjectSource          string           `json:"project_source,omitempty"`
	Organizations          []OrgSummary     `json:"organizations,omitempty"`
	OrganizationsTruncated bool             `json:"organizations_truncated,omitempty"`
	Projects               []ProjectSummary `json:"projects,omitempty"`
	ProjectsTruncated      bool             `json:"projects_truncated,omitempty"`
	// Warnings carries lookups that failed without stopping the rest of the
	// snapshot, e.g. an identity that can't list organizations.
	Warnings []string `json:"warnings,omitempty"`
	NextStep string   `json:"next_step,omitempty"`
}

type GenericResourceInput

type GenericResourceInput struct {
	RoutedInput
	Group     string `json:"group" jsonschema:"API group, e.g. 'compute.datumapis.com'."`
	Kind      string `json:"kind" jsonschema:"Resource Kind, e.g. 'Workload'."`
	Namespace string `` /* 134-byte string literal not displayed */
}

GenericResourceInput is RoutedInput plus the group/kind/namespace that a dedicated crudResource would otherwise fix at registration time.

type GuideInput added in v0.2.5

type GuideInput struct {
	Skill string `` /* 163-byte string literal not displayed */
}

type ListParams

type ListParams struct {
	Limit         int64  `json:"limit,omitempty" jsonschema:"Max items to return (list only); default 100, max 500."`
	Continue      string `json:"continue,omitempty" jsonschema:"Continuation token from a previous list response, for the next page (list only)."`
	LabelSelector string `json:"labelSelector,omitempty" jsonschema:"kubectl-style label selector, e.g. 'team=edge,env!=prod' (list only)."`
	FieldSelector string `` /* 158-byte string literal not displayed */
}

ListParams is embedded in every tool input that supports a 'list' action. All fields are ignored for other actions.

type OrgMembershipsInput

type OrgMembershipsInput struct {
	Action string `json:"action" jsonschema:"One of list|get|set."`
	Name   string `json:"name,omitempty" jsonschema:"Organization id; required for action=set, verified against your memberships."`
	ListParams
}

type OrgSummary

type OrgSummary struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name,omitempty"`
}

type ProjectSummary

type ProjectSummary struct {
	Name string `json:"name"`
}

type ProjectsInput

type ProjectsInput struct {
	Action string         `json:"action" jsonschema:"One of list|get|set|create."`
	Org    string         `json:"org,omitempty" jsonschema:"Optional organization id; defaults to DATUM_ORG env or the active organization."`
	Body   map[string]any `json:"body,omitempty" jsonschema:"For action=set: {\"name\": \"<project-id>\"}. For action=create: a Project manifest."`
	ListParams
	// DryRun applies to action=create only.
	DryRun bool `json:"dryRun,omitempty" jsonschema:"For action=create only: validate without persisting."`
}

type RoutedInput

type RoutedInput struct {
	// Optional per-request project override; if empty, uses the active project.
	Project string `json:"project,omitempty" jsonschema:"Optional project id; overrides the active project."`
	// Action: one of list|get|create|update|delete (or list|get for read-only resources).
	Action Action `json:"action" jsonschema:"The operation to perform."`
	// ID required for get/update/delete
	ID string `json:"id,omitempty" jsonschema:"Resource name; required for get/update/delete."`
	// Body is the request payload for create/update
	Body map[string]any `` /* 327-byte string literal not displayed */
	ListParams
	// DryRun validates create/update/delete server-side without persisting the change.
	DryRun bool `` /* 137-byte string literal not displayed */
	// ResourceVersion, for update/delete only: enables optimistic concurrency.
	ResourceVersion string `` /* 147-byte string literal not displayed */
}

RoutedInput is the shared input shape for every CRD-backed CRUD tool.

type SuggestedAction

type SuggestedAction struct {
	Tool   string         `json:"tool"`
	Action string         `json:"action,omitempty"`
	Args   map[string]any `json:"args,omitempty"`
}

SuggestedAction tells an agent exactly which tool call is likely to resolve the error it just received, instead of making it parse prose to figure out the recovery step itself.

type ToolError

type ToolError struct {
	Error           string           `json:"error"`
	SuggestedAction *SuggestedAction `json:"suggested_action,omitempty"`
}

ToolError is the structured JSON body returned for every tool failure.

type ToolsetInfo added in v0.3.0

type ToolsetInfo struct {
	Name   string `json:"name"`
	Covers string `json:"covers"`
	// State is loaded, available (load it with action=load) or disabled
	// (DATUM_MCP_DISABLE_TOOLSETS: can't be loaded from here).
	State string `json:"state"`
	Guide string `json:"guide,omitempty"`
}

type ToolsetsInput added in v0.3.0

type ToolsetsInput struct {
	Action string   `json:"action" jsonschema:"One of list|load."`
	Names  []string `json:"names,omitempty" jsonschema:"Toolsets to load (load only), e.g. [\"alb\", \"compute\"]."`
}

type ToolsetsLoadResult added in v0.3.0

type ToolsetsLoadResult struct {
	Loaded        []string `json:"loaded,omitempty"`
	AlreadyLoaded []string `json:"already_loaded,omitempty"`
	NextStep      string   `json:"next_step"`
}

type UsersInput

type UsersInput struct {
	Action string `json:"action" jsonschema:"Currently only 'list' is supported."`
	Org    string `json:"org,omitempty" jsonschema:"Optional organization id; defaults to DATUM_ORG env or the active organization."`
	ListParams
}

Jump to

Keyboard shortcuts

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