Skip to main content

Module remote_mcp

Module remote_mcp 

Source
Expand description

Remote-MCP inference backend — reach an external provider (Claude / Google / X, or another Webizen node) over the Model Context Protocol to run a completion on the person’s behalf.

Local inference is PREFERRED; this is the opt-in, costly path (Timothy’s directive: local-first, external-via-MCP when wanted/needed; future provider credentials slot in behind the same seam). Native-only — it does network / process I/O and is never part of the wasm bundle.

It issues an MCP tools/call to a configured inference tool (default llm_infer) and extracts the text from the MCP content result. Three transports, mirroring how the rest of the platform speaks MCP: TCP (newline-delimited JSON-RPC, exactly what the Webizen desktop MCP server on :4245 serves), Stdio (spawn an MCP server command), and HTTP (JSON-RPC POST).

Structs§

RemoteInferOutcome
Outcome of one remote inference call: the text plus the lowering receipt describing how the request reached the tool’s schema.

Constants§

DEFAULT_INFER_TOOL
Default MCP tool name to call for inference (the Webizen MCP surface exposes llm_infer).

Functions§

remote_mcp_infer
Run one inference over the configured MCP transport and return the completion plus the role-lowering receipt.
remote_mcp_probe
Test an MCP endpoint without asking it to generate text. It sends the standard tools/list request and only reports that a response was received.
remote_mcp_tool_supports_system_role
Discover whether the named inference tool’s declared inputSchema accepts a dedicated system argument, via a tools/list round-trip. None = capability unknown (endpoint error or tool absent); callers fall back to flattened arguments.