Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE, roclets = c("collate", "rd", "namespace", "mcpr::mcp_roclet"))
RoxygenNote: 7.3.2
Imports:
yyjsonr
yyjsonr,
roxygen2
Suggests:
ambiorix,
processx,
knitr,
rmarkdown,
httr2,
ellmer,
roxygen2
ellmer
URL: https://mcpr.opifex.org/, https://github.com/devOpifex/mcpr
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export(ellmer_to_mcpr_tool)
export(get_name)
export(initialize)
export(mcp_roclet)
export(new_client)
export(new_client_http)
export(new_client_io)
export(new_mcp)
export(new_prompt)
Expand Down
38 changes: 29 additions & 9 deletions R/client.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
#' @export
#' @name client
new_client_io <- function(
command,
args = character(),
name,
version = "1.0.0"
) {
command,
args = character(),
name,
version = "1.0.0") {
stopifnot(is.character(command), length(command) == 1)
stopifnot(!missing(name), is.character(name), length(name) == 1)

Expand All @@ -37,12 +36,23 @@ new_client_io <- function(
)
}

#' Create a new MCP HTTP client
#'
#' Creates an MCP client that connects to an HTTP endpoint using httr2.
#' This client can be used to communicate with MCP servers exposed via HTTP.
#'
#' @param endpoint The HTTP endpoint URL of the MCP server to connect to
#' @param name The name of the client, used for identification
#' @param version The version of the client (defaults to "1.0.0")
#'
#' @return A new MCP HTTP client object that can communicate
#' with the MCP server at the specified endpoint
#' @export
#' @rdname client
new_client_http <- function(
endpoint,
name,
version = "1.0.0"
) {
endpoint,
name,
version = "1.0.0") {
stopifnot(is.character(endpoint), length(endpoint) == 1)
stopifnot(!missing(name), is.character(name), length(name) == 1)

Expand All @@ -61,6 +71,16 @@ new_client_http <- function(
)
}

#' Create a new MCP client
#'
#' @param obj The underlying object for communication (process or request)
#' @param name The name of the client
#' @param version The version of the client
#' @param type The type of client to create ("io" or "http")
#'
#' @return A new mcp client object
#' @rdname client
#' @export
new_client <- function(obj, name, version, type = c("io", "http")) {
type <- match.arg(type)
cls <- sprintf("client_%s", type)
Expand Down
17 changes: 15 additions & 2 deletions man/client.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.