pub struct McpSpec {
pub name: String,
pub owner_tag: String,
pub transport: McpTransport,
pub friendly_name: Option<String>,
pub secret_policy: SecretPolicy,
pub adopt_unowned: bool,
}Expand description
Caller-supplied description of an MCP server to register with a harness.
MCP servers are keyed by name (the literal string the harness
uses to load the server), not by an arbitrary tag. To support multi-consumer
coexistence the library records ownership in a sidecar ledger
(<config-dir>/.agent-config-mcp.json) keyed by name → owner_tag. Removing a
server owned by a different consumer (or by a hand-edit) returns
AgentConfigError::NotOwnedByCaller.
Build via McpSpec::builder. For fallible construction see
McpSpecBuilder::try_build.
Fields§
§name: StringServer name. Becomes the key in mcpServers (Claude/Cursor/Gemini/
Copilot/Windsurf), the object-based mcp map (OpenCode/Kilo), or the
table name [mcp_servers.<name>] (Codex).
ASCII alnum/_/-, non-empty.
owner_tag: StringThe consumer of this library that owns the server, recorded in the
ownership ledger. ASCII alnum/_/-, non-empty.
transport: McpTransportHow the harness should reach the server (stdio launcher, HTTP, or SSE).
friendly_name: Option<String>Optional human-friendly display name surfaced in install reports.
secret_policy: SecretPolicyPolicy for inline env values that look secret-bearing when installing into project-local config files.
adopt_unowned: boolWhen true, an install that finds an entry already present in the
harness config but absent from the ownership ledger will adopt that
entry under this spec’s owner_tag instead of refusing. Use after a
crash between config write and ledger record (InstallStatus::PresentUnowned).
Default false: adoption is opt-in to avoid silently taking over a
hand-installed entry the user may want to keep separate.