mcptools 1.0.0
mcp_server()
New features:
-
mcptools can now run as a Posit Connect R API engine. Add a
_server.ymlwithengine: mcptools, pointtoolsto an.Rfile returningellmer::tool()objects, and deploy withrsconnect::deployAPI(".", contentCategory = "mcp"). -
mcp_server()can now return inline image content from tools that produceellmer::ContentImageInlineresults, including mixed text and image content (#96, #102). -
mcp_server()now returnsstructuredContentalongside serialized JSON text for successful tool results that are naturally represented as JSON objects, when using MCP protocol version 2025-06-18 or later (#104). -
mcp_server()now includes ellmer tool annotations intools/listresponses, preserving MCP safety hints such astitle,readOnlyHint,destructiveHint,idempotentHint, andopenWorldHint(#100, #105).
Bug fixes:
-
HTTP
mcp_server()requests now honor theMCP-Protocol-Versionheader, return400 Bad Requestfor unsupported protocol versions, and no longer let protocol negotiation from one HTTP client shape responses for another. -
JSON output now serializes R
NULLvalues as JSONnull, fixing JSON-RPC responses with null request IDs. -
mcp_server()no longer falls through after reportingInvalid Requestfor invalid stdio client messages. -
Forwarded
mcp_session()tool calls now return JSON-RPC errors when the selected R session does not respond within two minutes, rather than hanging indefinitely. Configure the timeout with themcptools.session_response_timeout_secondsoption or theMCPTOOLS_SESSION_RESPONSE_TIMEOUT_SECONDSenvironment variable. Session receive errors are also logged instead of silently discarded (#98).
mcp_tools()
New features:
-
mcp_tools()can now connect directly to remote Streamable HTTP MCP servers, configured withurlinstead ofcommand. Staticheadersare supported for token auth, and full OAuth 2.1 (authorization-server discovery, Dynamic Client Registration, PKCE, and automatic token refresh) is handled via httr2, which also caches tokens across sessions (#88). -
mcp_tools()now converts MCP tool-result content blocks into ellmer-native text and image content, allowing ellmer chats to receive image results from MCP tools.
Bug fixes:
mcp_tools()now launches MCP server processes with an allowlisted environment plus configuredenvvariables. Previously, servers without configuredenvinherited the full R process environment, while servers with configuredenvreceived only those variables. The new behavior more closely matches reference MCP SDKs, reduces accidental credential exposure, and fixes Windows startup failures whenenvis configured. Servers that need additional non-allowlisted variables should list them inenv(#62).