Skip to contents

Writes the most restricted configuration each client allows for the package's MCP server, and says what the restriction leaves out. The server runs with the full path of the current Rscript, which a desktop app may not find on its PATH.

Usage

mcp_client_config(
  client = c("claude_code", "claude_desktop"),
  mordew_wd = get_mordew_wd()
)

Arguments

client

"claude_code" for a Claude Code session restricted to the server, "claude_desktop" for Claude Desktop.

mordew_wd

Path to the package, get_mordew_wd() by default.

Value

The configuration and its instructions, as lines of text.

Examples

path <- file.path(
  tempfile(),
  "runlog"
)
create_mordew(
  path
)
mcp_client_config(
  "claude_code",
  path
)
#> Save as runlog.json:
#> {
#>   "mcpServers": {
#>     "runlog": {
#>       "command": "/opt/R/4.6.2/lib/R/bin/Rscript",
#>       "args": ["--no-init-file", "-e", "runlog::run_mcp_server()"]
#>     }
#>   }
#> }
#> 
#> Start a Claude Code session restricted to the server:
#> claude --tools "" --strict-mcp-config --mcp-config runlog.json --no-chrome --disallowedTools mcp__ide --allowedTools "mcp__runlog__*" --permission-mode dontAsk --disable-slash-commands
#> 
#> The session has no skills, no other MCP servers and no built-in tools apart from EndConversation, which only ends the conversation. Claude Code refuses --strict-mcp-config when an organisation deploys a managed-mcp.json.
#> 
#> --disable-slash-commands also removes /mcp: to see the server's status, run the command without it.