Documentation
¶
Overview ¶
Package mcpserve exposes Pulse's Model Context Protocol server as a public entry point.
The MCP wiring lives in the public mcp/ core (SDK-free catalog) plus the mcp/gosdk adapter (the only package importing the MCP SDK); the library facade has no dependency on either. This package lets an embedder serve a Pulse MCP from its own process — including any operators, expression functions, or label tables registered via the constructed *pulse.Pulse's Options.Extensions — without shelling out to the `pulse` binary. That is the only way a domain layer (e.g. a BERA-flavored Pulse) can surface its in-process Go extensions over MCP, since the stock binary cannot load them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPulse ¶
NewPulse constructs the *pulse.Pulse an MCP server serves, applying the MCP-layer feature profile first. The profile source, highest first:
- opts.FeatureProfileFile — refused (PULSE_FEATURE_PROFILE_INVALID, reason both_options_set) when popts already carries a profile.
- A profile popts already carries (popts.FeatureProfile or popts.FeatureProfileFile) — PULSE_FEATURE_PROFILE is then ignored.
- The PULSE_FEATURE_PROFILE environment variable.
The flag and env forms are host OS paths, read here with the OS filesystem: they configure the server process, so they resolve against its working directory rather than inside the cohort data root. An unreadable file is PULSE_FEATURE_PROFILE_INVALID, reason file_unreadable, with the path under the "path" detail; a malformed one carries pulse.ParseFeatureProfile's refusal plus the path. Name and dependency validation happen in pulse.New exactly as for any profile.
The returned instance carries the profile, so serving it through Serve or ServeStdio (or gosdk.Register) honours behaviour.disable_cohort_scan.
Types ¶
type Options ¶
type Options struct {
// BindOnOpen registers session-scoped schema-bound tool variants on a
// successful pulse_inspect. True gives MCP clients typed enum constraints
// on field-name parameters; false leaves only the unbound global tools,
// which is useful for clients that bind tool schemas themselves.
BindOnOpen bool
// Version is the server identity advertised during initialize and threaded
// into the adapter Config. Defaults to pulse.Version() when empty.
Version string
// DisableCohortScan skips the startup filesystem walk that enumerates the
// data root's .pulse files as exact-match pulse:// resources. Cohorts stay
// readable through the pulse:// template either way — only the
// resources/list enumeration is withheld. Leave it false (the zero value,
// the pre-knob behaviour) unless walking the root at startup is itself the
// cost you are avoiding. A feature profile on the served *pulse.Pulse
// whose behaviour sets disable_cohort_scan ORs into this field.
DisableCohortScan bool
// FeatureProfileFile is a host OS path (absolute, or relative to the
// process working directory) to a feature profile JSON file. It is
// consumed by NewPulse, which reads it with the OS filesystem — never
// the instance's afero Fs or DataDir — parses it with
// pulse.ParseFeatureProfile and hands the value to pulse.New through
// pulse.Options.FeatureProfile. Empty falls back to the
// PULSE_FEATURE_PROFILE environment variable, which NewPulse ignores
// when the pulse.Options it is given already carry a profile.
//
// Serve and ServeStdio ignore it: a profile is applied when the
// instance is constructed, so serve an instance built by NewPulse
// (or by pulse.New with a profile) to get one.
FeatureProfileFile string
}
Options configures the served MCP server.
type ServeInfo ¶
type ServeInfo struct {
// CohortScan reports whether the startup walk that enumerates the
// data root's .pulse files runs. False when Options.DisableCohortScan
// is set OR the instance's feature profile sets
// behaviour.disable_cohort_scan — the same OR gosdk.Register applies.
CohortScan bool
// FeatureProfileLoaded reports whether the instance was built with a
// feature profile.
FeatureProfileLoaded bool
// FeatureProfile is the loaded profile's free-form "profile" label.
// Empty when no profile is loaded or the profile carries no label.
FeatureProfile string
}
ServeInfo is the effective serving configuration of an MCP server built from a *pulse.Pulse and Options, after the instance's feature profile is folded in. It is what a startup notice should report: the requested Options alone can say the cohort scan is on while the profile has turned it off.