RubyLLM::MCP v0.8 - OAuth 2.1 Support!!
Version 0.8.0 adds comprehensive OAuth 2.1 support for secure authentication with MCP servers.
OAuth 2.1 Authentication
This release implements OAuth 2.1 compliance with the security features you'd expect in production:
Key Features
- Spec Compliant: Full implementation for OAuth 2.1 support as outlined MCP Spec
- PKCE (RFC 7636): Proof Key for Code Exchange with SHA256 for secure authorization flows
- Dynamic Client Registration (RFC 7591): Automatic client registration with OAuth servers
- Server Discovery (RFC 8414): Automatic authorization server metadata discovery
- Browser-Based Authentication: Built-in local callback server with a clean UI (pure Ruby, no external dependencies)
- Automatic Token Refresh: Proactive token refresh with configurable buffers
- Pluggable Storage: Flexible storage interface for tokens, client info, and metadata
- Custom Storage: Implement your own storage backend for Redis, databases, or any persistence layer
- Multi-Transport Support: Works with SSE and StreamableHTTP transports, including generator example in rails
Quick Example
require "ruby_llm/mcp"
# Create client with OAuth config
client = RubyLLM::MCP.client(
name: "protected-server",
transport_type: :sse,
start: false,
config: {
url: "https://mcp.example.com/api",
oauth: { scope: "mcp:read mcp:write" }
}
)
# Authenticate via browser - that's it!
client.oauth(type: :browser).authenticate
# Use client normally
client.start
tools = client.toolsDocumentation
For complete details, configuration options, and integration guides:
- OAuth 2.1 Guide - Complete OAuth implementation details
- Rails OAuth Integration - Multi-user Rails setup with generators
- Getting Started - Quick start guide
Installation
Update your Gemfile:
gem 'ruby_llm-mcp', '~> 0.8.0'Then run:
bundle update ruby_llm-mcpAcknowledgments
Big shoutout for @parruda for provided the initial implementation, and ideas on how this could be implementation and used effectively!
What's Changed
- Fixed Gem Release Warnings by @patvice in #87
- Add OAuth 2.1 support for MCP servers by @parruda in #88
- OAuth Improvements: Refactor, Full MCP OAuth Spec Compliances and OAuth generator improvements by @patvice in #91
- Version bump to 0.8 by @patvice in #92
Full Changelog: v0.7.1...v0.8.0