Skip to main content

McpSpec

Struct McpSpec 

Source
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: String

Server 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: String

The consumer of this library that owns the server, recorded in the ownership ledger. ASCII alnum/_/-, non-empty.

§transport: McpTransport

How 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: SecretPolicy

Policy for inline env values that look secret-bearing when installing into project-local config files.

§adopt_unowned: bool

When 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.

Implementations§

Source§

impl McpSpec

Source

pub fn builder(name: impl Into<String>) -> McpSpecBuilder

Start building an MCP spec with the given server name.

Trait Implementations§

Source§

impl Clone for McpSpec

Source§

fn clone(&self) -> McpSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for McpSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.