Class: HotwireClub::MCP::Server
- Inherits:
-
Object
- Object
- HotwireClub::MCP::Server
- Defined in:
- lib/hotwire_club/mcp/server.rb
Overview
MCP Server for Hotwire Club knowledge base
This server provides MCP tools for searching and browsing the knowledge base. It wraps a FastMcp::Server and registers all the required tools.
Instance Attribute Summary collapse
-
#fast_mcp_server ⇒ FastMcp::Server
readonly
Get the underlying FastMcp server instance.
Instance Method Summary collapse
-
#initialize(container: nil, adapter: nil, name: "hotwire-club-mcp", version: VERSION) ⇒ Server
constructor
Initialize the MCP server.
-
#run ⇒ Object
Run the MCP server (alias for start to match pseudocode API).
-
#start ⇒ Object
Start the MCP server (delegates to FastMcp server).
-
#tools ⇒ Hash
Get all registered tools.
Constructor Details
#initialize(container: nil, adapter: nil, name: "hotwire-club-mcp", version: VERSION) ⇒ Server
Initialize the MCP server
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hotwire_club/mcp/server.rb', line 20 def initialize(container: nil, adapter: nil, name: "hotwire-club-mcp", version: VERSION) if adapter @adapter = adapter @container = adapter.instance_variable_get(:@container) elsif container @container = container @adapter = Database::Adapter.new(container: container) else raise ArgumentError, "Either container: or adapter: must be provided" end @fast_mcp_server = ::FastMcp::Server.new(name: name, version: version) register_tools end |
Instance Attribute Details
#fast_mcp_server ⇒ FastMcp::Server (readonly)
Get the underlying FastMcp server instance
37 38 39 |
# File 'lib/hotwire_club/mcp/server.rb', line 37 def fast_mcp_server @fast_mcp_server end |
Instance Method Details
#run ⇒ Object
Run the MCP server (alias for start to match pseudocode API)
45 46 47 |
# File 'lib/hotwire_club/mcp/server.rb', line 45 def run start end |
#start ⇒ Object
Start the MCP server (delegates to FastMcp server)
40 41 42 |
# File 'lib/hotwire_club/mcp/server.rb', line 40 def start @fast_mcp_server.start end |
#tools ⇒ Hash
Get all registered tools
52 53 54 |
# File 'lib/hotwire_club/mcp/server.rb', line 52 def tools @fast_mcp_server.tools end |