Documentation
¶
Index ¶
- Variables
- func NewMCPServer() *mcp.Server
- func PrintToolsets(w io.Writer) error
- func Run(ctx context.Context) error
- func RunHTTP(ctx context.Context, host string, port int, allowNonLoopback bool) error
- type APIInfoInput
- type Action
- type ActivityInput
- type ContextInput
- type ContextResult
- type GenericResourceInput
- type GuideInput
- type ListParams
- type OrgMembershipsInput
- type OrgSummary
- type ProjectSummary
- type ProjectsInput
- type RoutedInput
- type SuggestedAction
- type ToolError
- type ToolsetInfo
- type ToolsetsInput
- type ToolsetsLoadResult
- type UsersInput
Constants ¶
This section is empty.
Variables ¶
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 ¶
NewMCPServer constructs the MCP server with all registered tools.
func PrintToolsets ¶ added in v0.3.0
PrintToolsets writes every toolset, whether it's loaded at startup under the current environment, and what it covers: the --list-toolsets output.
func RunHTTP ¶
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 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 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 ToolsetsInput ¶ added in v0.3.0
type ToolsetsLoadResult ¶ added in v0.3.0
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
}