### Install rstudiomcp from GitHub Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Install the RStudio MCP extension from GitHub using the remotes package. Ensure you have remotes installed first. ```r install.packages("remotes") library("remotes") remotes::install_github("zygi/rstudiomcp") ``` -------------------------------- ### Manually Start MCP Server Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Manually start the RStudio MCP server using the `start_mcp_server()` function. This is useful for development or testing purposes. ```r library(rstudiomcp) start_mcp_server() ``` -------------------------------- ### Auto-load MCP Server on Project Open Source: https://github.com/zygi/rstudiomcp/blob/master/README.md This output indicates that the MCP server has started successfully and provides details about its endpoint, transport, and the location of its configuration file. This is typically seen after enabling auto-load in an RStudio project. ```text Starting MCP Server on http://localhost:16751 MCP Server started successfully! Endpoint: http://localhost:16751 Transport: Streamable HTTP (JSON responses, no SSE) Run stop_mcp_server() to stop the server Added RStudio MCP server to C:/Users/zygi/Documents/test_proj/.mcp.json ``` -------------------------------- ### Start MCP Server on a Specific Port Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Start the RStudio MCP server on a custom port, which is useful for managing concurrent sessions. Ensure each session uses a unique port. ```r library(rstudiomcp) start_mcp_server(port=12345) ``` -------------------------------- ### Troubleshooting Prompt for Claude Source: https://github.com/zygi/rstudiomcp/blob/master/README.md A prompt to provide to Claude for debugging RStudio-MCP setup issues. It includes a link to the project's README for context. ```text Hi! I'm trying to set up RStudio-MCP to use with a Claude Code session but it's not working. Could you please help me debug? The project readme is at https://github.com/zygi/rstudiomcp/blob/master/README.md (but maybe fetch it as a raw file.) ``` -------------------------------- ### Create and Modify Untitled Document Source: https://github.com/zygi/rstudiomcp/blob/master/CLAUDE.md Demonstrates creating a new document, inserting text, retrieving the active document, and sourcing its contents. ```r 1. create_document("x <- 1") # Returns ID, becomes active 2. insert_text("\ny <- 2") # Adds to active doc 3. get_active_document() # Reads active doc (shows ID, path, contents) 4. source_active_document() # Runs all lines ``` -------------------------------- ### Open and Modify Existing File Source: https://github.com/zygi/rstudiomcp/blob/master/CLAUDE.md Illustrates opening an existing file, making edits using text range replacement, and sourcing the document. ```r 1. open_document_file("/path/to/script.R") # Opens and activates 2. replace_text_range("old", "new") # Edits active doc 3. source_active_document() # Runs active doc ``` -------------------------------- ### Launch MCP Inspector Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Use this command to launch the MCP Inspector for debugging. Ensure the MCP server is running and accessible at the specified URL. ```bash npx @modelcontextprotocol/inspector http://localhost:16751/ ``` -------------------------------- ### Create and Modify Saved Document Source: https://github.com/zygi/rstudiomcp/blob/master/CLAUDE.md Shows how to create a new document with a specified file path, replace text within a range, and source the active document. ```r 1. create_document("x <- 1", "/path/to/script.R") # Creates saved file, becomes active 2. replace_text_range("old", "new") # Edits active doc 3. source_active_document() # Runs active doc ``` -------------------------------- ### Source Specific Lines of a Document Source: https://github.com/zygi/rstudiomcp/blob/master/CLAUDE.md Demonstrates creating a multi-line document and sourcing only a specific range of lines, providing visual feedback in the editor. ```r 1. create_document("line1\nline2\nline3\nline4") # Create multi-line doc 2. source_active_document(start_line=2, end_line=3) # Runs only lines 2-3 # Lines 2-3 are automatically selected in editor for visual feedback ``` -------------------------------- ### Restart MCP Server Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Use this command to restart the MCP server. This is helpful for resolving issues or after configuration changes. Alternatively, use the RStudio Addin 'Restart MCP Server'. ```r restart_mcp_server() ``` -------------------------------- ### Disable MCP Auto-start Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Use this command to disable the auto-start functionality of the MCP server for the current project. Alternatively, use the RStudio Addin 'Disable Auto-load (per project)'. ```r disable_autoload() ``` -------------------------------- ### Check MCP Server Status Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Use this command to check the current status of the MCP server. Alternatively, use the RStudio Addin 'MCP Server Status'. ```r mcp_status() ``` -------------------------------- ### Configure MCP Server Port Source: https://github.com/zygi/rstudiomcp/blob/master/README.md Use this command to change the default port (16751) for the MCP server. This is useful if the default port is already in use. ```r configure_mcp_server() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.