Convenience wrapper around mcptools::mcp_server() that serves
natmcp_tools(). Configure your client to run
Rscript -e "natmcp::natmcp_mcp_server()". The generic package-documentation
tools are delegated to btw; combine them by serving
c(btw::btw_tools(), natmcp_tools()) yourself if you want both.
Arguments
- index
Path to a built index (see
build_index());NULLuses the packaged/locally built index.- tools
Tool groups to serve (see
natmcp_tools());NULLfor all.- run_r
If
TRUE(default), also servenatmcp_run_r, which runs R code in a connected R session that has opted in withnatmcp_session()(run_r = TRUE)and refuses everywhere else. Omitted when theevaluatepackage is not installed.- ...
Passed to
mcptools::mcp_server()(e.g.type,port).
Details
Transport is stdio for local clients (Claude Desktop/Code). With
index = NULL a packaged or locally built index is used, else the
fetch_index() cache. If none exists, the first tool call runs
fetch_index() automatically, and at start-up a cached index that was last
checked more than a week ago is refreshed if a newer one has been published
(options(natmcp.refresh_days = ) sets the interval). Set
options(natmcp.auto_fetch = FALSE) to disable both.
On macOS the socket directory used to find R sessions is pinned as
described in natmcp_session(). The server also offers a natmcp_sitrep
tool so Claude can diagnose connection problems (see natmcp_sitrep()).