Functions for interacting with MCP servers, which provide a standardized interface for agents to access tools, resources and prompts.

connect_mcp(server)

start_mcp(command, args = character())

tools(x, ...)

resources(x, ...)

prompts(x, ...)

Arguments

server

A specification of an MCP server. For local servers, this is typically a commandline. For remote servers, it should be a URL, typically just a hostname.

command

Name of command to execute. If this is a Python script (with extension .py), it is run via reticulate and uv to ensure proper dependency resolution.

args

List of string arguments to pass to command

x

The MCP session returned by connect_mcp

...

Additional arguments for methods.

Value

connect_mcp returns an MCP session object. tools, resources, and prompts return lists of functions that can be called to interact with the server.

Author

Michael Lawrence

Examples

if (FALSE) { # \dontrun{
    session <- connect_mcp(wizrd:::start_test_mcp())
    mcp_tools <- tools(session)
    result <- mcp_tools$add(1L, 2L)
} # }