source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/adapter_test_helpers.rb
Ruby
mit
241
main
4,984
# frozen_string_literal: true # Adapter Testing DSL # # This module provides helper methods to create flexible tests that can run # across different MCP adapters (Native/RubyLLM and MCP SDK). # # Usage: # each_client do |config| # # runs on all 4 clients (stdio-native, streamable-native, stdio-mcp-sdk, streamabl...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/simple_multiply_tool.rb
Ruby
mit
241
main
398
# frozen_string_literal: true # Simple test tool class using base RubyLLM::Parameter class SimpleMultiplyTool < RubyLLM::Tool description "Multiply two numbers together" param :x, type: :number, desc: "First number", required: true param :y, type: :number, desc: "Second number", required: true def execute(x:...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/client_sync_helpers.rb
Ruby
mit
241
main
1,302
# frozen_string_literal: true # Client Synchronization Helpers # # This module provides helper methods for waiting on client state changes # and tool availability in tests. module ClientSyncHelpers # Wait for a specific tool to become available on a client # # @param client [RubyLLM::MCP::Client] The MCP client ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/mcp_test_configuration.rb
Ruby
mit
241
main
1,400
# frozen_string_literal: true module MCPTestConfiguration module_function class NullLogger def debug(*); end def info(*); end def warn(*); end def error(*); end def fatal(*); end def unknown(*); end end def configure_ruby_llm! RubyLLM.configure do |config| config.openai_api_...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/test_server_manager.rb
Ruby
mit
241
main
5,916
# frozen_string_literal: true require "socket" require "timeout" class TestServerManager PORTS = { http: ENV.fetch("PORT1", 3005), sse: ENV.fetch("PORT2", 3006), pagination: ENV.fetch("PORT3", 3007) }.freeze HTTP_SERVER_URL = "http://localhost:#{PORTS[:http]}/mcp".freeze PAGINATION_SERVER_URL = "...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/time_support.rb
Ruby
mit
241
main
363
# frozen_string_literal: true module TimeSupport def freeze_time(&block) time = Time.now allow(Time).to receive(:now).and_return(time) block.call allow(Time).to receive(:now).and_call_original end def travel_to(time) allow(Time).to receive(:now).and_return(time) end end RSpec.configure do...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/support/client_runner.rb
Ruby
mit
241
main
1,261
# frozen_string_literal: true class ClientRunner attr_reader :client, :options, :name class << self def mcp_sdk_available? @mcp_sdk_available ||= begin require "mcp" true rescue LoadError false end end def build_client_runners(configs) @client_runners |...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
spec/smoke/protocol_2025_11_25.rb
Ruby
mit
241
main
9,650
#!/usr/bin/env ruby # frozen_string_literal: true require "bundler/setup" require "json" require "ruby_llm" require "ruby_llm/mcp" require "ruby_llm/mcp/native/transports/support/timeout" require_relative "../support/mcp_test_configuration" require_relative "../support/test_server_manager" module Protocol20251125Smo...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/generators/ruby_llm/mcp/oauth/install_generator.rb
Ruby
mit
241
main
14,216
# frozen_string_literal: true require "rails/generators/base" require "rails/generators/active_record" module RubyLLM module MCP module OAuth module Generators class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path("t...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/generators/ruby_llm/mcp/install/install_generator.rb
Ruby
mit
241
main
1,321
# frozen_string_literal: true require "rails/generators/base" module RubyLLM module MCP module Generators class InstallGenerator < Rails::Generators::Base source_root File.expand_path("templates", __dir__) namespace "ruby_llm:mcp:install" desc "Install RubyLLM MCP configuration f...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/generators/ruby_llm/mcp/install/templates/initializer.rb
Ruby
mit
241
main
1,478
# frozen_string_literal: true # Configure RubyLLM MCP RubyLLM::MCP.configure do |config| # Default SDK adapter to use (:ruby_llm or :mcp_sdk) # - :ruby_llm: Full-featured, supports all MCP features + extensions # - :mcp_sdk: Official SDK, limited features but maintained by Anthropic config.default_adapter = :r...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/tasks/release.rake
Ruby
mit
241
main
657
# frozen_string_literal: true namespace :release do desc "Release a new version of the gem" task :version do # Load the current version from version.rb require_relative "../../lib/ruby_llm/mcp/version" version = RubyLLM::MCP::VERSION puts "Releasing version #{version}..." # Make sure we are o...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/tasks/smoke.rake
Ruby
mit
241
main
1,461
# frozen_string_literal: true module SmokeTasks module_function def run requested_file = ENV["FILE"]&.strip files = smoke_files(requested_file) if files.empty? puts "No smoke files found in spec/smoke" return end failures = run_files(files) print_summary(files, failures) ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/chat.rb
Ruby
mit
241
main
782
# frozen_string_literal: true # This is an override of the RubyLLM::Chat class to add convenient methods to more # easily work with the MCP clients. module RubyLLM class Chat def with_resources(*resources, **args) resources.each do |resource| resource.include(self, **args) end self ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp.rb
Ruby
mit
241
main
2,751
# frozen_string_literal: true # Standard Libraries require "cgi" require "date" require "erb" require "json" require "logger" require "open3" require "rbconfig" require "securerandom" require "socket" require "timeout" require "uri" require "yaml" # Gems require "httpx" require "json-schema" require "ruby_llm" requir...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/content.rb
Ruby
mit
241
main
824
# frozen_string_literal: true module RubyLLM module MCP class Content < RubyLLM::Content attr_reader :text, :attachments, :content def initialize(text: nil, attachments: nil) # rubocop:disable Lint/MissingSuper @text = text @attachments = [] # Handle MCP::Attachment objects ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/railtie.rb
Ruby
mit
241
main
358
# frozen_string_literal: true if defined?(Rails::Railtie) module RubyLLM module MCP class Railtie < Rails::Railtie generators do require_relative "../../generators/ruby_llm/mcp/install/install_generator" require_relative "../../generators/ruby_llm/mcp/oauth/install_generator" ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/attachment.rb
Ruby
mit
241
main
351
# frozen_string_literal: true module RubyLLM module MCP class Attachment < RubyLLM::Attachment attr_reader :content, :mime_type def initialize(content, mime_type) # rubocop:disable Lint/MissingSuper @content = content @mime_type = mime_type end def encoded @conte...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/server_capabilities.rb
Ruby
mit
241
main
1,982
# frozen_string_literal: true module RubyLLM module MCP class ServerCapabilities attr_accessor :capabilities def initialize(capabilities = {}) @capabilities = capabilities end def resources_list? !@capabilities["resources"].nil? end def resources_list_change...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/resource.rb
Ruby
mit
241
main
3,367
# frozen_string_literal: true module RubyLLM module MCP class Resource attr_reader :uri, :name, :description, :mime_type, :adapter, :subscribed, :apps_metadata def initialize(adapter, resource) @adapter = adapter @uri = resource["uri"] @name = resource["name"] @descri...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers.rb
Ruby
mit
241
main
407
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Detect if a handler is a class (vs a block/proc/lambda) # @param handler [Object] the handler to check # @return [Boolean] true if handler is a class def self.handler_class?(handler) handler.is_a?(Class) || ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native.rb
Ruby
mit
241
main
249
# frozen_string_literal: true require_relative "native/messages" module RubyLLM module MCP # Native protocol implementation namespace # This module contains the native Ruby MCP protocol implementation module Native end end end
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/errors.rb
Ruby
mit
241
main
2,232
# frozen_string_literal: true module RubyLLM module MCP module Errors class BaseError < StandardError attr_reader :message def initialize(message:) @message = message super(message) end end module Capabilities class CompletionNotAvailable < ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/elicitation.rb
Ruby
mit
241
main
8,544
# frozen_string_literal: true module RubyLLM module MCP class Elicitation ACCEPT_ACTION = "accept" CANCEL_ACTION = "cancel" DECLINE_ACTION = "decline" class DeferredCancellation def initialize(id) @id = id end def cancel # rubocop:disable Naming/Predica...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/sample.rb
Ruby
mit
241
main
6,950
# frozen_string_literal: true module RubyLLM module MCP class Sample class Hint attr_reader :model, :cost_priority, :speed_priority, :intelligence_priority def initialize(model, model_preferences) @model = model @model_preferences = model_preferences @hints =...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/tool.rb
Ruby
mit
241
main
7,032
# frozen_string_literal: true module RubyLLM module MCP class Annotation attr_reader :title, :read_only_hint, :destructive_hint, :idempotent_hint, :open_world_hint def initialize(annotation) @title = annotation["title"] || "" @read_only_hint = annotation["readOnlyHint"] || false ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/progress.rb
Ruby
mit
241
main
833
# frozen_string_literal: true module RubyLLM module MCP class Progress attr_reader :progress_token, :progress, :total, :message, :client def initialize(coordinator, progress_handler, progress_data) @coordinator = coordinator @client = coordinator.client @progress_handler = pr...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/completion.rb
Ruby
mit
241
main
331
# frozen_string_literal: true module RubyLLM module MCP class Completion attr_reader :argument, :values, :total, :has_more def initialize(argument:, values:, total:, has_more:) @argument = argument @values = values @total = total @has_more = has_more end end...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/schema_validator.rb
Ruby
mit
241
main
571
# frozen_string_literal: true require "json_schemer" module RubyLLM module MCP module SchemaValidator module_function def valid?(schema, data) return true if schema.nil? schemer(schema).valid?(data) rescue StandardError false end def valid_schema?(schema)...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/client.rb
Ruby
mit
241
main
16,372
# frozen_string_literal: true require "forwardable" module RubyLLM module MCP class Client extend Forwardable attr_reader :name, :config, :transport_type, :request_timeout, :log_level, :on, :roots, :adapter, :on_logging_level attr_accessor :linked_resources def initia...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/roots.rb
Ruby
mit
241
main
759
# frozen_string_literal: true module RubyLLM module MCP class Roots attr_reader :paths def initialize(paths: [], adapter: nil) @paths = paths @adapter = adapter end def active? @paths.any? end def add(path) @paths << path @adapter.roo...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/configuration.rb
Ruby
mit
241
main
10,263
# frozen_string_literal: true module RubyLLM module MCP class Configuration class AdapterConfig VALID_ADAPTERS = %i[ruby_llm mcp_sdk].freeze VALID_TRANSPORTS = %i[stdio sse streamable streamable_http http].freeze attr_accessor :default_adapter def initialize @def...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/task.rb
Ruby
mit
241
main
1,531
# frozen_string_literal: true module RubyLLM module MCP class Task attr_reader :adapter, :task_id, :status, :status_message, :created_at, :last_updated_at, :ttl, :poll_interval def initialize(adapter, task_response) @adapter = adapter @task_id = task_response["taskI...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/resource_template.rb
Ruby
mit
241
main
2,618
# frozen_string_literal: true require "httpx" module RubyLLM module MCP class ResourceTemplate attr_reader :uri, :name, :description, :mime_type, :adapter, :template, :apps_metadata def initialize(adapter, resource) @adapter = adapter @uri = resource["uriTemplate"] @name = r...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/prompt.rb
Ruby
mit
241
main
3,503
# frozen_string_literal: true module RubyLLM module MCP class Prompt class Argument attr_reader :name, :description, :required def initialize(name:, description:, required:) @name = name @description = description @required = required end def ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/error.rb
Ruby
mit
241
main
682
# frozen_string_literal: true module RubyLLM module MCP class Error def initialize(error_data) @code = error_data["code"] @message = error_data["message"] @data = error_data["data"] end def type case @code when -32_700 :parse_error when...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth.rb
Ruby
mit
241
main
13,851
# frozen_string_literal: true require "base64" require "digest/sha2" require "securerandom" require "time" module RubyLLM module MCP module Auth # OAuth configuration constants # Token refresh buffer time in seconds (5 minutes) TOKEN_REFRESH_BUFFER = 300 # Default OAuth timeout in secon...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/result.rb
Ruby
mit
241
main
2,505
# frozen_string_literal: true module RubyLLM module MCP class Notification attr_reader :type, :params def initialize(response) @type = response["method"] @params = response["params"] end end class Result attr_reader :response, :session_id, :id, :method, :result, ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/logging.rb
Ruby
mit
241
main
290
# frozen_string_literal: true module RubyLLM module MCP module Logging DEBUG = "debug" INFO = "info" NOTICE = "notice" WARNING = "warning" ERROR = "error" CRITICAL = "critical" ALERT = "alert" EMERGENCY = "emergency" end end end
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/notification_handler.rb
Ruby
mit
241
main
4,140
# frozen_string_literal: true module RubyLLM module MCP class NotificationHandler attr_reader :client def initialize(client) @client = client end def execute(notification) case notification.type when "notifications/tools/list_changed" client.reset_tools...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/configuration.rb
Ruby
mit
241
main
2,088
# frozen_string_literal: true module RubyLLM module MCP module Extensions class Configuration def initialize reset! end def register(id, config = {}) canonical_id = Registry.canonicalize_id(id) if canonical_id.nil? raise ArgumentError, "Ext...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/constants.rb
Ruby
mit
241
main
347
# frozen_string_literal: true module RubyLLM module MCP module Extensions module Constants UI_EXTENSION_ID = "io.modelcontextprotocol/ui" APPS_EXTENSION_ALIAS = "io.modelcontextprotocol/apps" EXTENSION_ALIASES = { APPS_EXTENSION_ALIAS => UI_EXTENSION_ID }.freeze ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/registry.rb
Ruby
mit
241
main
2,251
# frozen_string_literal: true module RubyLLM module MCP module Extensions module Registry module_function def canonicalize_id(id) return nil if id.nil? normalized = id.to_s.strip return nil if normalized.empty? Constants::EXTENSION_ALIASES.fetch(no...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/apps/constants.rb
Ruby
mit
241
main
705
# frozen_string_literal: true module RubyLLM module MCP module Extensions module Apps module Constants META_KEY = "_meta" UI_KEY = "ui" RESOURCE_URI_KEY = "resourceUri" LEGACY_RESOURCE_URI_KEY = "ui/resourceUri" VISIBILITY_KEY = "visibility" ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/apps/tool_metadata.rb
Ruby
mit
241
main
1,132
# frozen_string_literal: true module RubyLLM module MCP module Extensions module Apps class ToolMetadata attr_reader :resource_uri, :visibility, :raw def initialize(raw) @raw = raw.is_a?(Hash) ? raw : {} ui_meta = @raw[Constants::UI_KEY] @re...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/extensions/apps/resource_metadata.rb
Ruby
mit
241
main
735
# frozen_string_literal: true module RubyLLM module MCP module Extensions module Apps class ResourceMetadata attr_reader :csp, :permissions, :domain, :prefers_border, :raw def initialize(raw) @raw = raw.is_a?(Hash) ? raw : {} ui_meta = @raw[Constants::U...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/base_adapter.rb
Ruby
mit
241
main
6,707
# frozen_string_literal: true module RubyLLM module MCP module Adapters class BaseAdapter class << self def supported_features @supported_features ||= {} end def supports(*features) features.each { |f| supported_features[f] = true } e...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/ruby_llm_adapter.rb
Ruby
mit
241
main
8,670
# frozen_string_literal: true require "forwardable" module RubyLLM module MCP module Adapters # RubyLLM Adapter - wraps the Native protocol implementation # This is a thin bridge between the public API and Native::Client class RubyLLMAdapter < BaseAdapter extend Forwardable su...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/mcp_sdk_adapter.rb
Ruby
mit
241
main
13,808
# frozen_string_literal: true require_relative "mcp_transports/coordinator_stub" require_relative "mcp_transports/stdio" require_relative "mcp_transports/sse" require_relative "mcp_transports/streamable_http" module RubyLLM module MCP module Adapters class MCPSdkAdapter < BaseAdapter # Only declar...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/mcp_transports/stdio.rb
Ruby
mit
241
main
1,664
# frozen_string_literal: true module RubyLLM::MCP::Adapters::MCPTransports # Custom Stdio transport for MCP SDK adapter # Wraps the native Stdio transport to provide the interface expected by MCP::Client class Stdio attr_reader :native_transport def initialize(command:, args: [], env: {}, request_timeou...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/mcp_transports/sse.rb
Ruby
mit
241
main
1,652
# frozen_string_literal: true module RubyLLM::MCP::Adapters::MCPTransports # Custom SSE transport for MCP SDK adapter # Wraps the native SSE transport to provide the interface expected by MCP::Client class SSE attr_reader :native_transport def initialize(url:, headers: {}, version: :http2, request_timeo...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb
Ruby
mit
241
main
1,201
# frozen_string_literal: true module RubyLLM::MCP::Adapters::MCPTransports # Minimal coordinator stub for MCP transports # The native transports expect a coordinator object, but for the MCP SDK adapter # we don't need to process results (just pass them through) # as MCP SDK adapter doesn't methods that require...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/adapters/mcp_transports/streamable_http.rb
Ruby
mit
241
main
3,024
# frozen_string_literal: true module RubyLLM::MCP::Adapters::MCPTransports # Custom Streamable HTTP transport for MCP SDK adapter # Wraps the native StreamableHTTP transport to provide the interface expected by MCP::Client class StreamableHTTP attr_reader :native_transport def initialize(url:, headers: ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/cancellable_operation.rb
Ruby
mit
241
main
2,801
# frozen_string_literal: true module RubyLLM module MCP module Native # Wraps server-initiated requests to support cancellation. # The operation tracks terminal state so cancellation outcomes are explicit. class CancellableOperation attr_reader :request_id def initialize(reques...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transport.rb
Ruby
mit
241
main
3,295
# frozen_string_literal: true module RubyLLM module MCP module Native class Transport class << self def transports @transports ||= {} end def register_transport(transport_type, transport_class) transports[transport_type] = transport_class ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/notification.rb
Ruby
mit
241
main
287
# frozen_string_literal: true module RubyLLM module MCP module Native class Notification attr_reader :type, :params def initialize(response) @type = response["method"] @params = response["params"] end end end end end
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/json_rpc.rb
Ruby
mit
241
main
5,211
# frozen_string_literal: true module RubyLLM module MCP module Native module JsonRpc VERSION = "2.0" module ErrorCodes PARSE_ERROR = -32_700 INVALID_REQUEST = -32_600 METHOD_NOT_FOUND = -32_601 INVALID_PARAMS = -32_602 INTERNAL_ERROR = -32_...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/response_handler.rb
Ruby
mit
241
main
7,848
# frozen_string_literal: true module RubyLLM module MCP module Native class ResponseHandler attr_reader :coordinator def initialize(coordinator) @coordinator = coordinator end def execute(result) operation = CancellableOperation.new(result.id) ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/messages.rb
Ruby
mit
241
main
1,681
# frozen_string_literal: true module RubyLLM module MCP module Native # Centralized message builders for MCP JSON-RPC communication # All message construction happens here, returning properly formatted bodies module Messages JSONRPC_VERSION = JsonRpc::VERSION # Request methods ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/client.rb
Ruby
mit
241
main
19,765
# frozen_string_literal: true module RubyLLM module MCP module Native # Native MCP protocol client implementation # This is the core protocol implementation that handles all MCP operations # It's self-contained and could potentially be extracted as a separate gem class Client TOOL...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/task_registry.rb
Ruby
mit
241
main
1,588
# frozen_string_literal: true module RubyLLM module MCP module Native # In-memory task state cache used by the native client. # This keeps task metadata/status synchronized across list/get/cancel calls # and out-of-band status notifications. class TaskRegistry def initialize ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/protocol.rb
Ruby
mit
241
main
2,143
# frozen_string_literal: true module RubyLLM module MCP module Native module Protocol module_function LATEST_PROTOCOL_VERSION = "2025-11-25" EXTENSIONS_PROTOCOL_VERSION = "2025-06-18" DRAFT_PROTOCOL_VERSION = "2026-01-26" DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/streamable_http.rb
Ruby
mit
241
main
38,244
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports # Configuration options for reconnection behavior class ReconnectionOptions attr_reader :max_reconnection_delay, :initial_reconnection_delay, :reconnection_delay_grow_fact...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/sse.rb
Ruby
mit
241
main
23,182
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports class SSE include Support::Timeout attr_reader :headers, :id, :coordinator def initialize(url:, coordinator:, request_timeout:, options: {}) @event_url = url ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/stdio.rb
Ruby
mit
241
main
12,069
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports class Stdio include Support::Timeout attr_reader :command, :stdin, :stdout, :stderr, :id, :coordinator # Default environment that merges with user-provided env # This en...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/support/http_client.rb
Ruby
mit
241
main
665
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports module Support class HTTPClient CONNECTION_KEY = :ruby_llm_mcp_client_connection def self.connection Thread.current[CONNECTION_KEY] ||= build_connection ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/support/rate_limiter.rb
Ruby
mit
241
main
1,069
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports module Support class RateLimiter def initialize(limit: 10, interval: 1000) @limit = limit @interval = interval @timestamps = [] @mute...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/transports/support/timeout.rb
Ruby
mit
241
main
953
# frozen_string_literal: true module RubyLLM module MCP module Native module Transports module Support module Timeout def with_timeout(seconds, request_id: nil) result = nil exception = nil worker = Thread.new do resul...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/messages/responses.rb
Ruby
mit
241
main
3,049
# frozen_string_literal: true module RubyLLM module MCP module Native module Messages # Response message builders # Responses are sent in reply to requests from the server module Responses extend Helpers module_function def ping(id:) { ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/messages/helpers.rb
Ruby
mit
241
main
842
# frozen_string_literal: true require "securerandom" module RubyLLM module MCP module Native module Messages # Helper methods for message construction module Helpers def generate_id SecureRandom.uuid end def add_progress_token(params, tracking_pro...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/messages/notifications.rb
Ruby
mit
241
main
1,445
# frozen_string_literal: true module RubyLLM module MCP module Native module Messages # Notification message builders # Notifications do not have IDs and do not expect responses module Notifications extend Helpers module_function def initialized ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/native/messages/requests.rb
Ruby
mit
241
main
8,409
# frozen_string_literal: true module RubyLLM module MCP module Native module Messages # Request message builders # All methods return a JSON-RPC request body ready to be sent module Requests extend Helpers module_function def initialize(protocol_versi...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/http_response_handler.rb
Ruby
mit
241
main
2,398
# frozen_string_literal: true module RubyLLM module MCP module Auth # Utility class for handling HTTP responses in OAuth flows # Consolidates error handling and response parsing class HttpResponseHandler # Handle and parse a successful HTTP response # @param response [HTTPX::Res...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/security.rb
Ruby
mit
241
main
1,386
# frozen_string_literal: true module RubyLLM module MCP module Auth # Security utilities for OAuth implementation module Security module_function # Constant-time string comparison to prevent timing attacks # @param a [String] first string # @param b [String] second st...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/url_builder.rb
Ruby
mit
241
main
5,549
# frozen_string_literal: true module RubyLLM module MCP module Auth # Utility class for building OAuth URLs # Handles discovery URLs, authorization URLs, and URL normalization class UrlBuilder # Build discovery URL for OAuth server metadata # @param server_url [String] MCP serve...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/transport_oauth_helper.rb
Ruby
mit
241
main
4,422
# frozen_string_literal: true module RubyLLM module MCP module Auth # Helper module for preparing OAuth providers for transports # This keeps OAuth logic out of the Native module while making it reusable module TransportOauthHelper module_function # Check if OAuth configuration...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser_oauth_provider.rb
Ruby
mit
241
main
17,287
# frozen_string_literal: true module RubyLLM module MCP module Auth # Browser-based OAuth authentication provider # Provides complete OAuth 2.1 flow with automatic browser opening and local callback server # Compatible API with OAuthProvider for seamless interchange class BrowserOAuthProv...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/discoverer.rb
Ruby
mit
241
main
11,647
# frozen_string_literal: true module RubyLLM module MCP module Auth # Service for discovering OAuth authorization servers # Implements RFC 8414 (Server Metadata) and RFC 9728 (Protected Resource Metadata) class Discoverer attr_reader :http_client, :storage, :logger def initiali...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/session_manager.rb
Ruby
mit
241
main
1,768
# frozen_string_literal: true module RubyLLM module MCP module Auth # Service for managing OAuth session state (PKCE and CSRF state) # Handles creation, validation, and cleanup of temporary session data class SessionManager attr_reader :storage def initialize(storage) ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/oauth_provider.rb
Ruby
mit
241
main
14,877
# frozen_string_literal: true module RubyLLM module MCP module Auth # Core OAuth 2.1 provider implementing complete authorization flow # Supports RFC 7636 (PKCE), RFC 7591 (Dynamic Registration), # RFC 8414 (Server Metadata), RFC 8707 (Resource Indicators), RFC 9728 (Protected Resource Metadata...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/memory_storage.rb
Ruby
mit
241
main
2,623
# frozen_string_literal: true module RubyLLM module MCP module Auth # In-memory storage for OAuth data # Stores tokens, client registrations, server metadata, and temporary session data class MemoryStorage def initialize @mutex = Mutex.new @tokens = {} @cli...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/client_registrar.rb
Ruby
mit
241
main
7,329
# frozen_string_literal: true module RubyLLM module MCP module Auth # Service for registering OAuth clients # Implements RFC 7591 (Dynamic Client Registration) class ClientRegistrar attr_reader :http_client, :storage, :logger, :config def initialize(http_client, storage, logger...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/token_manager.rb
Ruby
mit
241
main
12,261
# frozen_string_literal: true module RubyLLM module MCP module Auth # Service for managing OAuth token operations # Handles token exchange, refresh, and client credentials flows class TokenManager attr_reader :http_client, :logger def initialize(http_client, logger) @...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/grant_strategies/base.rb
Ruby
mit
241
main
1,034
# frozen_string_literal: true module RubyLLM module MCP module Auth module GrantStrategies # Base strategy for OAuth grant types # Defines interface for grant-specific configuration class Base # Get token endpoint authentication method # @return [String] auth met...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/grant_strategies/client_credentials.rb
Ruby
mit
241
main
868
# frozen_string_literal: true module RubyLLM module MCP module Auth module GrantStrategies # Client Credentials grant strategy # Used for application authentication without user interaction class ClientCredentials < Base # Client credentials require client_secret ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/grant_strategies/authorization_code.rb
Ruby
mit
241
main
819
# frozen_string_literal: true module RubyLLM module MCP module Auth module GrantStrategies # Authorization Code grant strategy # Used for user authorization with PKCE (OAuth 2.1) class AuthorizationCode < Base # Public clients don't use client_secret # @return [S...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/flows/client_credentials_flow.rb
Ruby
mit
241
main
2,444
# frozen_string_literal: true module RubyLLM module MCP module Auth module Flows # Orchestrates OAuth 2.1 Client Credentials flow # Used for application authentication without user interaction class ClientCredentialsFlow attr_reader :discoverer, :client_registrar, :token_m...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/flows/authorization_code_flow.rb
Ruby
mit
241
main
4,821
# frozen_string_literal: true module RubyLLM module MCP module Auth module Flows # Orchestrates OAuth 2.1 Authorization Code flow with PKCE # Coordinates session management, discovery, registration, and token exchange class AuthorizationCodeFlow attr_reader :discoverer, :c...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser/callback_handler.rb
Ruby
mit
241
main
2,716
# frozen_string_literal: true module RubyLLM module MCP module Auth module Browser # Handles OAuth callback request processing # Extracts and validates OAuth parameters from callback requests class CallbackHandler attr_reader :callback_path, :logger def initiali...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser/opener.rb
Ruby
mit
241
main
1,081
# frozen_string_literal: true module RubyLLM module MCP module Auth module Browser # Browser opening utilities for different operating systems # Handles cross-platform browser launching class Opener attr_reader :logger def initialize(logger: nil) @lo...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser/http_server.rb
Ruby
mit
241
main
3,942
# frozen_string_literal: true module RubyLLM module MCP module Auth module Browser # HTTP server utilities for OAuth callback handling # Provides lightweight HTTP server functionality without external dependencies class HttpServer attr_reader :port, :logger def ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser/callback_server.rb
Ruby
mit
241
main
971
# frozen_string_literal: true module RubyLLM module MCP module Auth module Browser # Callback server wrapper for clean shutdown # Manages server lifecycle and thread coordination class CallbackServer def initialize(server, thread, stop_proc, start_proc = nil) @...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/auth/browser/pages.rb
Ruby
mit
241
main
25,885
# frozen_string_literal: true module RubyLLM module MCP module Auth module Browser # HTML page generation for OAuth callback responses # Provides default success and error pages with customization support class Pages attr_reader :custom_success_page, :custom_error_page ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/elicitation_registry.rb
Ruby
mit
241
main
6,213
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Registry for tracking pending elicitations # Provides thread-safe storage and retrieval for async completions class ElicitationRegistry class << self # Get the singleton registry instance def i...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/human_in_the_loop_registry.rb
Ruby
mit
241
main
7,955
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Registry for tracking pending human-in-the-loop approvals. # Registries are scoped per native client, with global ID routing so # approval IDs can still be completed externally. class HumanInTheLoopRegistry ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/human_in_the_loop_handler.rb
Ruby
mit
241
main
2,930
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Base class for human-in-the-loop approval handlers # Provides access to tool details, guards, and async support # # @example Basic approval handler # class MyApprovalHandler < RubyLLM::MCP::Handlers::HumanIn...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/promise.rb
Ruby
mit
241
main
6,030
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Promise implementation for async operations class Promise # Initialize a new promise def initialize @state = :pending @value = nil @reason = nil @mutex = Mutex.new ...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/approval_decision.rb
Ruby
mit
241
main
2,641
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Normalized decision returned by human-in-the-loop handlers. class ApprovalDecision VALID_STATUSES = %i[approved denied deferred].freeze attr_reader :status, :reason, :approval_id, :timeout, :promise de...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/elicitation_handler.rb
Ruby
mit
241
main
1,806
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Base class for elicitation request handlers # Provides access to elicitation object and async support # # @example Basic elicitation handler # class MyElicitationHandler < RubyLLM::MCP::Handlers::Elicitation...
github
patvice/ruby_llm-mcp
https://github.com/patvice/ruby_llm-mcp
lib/ruby_llm/mcp/handlers/async_response.rb
Ruby
mit
241
main
5,927
# frozen_string_literal: true module RubyLLM module MCP module Handlers # Represents an async response for deferred completion class AsyncResponse attr_reader :elicitation_id VALID_STATES = %i[pending completed rejected cancelled timed_out].freeze # Initialize async response...