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.
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
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
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
impl McpCommand
Sourcepub fn json_entry(&self, sub: &str, db: &str) -> Value
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.
Sourcepub fn shell(&self) -> String
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
impl Clone for McpCommand
Source§impl Debug for McpCommand
impl Debug for McpCommand
impl Eq for McpCommand
Source§impl PartialEq for McpCommand
impl PartialEq for McpCommand
impl StructuralPartialEq for McpCommand
Auto Trait Implementations§
impl Freeze for McpCommand
impl RefUnwindSafe for McpCommand
impl Send for McpCommand
impl Sync for McpCommand
impl Unpin for McpCommand
impl UnsafeUnpin for McpCommand
impl UnwindSafe for McpCommand
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.