Skip to main content

McpCommand

Enum McpCommand 

Source
pub enum McpCommand {
    Npx {
        version: String,
    },
    NativeBinary {
        binary: PathBuf,
        version: String,
    },
    NodeLauncher {
        launcher: PathBuf,
        version: String,
    },
    Explicit(PathBuf),
    OnPath,
}
Expand description

How the MCP server entry (and the skill’s bootstrap commands) invoke mushroomdb.

The assistant host spawns the MCP server by command, so that command has to resolve from its process, not from the shell install ran in. A bare name only works when it resolves on the host’s PATH, and the one case where that is provable is when the mushroomdb PATH resolves to is this very executable. Everything else — npm’s Node shim, a different build, a local target/release binary, no hit at all — pins the published package and lets npx fetch it.

Variants§

§

Npx

npx -y mushroomdb@<version> … — the fallback when the package cannot be located, and the only form that works from a machine where nothing is installed globally.

Fields

§version: String
§

NativeBinary

The published package’s own native binary, located once at install time and run directly. The fast form, and what a hook gets whenever the package has been fetched.

Everything else in this enum that reaches the published package ends up running this exact file; the difference is what it costs to get there. Measured warm, --version end to end: npx 514 ms, node <launcher> 118 ms, this 7 ms. Node’s own startup is nearly all of the difference — the launcher script’s only job is to spawn this binary — and a hook pays it on every prompt and every edit.

Fields

§binary: PathBuf

Absolute path to the vendored executable.

§version: String

The version it was resolved from; re-resolved on upgrade.

§

NodeLauncher

node <launcher.js> … — the same published package reached through its npm shim. The fallback for an install whose native binary could not be located (a postinstall that never fetched it, say): still resolved once rather than on every invocation, just through a Node startup.

Fields

§launcher: PathBuf

Absolute path to the package’s bin script.

§version: String

The version it was resolved from; re-resolved on upgrade.

§

Explicit(PathBuf)

An absolute path the user named with --command.

§

OnPath

mushroomdb resolves on PATH and is this executable: the bare name is safe and follows upgrades.

Implementations§

Source§

impl McpCommand

Source

pub fn npx() -> Self

The npx form pinned to the version of the binary writing it.

Source

pub fn json_entry(&self, sub: &str, db: &str) -> Value

The MCP server entry: {"command": …, "args": [… , sub, db]}.

Nothing here is shell-quoted. An MCP host spawns the command with an argv, so a path with a space in it is one element and quoting it would make the quotes part of the filename.

Source

pub fn shell(&self) -> String

The same invocation as a command prefix for a POSIX shell, already quoted where quoting is needed.

Hook entries and the skill’s copy-paste lines are read by a shell, so an explicit path — and a resolved binary or launcher path, which lives wherever npm put it — has to survive a space in it. The bare name and the npx form contain no metacharacters and are left as they read.

Trait Implementations§

Source§

impl Clone for McpCommand

Source§

fn clone(&self) -> Self

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 McpCommand

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for McpCommand

Source§

impl PartialEq for McpCommand

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for McpCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.