pub struct McpService { /* private fields */ }Expand description
MCP service implementation — UUID-keyed tool registry
Implementations§
Trait Implementations§
Source§impl McpHandler for McpService
impl McpHandler for McpService
Authorize an operation on a resource. Override to enforce policy. Read more
Source§fn handle_get_status<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_get_status<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle
getStatus request.Source§fn handle_list_tools<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_list_tools<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle
listTools request.Source§fn handle_get_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_get_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_request_id: u64,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle
getMetrics request.Source§fn handle_call_tool<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
_request_id: u64,
data: &'life2 CallTool,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_call_tool<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
_request_id: u64,
data: &'life2 CallTool,
) -> Pin<Box<dyn Future<Output = Result<McpResponseVariant>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handle
callTool request.Check if a specific resource+operation is authorized (non-failing). Read more
Source§impl RequestService for McpService
impl RequestService for McpService
Source§fn decode_request_body(&self, signed_body: &[u8]) -> Result<DecodedRequestBody>
fn decode_request_body(&self, signed_body: &[u8]) -> Result<DecodedRequestBody>
Decode the signed request body exactly once (bounded) and derive
the full numeric method leaf path (v16 §5.2 step 4). Read more
Source§fn handle_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
body: &'life2 DecodedRequestBody,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<Continuation>)>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
body: &'life2 DecodedRequestBody,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<Continuation>)>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Process a request and return a response with optional continuation. Read more
Source§fn transport(&self) -> &TransportConfig
fn transport(&self) -> &TransportConfig
Transport configuration (endpoint binding).
Source§fn signing_key(&self) -> SigningKey
fn signing_key(&self) -> SigningKey
Ed25519 signing key for signing responses.
Source§fn expected_audience(&self) -> Option<&str>
fn expected_audience(&self) -> Option<&str>
Expected audience (resource URL) for JWT validation. Read more
Source§fn jwt_key_source(&self) -> Option<Arc<dyn JwtKeySource>>
fn jwt_key_source(&self) -> Option<Arc<dyn JwtKeySource>>
JWT key source for token verification. Read more
Source§fn build_error_payload(&self, request_id: u64, error: &str) -> Vec<u8> ⓘ
fn build_error_payload(&self, request_id: u64, error: &str) -> Vec<u8> ⓘ
Build a generic error response payload for unexpected errors. Read more
Source§fn producer_reach_config_handle(
&self,
) -> Option<Arc<RwLock<RawRwLock, ProducerReachConfig>>>
fn producer_reach_config_handle( &self, ) -> Option<Arc<RwLock<RawRwLock, ProducerReachConfig>>>
Mutable reach source filled by the unified service spawner after the
service’s QUIC and iroh listeners bind.
Source§fn moq_origin_handle(
&self,
) -> Option<Arc<RwLock<RawRwLock, Option<MoqStreamOrigin>>>>
fn moq_origin_handle( &self, ) -> Option<Arc<RwLock<RawRwLock, Option<MoqStreamOrigin>>>>
Optional per-service MoQ origin source. The unified spawner installs a
scoped origin here when this service has a relay configured.
Source§fn pq_signing_key(&self) -> Option<SigningKey<MlDsa65>>
fn pq_signing_key(&self) -> Option<SigningKey<MlDsa65>>
ML-DSA-65 signing key for the post-quantum half of the response COSE
composite (#275). Returning
None makes process_request fail closed
before dispatch; it never selects an EdDSA-only response. The matching ML-DSA-65 public key
must be anchored in the client’s PQ trust store for Hybrid verification
to succeed (peer attestation). Read moreSource§fn verifying_key(&self) -> VerifyingKey
fn verifying_key(&self) -> VerifyingKey
Ed25519 verifying key for envelope signature verification.
Source§fn delegated_user_audience(
&self,
_signer_pubkey: &[u8; 32],
_untrusted_aud: Option<&str>,
) -> Option<&str>
fn delegated_user_audience( &self, _signer_pubkey: &[u8; 32], _untrusted_aud: Option<&str>, ) -> Option<&str>
Select an exact, configured audience for an already-admitted delegated
user bearer. The unverified claim is only a selector: implementations
must return their own configured string, never a borrowed token value.
Direct and service credentials always use
expected_audience instead.Source§fn accept_delegated_resource_leaf(
&self,
_ctx: &EnvelopeContext,
_body: &DecodedRequestBody,
) -> bool
fn accept_delegated_resource_leaf( &self, _ctx: &EnvelopeContext, _body: &DecodedRequestBody, ) -> bool
Admit a non-native resource bearer only for a decoded signed request
leaf. Default denial preserves every service’s native issuer boundary.
Source§fn require_cnf_binding(&self) -> bool
fn require_cnf_binding(&self) -> bool
Whether to reject JWTs that lack a
cnf key binding (jwk or jkt). Read moreSource§fn credential_revocation_store(&self) -> Option<&dyn CredentialRevocationStore>
fn credential_revocation_store(&self) -> Option<&dyn CredentialRevocationStore>
Credential revocation store for access token revocation. Read more
Source§fn jwt_verify_policy(&self) -> CryptoPolicy
fn jwt_verify_policy(&self) -> CryptoPolicy
Source§fn resolve_key_subject(&self, signer_pubkey: &[u8; 32]) -> Option<Subject>
fn resolve_key_subject(&self, signer_pubkey: &[u8; 32]) -> Option<Subject>
Resolve a verified signer key to an authorization subject (#446). Read more
Source§fn cache_key_binding(
&self,
_verifying_key: VerifyingKey,
_subject: &str,
_jwt: &str,
_expires_at: i64,
)
fn cache_key_binding( &self, _verifying_key: VerifyingKey, _subject: &str, _jwt: &str, _expires_at: i64, )
Cache a verified key→subject binding in the trust store. Read more
Source§fn accept_delegated_bearer(&self, _signer_pubkey: &[u8; 32]) -> bool
fn accept_delegated_bearer(&self, _signer_pubkey: &[u8; 32]) -> bool
Accept a relayed bearer from this verified envelope signer. Services
enabling this must pin an independently configured controller key.
Source§fn accept_deferred_federate_credential(&self) -> bool
fn accept_deferred_federate_credential(&self) -> bool
Opt in only when this serving instance has a complete request-local
holder-proof, current-primary and durable Policy-use adapter. Default
false preserves the generic verifier’s reserved-profile denial.
Source§fn admit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_body: &'life2 DecodedRequestBody,
_proof: &'life3 ParsedProof,
) -> Pin<Box<dyn Future<Output = Result<(VerifiedProof, [u8; 32], String, String, ProofReplayKey, u64), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn admit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_body: &'life2 DecodedRequestBody,
_proof: &'life3 ParsedProof,
) -> Pin<Box<dyn Future<Output = Result<(VerifiedProof, [u8; 32], String, String, ProofReplayKey, u64), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Verify the original holder’s proof and bind it to the exact decoded
body/leaf/resource/action before identity publication. This stage must
not consume replay state: generated method-policy and MAC authorization
still run afterward. Durable Policy admission happens in
commit_deferred_federate_request only after those gates pass.Source§fn commit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_resource: &'life2 str,
_operation: &'life3 str,
_replay_key: &'life4 ProofReplayKey,
_replay_expiry: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
fn commit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_resource: &'life2 str,
_operation: &'life3 str,
_replay_key: &'life4 ProofReplayKey,
_replay_expiry: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Perform fresh Policy admission and durable replay consumption after the
generated method-policy and mandatory MAC gates, immediately before
handler dispatch. Implementations must fail closed if the durable
admission service is unavailable. The default never admits a request.
Source§fn verify_internal_work_bearer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_token: &'life2 str,
_protected: &'life3 ProtectedHeader,
) -> Pin<Box<dyn Future<Output = Result<InternalWorkClaims, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn verify_internal_work_bearer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 EnvelopeContext,
_token: &'life2 str,
_protected: &'life3 ProtectedHeader,
) -> Pin<Box<dyn Future<Output = Result<InternalWorkClaims, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Verify an
iw+jwt internal execution work order presented as the
direct JWT (single-service Model→Inference boundary, user-approved D5). Read moreSource§impl ServerHandler for McpService
impl ServerHandler for McpService
fn get_info(&self) -> ServerInfo
fn list_tools( &self, _request: Option<PaginatedRequestParams>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListToolsResult, ErrorData>> + Send + '_
fn call_tool( &self, request: CallToolRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CallToolResult, ErrorData>> + Send + '_
fn enqueue_task( &self, _request: CallToolRequestParams, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CreateTaskResult, ErrorData>> + Send
fn ping( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn initialize( &self, request: InitializeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<InitializeResult, ErrorData>> + Send
fn complete( &self, request: CompleteRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CompleteResult, ErrorData>> + Send
fn set_level( &self, request: SetLevelRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn get_prompt( &self, request: GetPromptRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetPromptResult, ErrorData>> + Send
fn list_prompts( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListPromptsResult, ErrorData>> + Send
fn list_resources( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourcesResult, ErrorData>> + Send
fn list_resource_templates( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourceTemplatesResult, ErrorData>> + Send
fn read_resource( &self, request: ReadResourceRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ReadResourceResult, ErrorData>> + Send
fn subscribe( &self, request: SubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn unsubscribe( &self, request: UnsubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn on_custom_request( &self, request: CustomRequest, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CustomResult, ErrorData>> + Send
fn on_cancelled( &self, notification: CancelledNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_progress( &self, notification: ProgressNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_initialized( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_roots_list_changed( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_custom_notification( &self, notification: CustomNotification, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn list_tasks( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListTasksResult, ErrorData>> + Send
fn get_task_info( &self, request: GetTaskInfoParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetTaskInfoResult, ErrorData>> + Send
fn get_task_result( &self, request: GetTaskResultParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<TaskResult, ErrorData>> + Send
fn cancel_task( &self, request: CancelTaskParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
Auto Trait Implementations§
impl Freeze for McpService
impl !RefUnwindSafe for McpService
impl Send for McpService
impl Sync for McpService
impl Unpin for McpService
impl UnsafeUnpin for McpService
impl !UnwindSafe for McpService
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
§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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<T> JaggedSlice<T> for T
impl<T> JaggedSlice<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§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
§impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
fn serve_with_ct<T, E, A>( self, transport: T, ct: CancellationToken, ) -> impl Future<Output = Result<RunningService<RoleServer, S>, ServerInitializeError>> + Send
§fn into_dyn(self) -> Box<dyn DynService<R>>
fn into_dyn(self) -> Box<dyn DynService<R>>
Convert this service to a dynamic boxed service Read more
fn serve<T, E, A>( self, transport: T, ) -> impl Future<Output = Result<RunningService<R, Self>, <R as ServiceRole>::InitializeError>> + Send
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§impl<S> Spawnable for S
impl<S> Spawnable for S
Source§fn registrations(&self) -> Vec<(SocketKind, TransportConfig)>
fn registrations(&self) -> Vec<(SocketKind, TransportConfig)>
Endpoints to register with EndpointRegistry. Read more