Starts an MCP server that exposes putior functions as tools for AI assistants. This enables AI coding assistants (Claude Code, Claude Desktop) to directly call workflow annotation and diagram generation functions.
Arguments
- type
Character string specifying the transport type:
"stdio" (default) - Standard input/output transport
"http" - HTTP transport
- host
Character string specifying the host for HTTP transport. Default: "127.0.0.1"
- port
Integer specifying the port for HTTP transport. Default: 8080
- root
For HTTP transport: the folder that the tools may scan (default: the working directory). A relative path is taken from it, a path outside it is an error, and a recursive scan skips the files that links inside it lead outside to. Over stdio the client is the local program that started the server, and paths are not limited.
- token
For HTTP transport:
NULL(default) or a string of at least 16 characters without spaces that clients must send as the headerPlumber-Shared-Secret: <token>. A server on an address other than a loopback one (127.0.0.1,localhost,::1) needs a token. Without one, only requests addressed to a loopback name are answered.
Details
The MCP server exposes the following putior functions as tools:
put- Scan files for PUT annotationsput_diagram- Generate Mermaid diagramsput_auto- Auto-detect workflow from codeput_generate- Generate annotation suggestionsput_merge- Merge manual + auto annotationsget_comment_prefix- Get comment prefix for extensionget_supported_extensions- List supported extensionslist_supported_languages- List supported languagesget_detection_patterns- Get auto-detection patternsget_diagram_themes- List available themesputior_guide- AI assistant documentationputior_help- Quick reference helpset_putior_log_level- Configure loggingis_valid_put_annotation- Validate annotation syntaxsplit_file_list- Parse file listsext_to_language- Extension to language name
Only these tools are served: mcptools' tools for choosing a running R
session (list_r_sessions, select_r_session) are turned off,
so every call runs in the server's own R process.
Over stdio, R warnings would never reach the client. When R warns while
a tool runs (invalid annotations, a < in a title or label, a
diagram over Mermaid's size limits, ...), the tool returns the warnings
as a second text item after its result, at most 20 of them, each cut to
1,000 characters. For put_diagram they are Mermaid comment lines,
so the diagram still renders when a client joins the two items; the
first item is always exactly the Mermaid code. When a call fails, the warnings raised before
the error follow its message.
Configuration
Claude Code (WSL/Linux/macOS):
claude mcp add putior -- Rscript -e "putior::putior_mcp_server()"
Claude Desktop (Windows):
Add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"putior": {
"command": "Rscript",
"args": ["-e", "putior::putior_mcp_server()"]
}
}
}
Security
Over stdio nothing below applies: the client is the program that started the server. Over HTTP:
A tool can scan only the
rootfolder and what lies below it, and returns the file names, labels and annotations found there, with the same rules asputior_acp_server: a path outside the root is an error, also through a symbolic link or junction; a recursive scan skips the files that links inside the root lead outside to; a path with a..component, control characters or a network or device form is rejected. Results and messages show the root as<root>, andput_diagramrefusesenable_clicks, whose links name files by their path on the server.Without a token, the server runs only on a loopback
hostand answers only requests addressed to a loopback name, so that a web page cannot reach it through DNS rebinding; mcptools also rejects requests from web pages of other origins.mcptools checks the token and the Host, through options that putior sets. Before serving, the server tests that mcptools refuses requests without the token or from an untrusted Host; if it does not (a version that reads other settings), the server does not start.
mcptools' own settings stay in force: hosts trusted through the option
mcptools.http_trusted_hostsor the environment variableMCPTOOLS_HTTP_TRUSTED_HOSTSare answered too, and a secret set throughmcptools.http_shared_secretorplumber2.sharedSecretis required whentokenisNULL.To serve other machines, set
token; mcptools then answers only requests that send it:# R putior_mcp_server(type = "http", host = "0.0.0.0", port = 8080, root = "path/to/project", token = Sys.getenv("PUTIOR_MCP_TOKEN")) # Claude Code claude mcp add --transport http putior http://<server>:8080/ \ --header "Plumber-Shared-Secret: <token>"The server does not use TLS and mcptools does not limit the request size: across a network, put it behind a proxy that serves HTTPS and limits the size, or the token travels in clear text.
See also
putior_mcp_tools for accessing the tool definitions
Other integration:
putior_acp_manifest(),
putior_acp_server(),
putior_guide(),
putior_help(),
putior_mcp_tools()