Class: McpStdioRuby::Server
- Inherits:
-
Object
- Object
- McpStdioRuby::Server
- Defined in:
- lib/mcp_stdio_ruby/server.rb
Overview
Encapsulates the MCP Server logic
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 |
# File 'lib/mcp_stdio_ruby/server.rb', line 12 def initialize @server = MCP::Server.new( name: 'hello-world-server', version: '1.0.0', tools: [GreetTool] ) end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
10 11 12 |
# File 'lib/mcp_stdio_ruby/server.rb', line 10 def server @server end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/mcp_stdio_ruby/server.rb', line 20 def start AppLogger.logger.info "Starting MCP server: #{server.name} (v#{server.version})" run_transport rescue Interrupt AppLogger.logger.info 'Shutting down MCP server...' rescue StandardError => e handle_error(e) end |