pub enum McpServer {
Stdio(McpServerConfig),
Sse(McpSseServerConfig),
}Expand description
One MCP server, as basis hands it to mentra.
A thin sum over mentra’s two transport configurations rather than a type of basis’s own: mentra owns what a server is, and re-describing it here would only create something to drift. The enum exists because mentra’s own equivalent is private, so a caller holding a mixed list has nowhere to put it (see the module docs on transports).
Variants§
Stdio(McpServerConfig)
A child process speaking JSON-RPC over its standard streams.
Sse(McpSseServerConfig)
The legacy HTTP+SSE transport from protocol revision 2024-11-05.
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The server’s name, which is also the namespace its tools land under.
Sourcepub fn as_stdio(&self) -> Option<&McpServerConfig>
pub fn as_stdio(&self) -> Option<&McpServerConfig>
The stdio configuration, for a caller that needs the concrete type.
Sourcepub fn as_sse(&self) -> Option<&McpSseServerConfig>
pub fn as_sse(&self) -> Option<&McpSseServerConfig>
The SSE configuration, for a caller that needs the concrete type.
Trait Implementations§
Source§impl Debug for McpServer
Hand-written for the reason McpError reports so little: a stdio
server’s env holds credentials, and by the time one reaches this type basis
has already expanded ${GITHUB_TOKEN} into the real value. Deriving would
put those in every {:?} of an McpConfig, an McpSource, or a
RunConfig — all of which do derive, and any of which
a host may log.
impl Debug for McpServer
Hand-written for the reason McpError reports so little: a stdio
server’s env holds credentials, and by the time one reaches this type basis
has already expanded ${GITHUB_TOKEN} into the real value. Deriving would
put those in every {:?} of an McpConfig, an McpSource, or a
RunConfig — all of which do derive, and any of which
a host may log.
Variable names survive, because that is the same line the errors draw:
naming env.GITHUB_TOKEN is what makes a misconfiguration fixable, and it
repeats nothing that was read. The SSE side needs no help — mentra types
those headers as SecretString, which redacts itself.