mcp library
Classes
- ConnectanumHttpAuthClient
- Dart IO client for Connectanum router HTTP auth bridge endpoints.
- ConnectanumHttpAuthGrant
- McpAuthorizationCode
- A validated authorization code tied to its original PKCE request.
- McpAuthorizationRequest
- State retained by an MCP client while the resource owner authorizes access.
- McpAuthorizationServerDiscovery
- The successful result of authorization-server metadata discovery.
- McpAuthorizationServerMetadata
- Validated OAuth authorization-server metadata for an MCP client.
- McpBearerChallenge
-
A parsed Bearer challenge from a
WWW-Authenticateresponse header. - McpCompletionArgument
- The argument name and partial value supplied to a completion provider.
- McpCompletionContext
- Previously resolved prompt or URI-template arguments.
- McpCompletionReference
- A prompt or resource-template definition referenced by MCP completion.
- McpCompletionRequest
-
A typed
completion/completerequest body. - McpCompletionResult
- A bounded completion result as defined by MCP.
- McpFormElicitationRequest
-
One validated form-mode
elicitation/createinput request. - McpFormElicitationResponse
- A consumer's response to one MCP form elicitation request.
- McpOAuthAuthorizationTransaction
- A versioned pending OAuth request document for caller-owned secure storage.
- McpOAuthClientAuthentication
- Client authentication used at an OAuth token endpoint.
- McpOAuthClientMetadataDocument
- McpOAuthDynamicClientRegistration
- McpOAuthDynamicClientRegistrationRequest
- McpOAuthLoopbackCallbackListener
- Receives one native OAuth authorization response on a loopback IP literal.
- McpOAuthTokenGrant
- An OAuth bearer grant issued for one canonical MCP resource.
- McpPkcePair
- An RFC 7636 verifier and its SHA-256 code challenge.
- McpPromptReference
- Identifies a prompt whose argument is being completed.
- McpProtectedResourceDiscovery
- The result of Protected Resource Metadata discovery.
- McpProtectedResourceMetadata
- Validated OAuth Protected Resource Metadata for an MCP HTTP endpoint.
- McpResourceTemplateReference
- Identifies a resource URI or URI-template whose argument is being completed.
- McpResourceUriTemplate
- A bounded RFC 6570 Level 1 template for an MCP resource URI.
- McpSseEvent
- McpStatelessDiscoveryResult
-
Route-filtered server information returned by MCP
server/discover. - McpStreamableHttpClient
- HTTP client for session-based MCP revisions and stateless MCP 2026.
- McpStreamablePromptListPage
- McpStreamableResourceListPage
- McpStreamableResourceTemplateListPage
- McpStreamableSubscription
- Active MCP 2026 request-scoped SSE subscription.
- McpStreamableToolListPage
- McpStreamableWampEventBatch
- McpStreamableWampMetaCallResult
- McpStreamableWampPublicationResult
- McpStreamableWampSubscriptionResult
- McpStreamableWampUnsubscribeResult
- McpSubscriptionFilter
-
Notification filter requested or acknowledged by
subscriptions/listen.
Enums
- ConnectanumHttpAuthTokenKind
- Selects the credential revoked by a grant-aware HTTP-auth operation.
- McpElicitationAction
- The outcome selected by a consumer for an MCP form elicitation.
- McpOAuthClientApplicationType
- McpOAuthTokenKind
- Selects which credential from an OAuth grant to revoke.
- McpSubscriptionCloseReason
- How an MCP 2026 request-scoped subscription stream ended.
Extensions
- McpStreamableConnectanumWampTools on McpStreamableHttpClient
- Convenience helpers for Connectanum router-hosted WAMP MCP tools.
Functions
-
createMcpAuthorizationRequest(
{required McpAuthorizationServerMetadata authorizationServer, required Uri resource, required String clientId, required Uri redirectUri, Iterable< String> scopes = const <String>[], McpPkcePair? pkce}) → McpAuthorizationRequest - Creates an OAuth authorization-code request for a protected MCP resource.
-
createMcpDiscoveredAuthorizationRequest(
{required McpProtectedResourceDiscovery protectedResource, required McpAuthorizationServerDiscovery authorizationServer, required Uri resource, required String clientId, required Uri redirectUri, Iterable< String> additionalScopes = const <String>[], McpPkcePair? pkce}) → McpAuthorizationRequest - Creates an OAuth authorization request bound to validated MCP discovery.
-
discoverMcpAuthorizationServerMetadata(
Uri issuer, {HttpClient? httpClient, Map< String, String> headers = const <String, String>{}, bool closeHttpClient = false, int maxMetadataBytes = _defaultMaxMetadataBytes, Duration timeout = _defaultDiscoveryTimeout, void onRequestOpened(HttpClientRequest request)?}) → Future<McpAuthorizationServerDiscovery> -
Discovers MCP-compatible OAuth authorization-server metadata for
issuer. -
discoverMcpProtectedResourceMetadata(
Uri endpoint, {HttpClient? httpClient, Map< String, String> headers = const <String, String>{}, bool closeHttpClient = false, int maxMetadataBytes = _defaultMaxMetadataBytes, Duration timeout = _defaultDiscoveryTimeout, void onRequestOpened(HttpClientRequest request)?}) → Future<McpProtectedResourceDiscovery> - Discovers and validates RFC 9728 metadata for an MCP HTTP endpoint.
-
exchangeMcpAuthorizationCode(
McpAuthorizationCode authorizationCode, {required McpOAuthClientAuthentication clientAuthentication, HttpClient? httpClient, Map< String, String> headers = const <String, String>{}, Duration timeout = _defaultTokenTimeout, int maxResponseBytes = _defaultTokenResponseBytes, void onRequestOpened(HttpClientRequest request)?}) → Future<McpOAuthTokenGrant> - Redeems a validated MCP authorization code at its discovered token endpoint.
-
mcpWampPublishOptions(
{bool? acknowledge, List< int> ? exclude, List<String> ? excludeAuthId, List<String> ? excludeAuthRole, List<int> ? eligible, List<String> ? eligibleAuthId, List<String> ? eligibleAuthRole, bool? excludeMe, bool? discloseMe, bool? retain, String? pptScheme, String? pptSerializer, String? pptCipher, String? pptKeyId, McpJsonMap custom = const <String, Object?>{}}) → McpJsonMap - Builds a JSON options map for Connectanum MCP WAMP publish helpers.
-
mcpWampSubscribeOptions(
{String? match, String? metaTopic, bool? getRetained, McpJsonMap custom = const <String, Object?>{}}) → McpJsonMap - Builds a JSON options map for Connectanum MCP WAMP subscribe helpers.
-
parseMcpAuthorizationCallback(
Uri callbackUri, {required McpAuthorizationRequest request}) → McpAuthorizationCode -
Validates an OAuth redirect callback for
request. -
parseMcpBearerChallenges(
Iterable< String> values) → List<McpBearerChallenge> - Parses valid Bearer challenges while ignoring other authentication schemes.
-
parseMcpSseEvents(
String body) → List< McpSseEvent> -
refreshMcpOAuthToken(
McpOAuthTokenGrant grant, {required McpOAuthClientAuthentication clientAuthentication, Iterable< String> ? scopes, HttpClient? httpClient, Map<String, String> headers = const <String, String>{}, Duration timeout = _defaultTokenTimeout, int maxResponseBytes = _defaultTokenResponseBytes, void onRequestOpened(HttpClientRequest request)?}) → Future<McpOAuthTokenGrant> -
Refreshes a resource-bound MCP OAuth grant without mutating
grant. -
registerMcpOAuthClient(
{required McpAuthorizationServerMetadata authorizationServer, required McpOAuthDynamicClientRegistrationRequest registration, String? initialAccessToken, HttpClient? httpClient, Map< String, String> headers = const <String, String>{}, Duration timeout = _defaultRegistrationTimeout, int maxResponseBytes = _defaultRegistrationResponseBytes, void onRequestOpened(HttpClientRequest request)?}) → Future<McpOAuthDynamicClientRegistration> - Registers a public OAuth client through the advertised RFC 7591 endpoint.
-
revokeMcpOAuthToken(
McpOAuthTokenGrant grant, {required McpOAuthClientAuthentication clientAuthentication, McpOAuthTokenKind tokenKind = McpOAuthTokenKind.refreshToken, HttpClient? httpClient, Map< String, String> headers = const <String, String>{}, Duration timeout = _defaultTokenTimeout, int maxResponseBytes = _defaultTokenResponseBytes, void onRequestOpened(HttpClientRequest request)?}) → Future<void> -
Revokes one credential from
grantthrough its discovered RFC 7009 endpoint.
Typedefs
-
McpCompletionHandler
= FutureOr<
McpCompletionResult> Function(McpCompletionRequest request) - Produces completion candidates for one prompt or resource-template argument.
-
McpFormElicitationHandler
= FutureOr<
McpFormElicitationResponse> Function(McpFormElicitationRequest request) - Handles one MCP form-elicitation input request.
- McpHttpClientFactory = HttpClient Function()
-
McpJsonMap
= Map<
String, Object?> -
McpOAuthExternalUserAgentLauncher
= FutureOr<
void> Function(Uri authorizationUri) - Opens a prepared OAuth authorization URI in an external user-agent.
Exceptions / Errors
- ConnectanumHttpAuthException
- ConnectanumHttpAuthGrantStateException
- A redacted failure to serialize or restore HTTP-auth grant state.
- ConnectanumHttpAuthProtocolException
- McpAuthorizationDiscoveryException
- A standards or transport failure during MCP OAuth metadata discovery.
- McpAuthorizationExpiredException
- Thrown before a new HTTP request uses a locally known-expired grant.
- McpAuthorizationFlowException
- A local validation failure or OAuth error from an authorization callback.
- McpJsonRpcException
- McpOAuthClientMetadataException
- McpOAuthClientRegistrationException
- McpOAuthClientRegistrationStateException
- A redacted persisted dynamic-registration validation failure.
- McpOAuthLoopbackCallbackException
- A redacted failure from the native OAuth loopback callback listener.
- McpOAuthStateException
- A redacted persisted OAuth state validation or lifecycle failure.
- McpOAuthStepUpException
- A redacted failure to derive an OAuth step-up authorization request.
- McpOAuthTokenException
- A local token-flow failure or typed OAuth token endpoint error.
- McpOAuthTokenGrantStateException
- A redacted persisted OAuth token-grant validation failure.
- McpStreamableHttpException
- McpStreamableProtocolException
- McpStreamableWampToolException