Skip to contents

Starts a Model Context Protocol server on stdio so an agent can generate validated vellumplot specs. It exposes three tools — get_schema, list_fields, and render_spec — that delegate to spec_schema(), spec_fields(), and spec_diagnose() + render_plot(). A render_spec failure returns structured diagnostics (unknown field, compile error) so the agent can repair and retry, rather than a traceback.

Usage

mcp_serve(input = "stdin", output = stdout())

Arguments

input, output

Connections to read requests from / write responses to (defaults: standard input / output).

Value

Invisibly NULL, when the input stream closes.

Details

The server is pure R (newline-delimited JSON-RPC 2.0 over stdio) and needs no Node or SDK. Point an MCP client at it with: Rscript -e 'vellumplot::mcp_serve()', or the bundled launcher system.file("mcp/server.R", package = "vellumplot").