Module: Html2mdMcpClient
- Defined in:
- lib/html2md_mcp_client.rb,
lib/html2md_mcp_client/client.rb,
lib/html2md_mcp_client/errors.rb,
lib/html2md_mcp_client/version.rb,
lib/html2md_mcp_client/transport/http.rb,
lib/html2md_mcp_client/transport/stdio.rb
Defined Under Namespace
Modules: Transport Classes: Client, ConnectionError, Error, NotConnectedError, ProtocolError, ToolError
Constant Summary collapse
- VERSION =
'0.2.2'.freeze
Class Method Summary collapse
-
.http(url, headers: {}, **opts) ⇒ Object
Connect to an MCP server over HTTP.
-
.stdio(command, args: [], **opts) ⇒ Object
Connect to an MCP server over stdio (spawns a subprocess).
Class Method Details
.http(url, headers: {}, **opts) ⇒ Object
Connect to an MCP server over HTTP.
client = Html2mdMcpClient.http("http://localhost:3001/mcp")
client.connect!
client.list_tools
client.call_tool("my_tool", { arg: "value" })
client.disconnect!
16 17 18 19 |
# File 'lib/html2md_mcp_client.rb', line 16 def self.http(url, headers: {}, **opts) transport = Transport::Http.new(url, headers: headers) Client.new(transport, **opts) end |
.stdio(command, args: [], **opts) ⇒ Object
Connect to an MCP server over stdio (spawns a subprocess).
client = Html2mdMcpClient.stdio("npx", args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])
client.connect!
client.list_tools
client.disconnect!
28 29 30 31 |
# File 'lib/html2md_mcp_client.rb', line 28 def self.stdio(command, args: [], **opts) transport = Transport::Stdio.new(command, args: args) Client.new(transport, **opts) end |