Expand description
originlm mcp: the built-in Model Context Protocol server.
Newline-delimited JSON-RPC 2.0 over stdio (the MCP stdio transport). It
serves read-only tools over the same native service the broker uses, so
usage numbers come from the provider adapters’ own quota probes (Claude
Code get_usage, Codex account/rateLimits/read), never from estimates.
The handshake mirrors the SDK’s createCachedUsageMcp: initialize, then
notifications/initialized, then tools/list / tools/call.
Structs§
Enums§
Constants§
- CLIENT
- USAGE_
SOURCES - Providers whose adapters can report plan quota, and the grant that turns the read on. Claude Code and Codex are granted by default; the others are listed with the flags that enable them. Every other detected provider has no usage source in OriginLM today and is listed as such.
Functions§
- collect_
usage - Discover (when asked), probe every granted connection of
wanted, and shape the snapshot into the usage report. Shared by the MCPusagetool and theoriginlm usage/olm usagecommand so both show the same numbers. - detail_
codes - Diagnostic codes an adapter appended to an error message as
[A,B]. - friendly_
label - Claude Code’s
limits[]rows carry a rawkind(session,weekly_all,weekly_scoped · <model>). Name the ones whose meaning is established — the session bucket is the same one the adapter’s keyed path labels “5-hour session” — and keep any other provider label unchanged. - history_
text - Readable local token totals (
usage_historytool,usage --history). - provider_
filter - Optional
providersnarrowing: ids OriginLM discovery knows, else an error. - providers_
report - Shape the snapshot into the
providersresult. Pure, for tests. - serve
- Serve MCP over a byte stream until EOF.
- tool_
definitions - usage_
report - Shape the projected snapshot into the
usageresult. Pure, for tests. - usage_
terminal - Terminal rendering for
originlm usage/olm usage: one block per account with aligned window rows, then every detected provider that has no reading, each with its reason. Reset times are shown inoffset(the caller’s local zone). - usage_
text - The human-readable side of the
usageresult.