THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class McpHttpTransport: (source)
Constructor: McpHttpTransport(app, compiled, config, bus)
Serve a registered endpoint without owning routes, sessions or identities.
| Method | __init__ |
Retain immutable server metadata and one shared protocol dispatcher. |
| Async Method | _close |
Close failed-response events without suppressing cleanup interruptions. |
| Method | _error |
Encode a sanitized protocol error with its required HTTP status. |
| Method | _params |
Decode method parameters and validate compiled tool parameter headers. |
| Async Method | _read |
Bound the native body stream before allocating the complete message. |
| Method | _release |
Release a single request or response-stream admission slot. |
| Async Method | _report |
Report an HTTP request failure without passing an unset identifier. |
| Async Method | _stream |
Transfer event-source ownership to a response or clean up on failure. |
| Method | _validate |
Reject origins and unsupported media types before reading a body. |
| Async Method | handle |
Validate HTTP metadata, dispatch once, and return native response objects. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _active |
Active value used by McpHttpTransport. |
| Instance Variable | _app |
Application owning runtime failure reporting. |
| Instance Variable | _compiled |
Precompiled metadata shared by request executions. |
| Instance Variable | _config |
Validated configuration controlling this component. |
| Instance Variable | _dispatcher |
Dispatcher produced by McpDispatcher. |
| Instance Variable | _origins |
Origins produced by frozenset. |
IApplication, compiled: CompiledMcpServer, config: McpConfig, bus: IMcpEventBus):
(source)
¶
Retain immutable server metadata and one shared protocol dispatcher.
| Parameters | |
app:orionis.IApplication | Application container supplying configuration and dependencies. |
compiled:orionis.mcp.server.compiler.CompiledMcpServer | Precompiled metadata shared by request executions. |
config:orionis.mcp.config.McpConfig | Validated configuration controlling this component. |
bus:orionis.mcp.contracts.event_bus.IMcpEventBus | Value supplied for bus. |
| Returns | |
None | Complete the documented operation without returning a value. |
Close failed-response events without suppressing cleanup interruptions.
| Parameters | |
events:orionis.mcp.transport.http._EventFrames | Event source to close after response construction fails. |
primary:BaseException | Construction or reporting failure retained if ordinary cleanup fails. |
| Returns | |
None | Close the producer and release its admission slot. |
| Raises | |
BaseException | If cleanup fails. Re-raise primary from an ordinary cleanup error; propagate cleanup cancellation or other non-Exception failures. |
McpProtocolException, request_id: str | int | msgspec.UnsetType) -> Response:
(source)
¶
Encode a sanitized protocol error with its required HTTP status.
| Parameters | |
exception:orionis.mcp.exceptions.McpProtocolException | Exception being inspected or reported. |
requeststr | int | msgspec.UnsetType | Value supplied for request_id. |
| Returns | |
orionis.http.Response | Result of the operation described above. |
Decode method parameters and validate compiled tool parameter headers.
| Parameters | |
request:orionis.http.Request | Current request and its trusted execution context. |
envelope:orionis.mcp.protocol.requests.JsonRpcRequest | Value supplied for envelope. |
| Returns | |
orionis.mcp.protocol.requests.RequestParams | Result of the operation described above. |
Bound the native body stream before allocating the complete message.
| Parameters | |
request:orionis.http.Request | Current request and its trusted execution context. |
| Returns | |
bytes | Result of the operation described above. |
Release a single request or response-stream admission slot.
| Returns | |
None | Complete the documented operation without returning a value. |
BaseException, request_id: str | int | msgspec.UnsetType, *, phase: str = 'request', expected: bool = False):
(source)
¶
Report an HTTP request failure without passing an unset identifier.
| Parameters | |
exception:BaseException | Request failure passed to the shared MCP reporting policy. |
requeststr | int | msgspec.UnsetType | Request identifier; convert msgspec.UNSET to None for reporting. |
phase:str, optional | Reporting phase, defaulting to "request". |
expected:bool, optional | Whether shared reporting should treat the failure as expected. |
| Returns | |
None | Await shared failure reporting with HTTP transport metadata. |
_EventFrames, status: int) -> EventStreamResponse:
(source)
¶
Transfer event-source ownership to a response or clean up on failure.
| Parameters | |
events:orionis.mcp.transport.http._EventFrames | Event source owning the producer iterator and admission slot. |
status:int | HTTP status code for the event-stream response. |
| Returns | |
orionis.http.responses.EventStreamResponse | Response owning the event source and its admission slot. |
| Raises | |
BaseException | If response creation fails, after attempted reporting and cleanup. Reporting or cleanup interruptions may take precedence. |
Reject origins and unsupported media types before reading a body.
| Parameters | |
request:orionis.http.Request | Current request and its trusted execution context. |
| Returns | |
None | Complete the documented operation without returning a value. |
Validate HTTP metadata, dispatch once, and return native response objects.
| Parameters | |
request:orionis.http.Request | Current request and its trusted execution context. |
| Returns | |
orionis.http.Response | Result of the operation described above. |