pub struct BrepServer {
pub state: Arc<ServerState>,
}Fields§
§state: Arc<ServerState>Implementations§
Source§impl BrepServer
impl BrepServer
Sourcepub fn new(session_root: PathBuf, backend: Backend) -> Self
pub fn new(session_root: PathBuf, backend: Backend) -> Self
A server that runs sessions on backend, keeping their directories
under session_root. Usable from inside or outside a runtime: nothing
here blocks.
Sourcepub fn with_commands(self, describe: &Value) -> Self
pub fn with_commands(self, describe: &Value) -> Self
Seed discovery from the host’s static command registry without starting an application, renderer or GPU. Execution still starts a session lazily.
Sourcepub fn with_state_dir(self, directory: &Path) -> Result<Self, String>
pub fn with_state_dir(self, directory: &Path) -> Result<Self, String>
Enable restart-safe admission/outcomes for a named local server. The directory must be private and must not be shared by live servers.
Sourcepub fn with_skills_dir(self, directory: &Path) -> Result<Self, String>
pub fn with_skills_dir(self, directory: &Path) -> Result<Self, String>
Serve the skill version selected in an installer-managed directory
(brep-mcp skills install / rollback) instead of the embedded one.
Verified once here, before serving; a later install or rollback takes
effect on restart.
Sourcepub fn with_event_webhook(
self,
url: &str,
secret: &[u8],
) -> Result<Self, String>
pub fn with_event_webhook( self, url: &str, secret: &[u8], ) -> Result<Self, String>
Deliver every diagnostic event to an operator-configured webhook
(brep-mcp serve --event-webhook), signed with secret.
Sourcepub fn with_event_journal(self, directory: &Path) -> Result<Self, String>
pub fn with_event_journal(self, directory: &Path) -> Result<Self, String>
Enable the independent metadata-only diagnostic archive before serving. This performs startup disk I/O; call outside the async request path.
Sourcepub fn engine_only() -> Self
pub fn engine_only() -> Self
The registry-independent server: catalogue tools and resources only
(what brep-mcp schema and the unit tests use).
Sourcepub async fn attach(&self, record: bool) -> Result<SessionInfo, String>
pub async fn attach(&self, record: bool) -> Result<SessionInfo, String>
For an attached backend: make the running app the live session now, so
the tool list carries its commands from the first tools/list (the
HTTP transport may serve requests statelessly, where a later
tools/list_changed reaches nobody). Returns the session info.
Sourcepub async fn rebuild_tools(&self)
pub async fn rebuild_tools(&self)
Regenerate the tool set from the live session’s command registry (or back to the sessionless set) and tell the client the list changed.
Trait Implementations§
Source§impl Clone for BrepServer
impl Clone for BrepServer
Source§impl ServerHandler for BrepServer
impl ServerHandler for BrepServer
Source§fn on_initialized(
&self,
context: NotificationContext<RoleServer>,
) -> impl Future<Output = ()> + Send + '_
fn on_initialized( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send + '_
The client that just initialised is the one tools/list_changed goes to.
Source§fn accepted_subscription_filter(
&self,
requested: &SubscriptionFilter,
) -> Option<SubscriptionFilter>
fn accepted_subscription_filter( &self, requested: &SubscriptionFilter, ) -> Option<SubscriptionFilter>
subscriptions/listen (protocol 2026-07-28): the stream a modern
client opens right after server/discover, and where
tools/list_changed reaches it. Accept whatever it asks for that the capabilities
advertise; a server that leaves this unimplemented answers
method-not-found, which the HTTP transport maps to a 404 and the
client reads as a dropped connection.
Source§fn listen(
&self,
context: SubscriptionContext,
) -> impl Future<Output = Result<(), McpError>> + Send + '_
fn listen( &self, context: SubscriptionContext, ) -> impl Future<Output = Result<(), McpError>> + Send + '_
Hold the stream open until the client cancels it or the connection goes; returning early would end it gracefully and send the client into a re-listen loop.
fn initialize( &self, request: InitializeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<InitializeResult, McpError>> + Send + '_
Source§fn get_info(&self) -> ServerInfo
fn get_info(&self) -> ServerInfo
fn list_prompts( &self, request: Option<PaginatedRequestParams>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListPromptsResult, McpError>> + Send + '_
fn get_prompt( &self, request: GetPromptRequestParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetPromptResponse, McpError>> + Send + '_
fn on_custom_request( &self, request: CustomRequest, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CustomResult, McpError>> + Send + '_
fn list_tools( &self, _request: Option<PaginatedRequestParams>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListToolsResult, McpError>> + Send + '_
Source§fn call_tool(
&self,
request: CallToolRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<CallToolResponse, McpError>> + Send + '_
fn call_tool( &self, request: CallToolRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CallToolResponse, McpError>> + Send + '_
tools/call request from a client. Read moreSource§fn get_task(
&self,
request: GetTaskParams,
_context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<GetTaskResult, McpError>> + Send + '_
fn get_task( &self, request: GetTaskParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetTaskResult, McpError>> + Send + '_
tasks/get: return the current DetailedTask state.Source§fn cancel_task(
&self,
request: CancelTaskParams,
_context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), McpError>> + Send + '_
fn cancel_task( &self, request: CancelTaskParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), McpError>> + Send + '_
tasks/cancel: cooperative cancellation. Returns an empty
acknowledgement; the task’s observable status may lag.Source§fn update_task(
&self,
request: UpdateTaskParams,
_context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), McpError>> + Send + '_
fn update_task( &self, request: UpdateTaskParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), McpError>> + Send + '_
tasks/update: accept responses to outstanding in-task
input requests. Returns an empty acknowledgement on success.fn list_resource_templates( &self, _request: Option<PaginatedRequestParams>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourceTemplatesResult, McpError>> + Send + '_
fn list_resources( &self, _request: Option<PaginatedRequestParams>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourcesResult, McpError>> + Send + '_
fn read_resource( &self, request: ReadResourceRequestParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ReadResourceResponse, McpError>> + Send + '_
fn ping( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
Source§fn negotiate_initialize(
&self,
request: &InitializeRequestParams,
) -> Result<InitializeResult, ErrorData>
fn negotiate_initialize( &self, request: &InitializeRequestParams, ) -> Result<InitializeResult, ErrorData>
initialize response for request, negotiating the
protocol version against Self::supported_protocol_versions. Read moreSource§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
Source§fn discover(
&self,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<DiscoverResult, ErrorData>> + MaybeSendFuture
fn discover( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<DiscoverResult, ErrorData>> + MaybeSendFuture
fn complete( &self, request: CompleteRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CompleteResult, ErrorData>> + MaybeSendFuture
fn set_level( &self, request: SetLevelRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
Source§fn subscribe(
&self,
request: SubscribeRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn subscribe( &self, request: SubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
resources/subscribe is legacy-only; implement accepted_subscription_filter and listen for protocol version 2026-07-28
Source§fn unsubscribe(
&self,
request: UnsubscribeRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn unsubscribe( &self, request: UnsubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
resources/unsubscribe is legacy-only; subscriptions/listen is cancelled through its request lifecycle
fn on_cancelled( &self, notification: CancelledNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_progress( &self, notification: ProgressNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_roots_list_changed( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_custom_notification( &self, notification: CustomNotification, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
Source§fn list_skills(
&self,
request: Option<PaginatedRequestParams>,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<ListSkillsResult, ErrorData>> + MaybeSendFuture
fn list_skills( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListSkillsResult, ErrorData>> + MaybeSendFuture
skills/list: one page of the skills this server serves.Source§fn get_skill(
&self,
request: GetSkillRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<GetSkillResult, ErrorData>> + MaybeSendFuture
fn get_skill( &self, request: GetSkillRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetSkillResult, ErrorData>> + MaybeSendFuture
skills/get: the entry for one skill, or -32602 when the
server does not serve a skill at that URI.Source§fn read_resource_directory(
&self,
request: ReadResourceDirectoryRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<ListResourcesResult, ErrorData>> + MaybeSendFuture
fn read_resource_directory( &self, request: ReadResourceDirectoryRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourcesResult, ErrorData>> + MaybeSendFuture
resources/directory/read: the direct children of a
directory resource, or -32602 when the URI is not a directory.Auto Trait Implementations§
impl !RefUnwindSafe for BrepServer
impl !UnwindSafe for BrepServer
impl Forget for BrepServer
impl Freeze for BrepServer
impl Move for BrepServer
impl Send for BrepServer
impl Sync for BrepServer
impl Unpin for BrepServer
impl UnsafeUnpin for BrepServerwhere
*const ArcInner<ServerState> is !null: UnsafeUnpin,
PhantomData<ArcInner<ServerState>>: UnsafeUnpin,
Blanket Implementations§
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<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
fn handle_request( &self, request: <R as ServiceRole>::PeerReq, context: RequestContext<R>, ) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
fn handle_notification( &self, notification: <R as ServiceRole>::PeerNot, context: NotificationContext<R>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
fn get_info(&self) -> <R as ServiceRole>::Info
Source§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<H> Service<RoleServer> for Hwhere
H: ServerHandler,
impl<H> Service<RoleServer> for Hwhere
H: ServerHandler,
async fn handle_request( &self, request: <RoleServer as ServiceRole>::PeerReq, context: RequestContext<RoleServer>, ) -> Result<<RoleServer as ServiceRole>::Resp, ErrorData>
async fn handle_notification( &self, notification: <RoleServer as ServiceRole>::PeerNot, context: NotificationContext<RoleServer>, ) -> Result<(), ErrorData>
fn get_info(&self) -> <RoleServer as ServiceRole>::Info
Source§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
initialize
negotiation may agree to. Read moreSource§impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
Source§fn serve_with_ct<T, E, A>(
self,
transport: T,
ct: CancellationToken,
) -> impl Future<Output = Result<RunningService<RoleServer, S>, ServerInitializeError>> + MaybeSendFuture
fn serve_with_ct<T, E, A>( self, transport: T, ct: CancellationToken, ) -> impl Future<Output = Result<RunningService<RoleServer, S>, ServerInitializeError>> + MaybeSendFuture
Source§fn into_dyn(self) -> Box<dyn DynService<R>>
fn into_dyn(self) -> Box<dyn DynService<R>>
Source§fn serve<T, E, A>(
self,
transport: T,
) -> impl Future<Output = Result<RunningService<R, Self>, <R as ServiceRole>::InitializeError>> + MaybeSendFuture
fn serve<T, E, A>( self, transport: T, ) -> impl Future<Output = Result<RunningService<R, Self>, <R as ServiceRole>::InitializeError>> + MaybeSendFuture
transport and return a running service. Read moreSource§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.