Module: Riffer::Mcp
Overview
Integration with Model Context Protocol (MCP) servers. Register servers globally; agents opt-in by tag via the use_mcp DSL. Tags are application-defined; see docs/14_MCP.md.
Riffer::Mcp.register(
name: "github",
tags: [:github],
endpoint: "https://mcp.github.com",
discovery_headers: -> { {"Authorization" => "Bearer #{ENV['GITHUB_TOKEN']}"} }
)
class MyAgent < Riffer::Agent
model "openai/gpt-4o"
use_mcp :github
end
Defined Under Namespace
Modules: AuthenticatedTool, Registry, ToolFactory Classes: Client, CredentialsDeniedError, Error, Manifest, Registration, SearchTool
Instance Method Summary collapse
-
#register(manifest_or_hash) ⇒ Object
Registers an MCP server, blocking until tool discovery completes.
-
#registrations ⇒ Object
Returns all current registrations keyed by name.
-
#unregister(name) ⇒ Object
Removes a registration by name; subsequent agent runs won’t see its tools.
Instance Method Details
#register(manifest_or_hash) ⇒ Object
Registers an MCP server, blocking until tool discovery completes. Raises on discovery failure. – : ((Hash[Symbol, untyped] | Riffer::Mcp::Manifest)) -> Riffer::Mcp::Registration
34 35 36 |
# File 'lib/riffer/mcp.rb', line 34 def register(manifest_or_hash) Registry.register(manifest_or_hash) end |
#registrations ⇒ Object
Returns all current registrations keyed by name.
– : () -> Hash[String, Riffer::Mcp::Registration]
49 50 51 |
# File 'lib/riffer/mcp.rb', line 49 def registrations Registry.registrations end |
#unregister(name) ⇒ Object
Removes a registration by name; subsequent agent runs won’t see its tools. – : (String) -> void
41 42 43 |
# File 'lib/riffer/mcp.rb', line 41 def unregister(name) Registry.unregister(name) end |