Desktop clients, over stdio
Claude Code:
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"runlog": {
"command": "Rscript",
"args": ["--no-init-file", "-e", "runlog::run_mcp_server()"]
}
}
}--no-init-file is not cosmetic: a user
.Rprofile that prints to stdout corrupts the JSON-RPC
stream before the first message.
mcp_client_config("claude_desktop") writes this snippet
for the package, with the full path of the current Rscript:
a desktop app may not find Rscript on its
PATH.
Over HTTP, clients connect to the URL of the server (see The HTTP transport).
A Claude Code session restricted to the server
Claude Code has no --mcp-only flag, but a few flags give
the same result, and it is enforced, not just requested:
claude \
--tools "" \
--strict-mcp-config \
--mcp-config ./runlog.json \
--no-chrome \
--disallowedTools "mcp__ide" \
--allowedTools "mcp__runlog__*" \
--permission-mode dontAskwhere runlog.json holds the Claude Desktop snippet
above.
| Flag | Effect |
|---|---|
--tools "" |
Removes every built-in tool (Bash, Read, Edit, web access…). MCP tools are not affected. |
--strict-mcp-config |
Loads only the servers passed with --mcp-config,
ignoring .mcp.json, user configuration and other MCP
sources. |
--mcp-config ./runlog.json |
Loads the mordew server. |
--no-chrome |
Turns off Claude in Chrome, whose browser tools
(javascript_tool…) --strict-mcp-config
keeps. |
--disallowedTools "mcp__ide" |
Removes the tools of the IDE server, which Claude Code connects to
by itself in an IDE’s integrated terminal and
--strict-mcp-config keeps (executeCode runs
Python in the Jupyter kernel). A deny rule naming a whole server removes
its tools from the model’s context. |
--allowedTools "mcp__runlog__*" |
Approves the server’s tools without prompting. It only changes permissions: it removes nothing. |
--permission-mode dontAsk |
Denies every call that would ask for permission, so only the approved tools can act, even if a later Claude Code version adds another source of tools. Calls that never ask, such as reads, still run. |
--disable-slash-commands also turns off skills and slash
commands, /mcp included: to see the server’s status, run
the command without it. In such a session, the model cannot run shell
commands or read files: those tools simply do not exist. The only
built-in tool left is EndConversation, which only ends the
conversation. One caveat: when an organisation deploys a managed
managed-mcp.json, Claude Code exits at startup if
--strict-mcp-config is passed. See the CLI reference
and the MCP
documentation.
mcp_client_config("claude_code") writes this command and
its configuration file, which add_mcp_client_config() saves
at the package root and adds to .Rbuildignore and
.gitignore (it holds the path of the current
Rscript). The command has
--disable-slash-commands (checked with Claude Code 2.1.331
on 2026-11-24, in an IDE terminal with Claude in Chrome installed: the
session lists only the server’s tools and
EndConversation).
Restricting other MCP clients
Claude Code is the only client found so far with a documented, all-or-nothing switch for built-in tools. Elsewhere, restriction goes through configuration, is partial, and is sometimes explicitly described as not being a security mechanism. Checked in November 2026:
| Client | Remove built-in tools | Restrict MCP servers and tools | How far it goes |
|---|---|---|---|
| Claude Code |
--tools "" removes every built-in tool |
--strict-mcp-config + --mcp-config;
--no-chrome and --disallowedTools "mcp__ide"
for the Chrome and IDE servers;
--permission-mode dontAsk
|
Enforced: the tools are not in the session. |
| Codex CLI |
features.shell_tool = false (or
codex --disable shell_tool). Other features
(multi_agent, view_image,
web_search = "disabled"…) can be turned off one by
one. |
mcp_servers.<id>.enabled_tools and
disabled_tools
|
Partial: no official MCP-only mode (the request is still open).
Three MCP resource tools (list_mcp_resources,
list_mcp_resource_templates,
read_mcp_resource) cannot be disabled; they only read MCP
resources. |
| Gemini CLI |
tools.core (allowlist) or tools.exclude
(deprecated), tool by tool; no documented “none” option |
mcp.allowed or --allowed-mcp-server-names;
per-server includeTools and excludeTools
|
Partial: the documentation says these settings should not be considered a foolproof security boundary. |
| VS Code, Copilot | Tool picker per request; a custom agent with its own tool list for a reusable selection | Same picker, per server and per tool; enterprise allowlist of MCP servers | Per session or per agent, configured in the editor. |
Two consequences for mordew:
- The server is the security boundary, not the client. Whatever the client, the closed tool list, argument validation, limits and OS-level isolation described in the security model must hold on their own.
-
mcp_client_config()generates the most restricted configuration each client allows, and says plainly when that restriction is partial. It is a development tool: it does not contain a client in production. Neither can the server, which MCP never shows the client’s other tools or the conversation: containing the client is the job of whoever deploys it.
Trying the tools
| Way | Model | Version served | What for |
|---|---|---|---|
call_tool() |
none | development, after devtools::load_all(); or
installed |
one call and its exact result, in the console or in a test |
| MCP Inspector | none | the command it is given | list the tools, fill their arguments in a form, read the raw protocol messages |
run_dev() |
an ellmer chat, or Claude Code with
client = "claude"
|
development | see by hand which tool the model picks, and with which arguments |
add_mcp_client_config() and its restricted
Claude Code session
|
Claude Code | installed | the package as its users will get it |
dev/evals.R, from use_evals()
|
Claude Code | development | the check of run_dev(), automated over a set of
questions, several runs each |
call_tool() runs outside tests too, given the
package:
The MCP Inspector starts the server from its command and arguments:
the ones mcp_client_config() writes. With version 2.16.0,
its own options come first and the server command after --,
or it takes -e for one of its options (checked on
2026-11-25):
npx @modelcontextprotocol/inspector@2.16.0 --cli --method tools/list -- \
Rscript --no-init-file -e "runlog::run_mcp_server()"call_tool(client = "inspector") runs the same call
through it.
Development loop: run_dev()
mordew ships no chat, but it gives a quick way to talk
to the package’s tools while developing them, the way
golem::run_dev() runs a Shiny app under development. It
works with ellmer, or with the claude CLI:
# any model provider, through ellmer (needs an API key)
mordew::run_dev(
client = "ellmer",
chat = ellmer::chat_anthropic(),
ui = "console"
)
# the `claude` CLI and its login, for example a Claude subscription
mordew::run_dev(
client = "claude"
)In both cases, the stdio server runs the development version of the
package
(Rscript --no-init-file -e "pkgload::load_all(<path>, quiet = TRUE); <package>::run_mcp_server()");
with client = "claude", run_dev() first writes
a temporary MCP configuration that starts it. Then:
client = "ellmer" |
client = "claude" |
|
|---|---|---|
| Connects to the server with |
mordew’s stdio client, whose tools become ellmer
tools, then chat$set_tools(); the server’s instructions
join the chat’s system prompt |
--mcp-config pointing to the temporary
configuration |
| Opens |
ellmer::live_console(), or
ellmer::live_browser() with
ui = "browser"
|
nothing: it prints the command to paste in a terminal, such as the IDE’s integrated terminal |
| Model and billing | any ellmer provider or a local model; API key in the environment, billed per token | the user’s Claude Code login, for example a Claude subscription |
| Other tools available | none: ellmer only sends the server’s tools | none: the session is restricted to the server |
With client = "claude", the command
run_dev() prints is:
claude --tools "" --strict-mcp-config \
--mcp-config /tmp/runlog-mcp.json --no-chrome \
--disallowedTools "mcp__ide" --allowedTools "mcp__runlog__*" \
--permission-mode dontAsk --disable-slash-commandsClaude Code is a full-screen terminal interface, so it cannot run
inside the R console: the command is printed rather than launched. For a
one-off question from R, claude -p, with the same flags,
returns the answer and the tool calls: that is how
run_evals() asks its questions, with
--output-format stream-json.
The tools go through MCP, exactly as they will for any other client:
same schema, same validation, same serialisation. Each tool call is
shown with its arguments, so it is clear at once whether the model picks
the right tool. One exception with ellmer 0.3.2: it sends tool results
to the model as text, so an image tool reaches the model as
a line saying an image was returned.
Things to keep in mind:
- The server runs in its own process: changing a tool means restarting
run_dev(), afterdevtools::document()when its roxygen tags changed, since the registry comes from them. - In stdio mode, nothing but protocol messages may reach stdout:
Rscriptruns with--no-init-file(a user.Rprofilemay print) and package loading must stay quiet. Tools run in a worker, whose output never reaches the stream, so acat()orprint()left in a tool goes nowhere; the front writes the messages to the C-level stdout. -
run_dev()is a manual version of the level 3 tests: evals automate the same loop over a set of questions.