|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
#include <atomic>#include <chrono>#include <cstdint>#include <exception>#include <expected>#include <functional>#include <istream>#include <map>#include <memory>#include <mutex>#include <optional>#include <ostream>#include <set>#include <stdexcept>#include <string>#include <string_view>#include <utility>#include <vector>#include "../core/completion.hpp"#include "../core/executor.hpp"#include "../core/remote.hpp"#include "../core/wire.hpp"#include "../forms/forms.hpp"#include "../session/session.hpp"#include "bundle.hpp"#include "value.hpp"Go to the source code of this file.
Classes | |
| struct | morph::ui::McpOptions |
| What an McpAdapter is built with. More... | |
| class | morph::ui::McpAdapter |
| Serves MCP's tools over one server connection (spec 8 §11). More... | |
Functions | |
| void | morph::ui::serveStdio (McpAdapter &adapter, exec::MainThreadExecutor &owner, std::istream &input, std::ostream &output) |
Serves an adapter over MCP's stdio transport: one JSON-RPC message per line of input, each reply on a line of output, in order, until input ends. An empty line is skipped. | |
Variables | |
| constexpr std::int64_t | morph::ui::kMcpMethodNotFound = -32601 |
| The JSON-RPC error code of a method the adapter does not answer. | |
| constexpr std::int64_t | morph::ui::kMcpParseError = -32700 |
| The JSON-RPC error code of a message that is not JSON. | |
| constexpr std::int64_t | morph::ui::kMcpInvalidRequest = -32600 |
| The JSON-RPC error code of a message that is not a request. | |
| constexpr std::int64_t | morph::ui::kMcpInvalidParams = -32602 |
| The JSON-RPC error code of a call whose arguments the adapter cannot use. | |
The MCP adapter (spec 8 §11): an agent's tool calls run through the server as ordinary envelopes on a connection of their own, so every check a GUI gets applies to them, and every GUI watching what they change is told. The adapter speaks MCP's JSON-RPC 2.0 and knows no transport; serveStdio drives it over MCP's stdio transport.
Definition in file agent.hpp.
|
inline |
Serves an adapter over MCP's stdio transport: one JSON-RPC message per line of input, each reply on a line of output, in order, until input ends. An empty line is skipped.
The calling thread is the adapter's owner: it pumps owner while it waits for each reply.
| adapter | The adapter; its McpOptions::callbacks is owner. |
| owner | The adapter's owner, run on the calling thread. |
| input | Where messages arrive. |
| output | Where replies go; flushed after each. |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |