Skip to content

Commit fa1b1ee

Browse files
committed
clarify that the server owns tools
Closes #71.
1 parent ea16dc7 commit fa1b1ee

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

R/server.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@
7070
#' @param tools Optional collection of tools to expose. Supply either a list
7171
#' of objects created by [ellmer::tool()] or a path to an `.R` file that,
7272
#' when sourced, yields such a list. Defaults to `NULL`, which serves only
73-
#' the built-in session tools when `session_tools` is `TRUE`.
73+
#' the built-in session tools when `session_tools` is `TRUE`. Note that
74+
#' **tools are associated with the `mcp_server()`** rather than with
75+
#' `mcp_session()`s; to determine what tools are available in a session,
76+
#' set the `tools` argument to `mcp_server()`.
7477
#' @param ... Reserved for future use; currently ignored.
7578
#' @param type Transport type: `"stdio"` for standard input/output (default),
7679
#' or `"http"` for HTTP-based transport.
@@ -81,7 +84,8 @@
8184
#' for stdio transport.
8285
#' @param session_tools Logical value whether to include the built-in session
8386
#' tools (`list_r_sessions`, `select_r_session`) that work with
84-
#' `mcp_session()`. Defaults to `TRUE`.
87+
#' `mcp_session()`. Defaults to `TRUE`. Note that the tools to interface with
88+
#' sessions are still first routed through the `mcp_server()`.
8589
#'
8690
#' @returns
8791
#' `mcp_server()` and `mcp_session()` are both called primarily for their

man/server.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/server.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ knitr::include_graphics("https://raw.githubusercontent.com/posit-dev/mcptools/ma
3535

3636
- **Clients** are the apps you'd like to connect an R session to, like Claude Desktop of Claude Code. mcptools supports any client that supports MCP.
3737

38-
- Clients can run R functions as tools using an MCP **server**. Each client that supports MCP will provide some entry point to configure a command and any additional arguments with the client. mcptools's command and arguments are `Rscript` and `-e "mcptools::mcp_server()"`. Different clients register this command in different ways. For example, to use mcptools with the client Claude Code, you might write `claude mcp add -s "user" r-mcptools -- Rscript -e "mcptools::mcp_server()"`.
38+
- Clients can run R functions as tools using an MCP **server**. Each client that supports MCP will provide some entry point to configure a command and any additional arguments with the client. mcptools's command and arguments are `Rscript` and `-e "mcptools::mcp_server()"`. Different clients register this command in different ways. For example, to use mcptools with the client Claude Code, you might write `claude mcp add -s "user" r-mcptools -- Rscript -e "mcptools::mcp_server()"`. Note, however, that `mcp_server()` on its own won't surface any tools that are useful for coding agents—instead, you need to provide `tools` to the MCP server. See [btw::btw_mcp_server()](https://posit-dev.github.io/btw/reference/mcp.html) for a server that surfaces useful tools.
3939

40-
- **Sessions** are the R sessions that the client ultimately talks to. So, if you have an RStudio or Positron window open, those applications automatically start up an R session that the client could potentially talk to. To "opt in" your R sessions to be discovered by clients, run the R code `mcptools::mcp_session()`. You might want to run this code every time you start up R; to do so, add `mcptools::mcp_session()` to your `.Rprofile`, perhaps by first calling `usethis::edit_r_profile()`. **Configuring sessions is not required**; if you choose not to do so, tools will be executed in the server itself.
40+
- **Sessions** are the R sessions that the client ultimately talks to. So, if you have an RStudio or Positron window open, those applications automatically start up an R session that the client could potentially talk to. To "opt in" your R sessions to be discovered by clients, run the R code `mcptools::mcp_session()`. You might want to run this code every time you start up R; to do so, add `mcptools::mcp_session()` to your `.Rprofile`, perhaps by first calling `usethis::edit_r_profile()`. **Configuring sessions is not required**; if you choose not to do so, tools will be executed in the server itself. Note that **tools are configured per-server rather than per-session**; to configure tools with a session, set the `tools` argument in `mcp_server()`.
4141

4242
(In case this caught your eye: yes, the server is itself an R session. In mcptools's documentation, we'll always refer to the server R session just as the server; the fact that it's implemented in R is only a technical detail.)
4343

0 commit comments

Comments
 (0)